Use the CutPrefix(), SplitSeq(), and FieldsSeq() functions from the
strings package when chopping up or iterating over parts of strings, per
golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Stop using containerd's `platform.Normalize` instead use libimage's
`NormalizePlatform` which calls containerd's `platform.Normalize` along
with `platform.Parse` internally.
See discussion here: https://github.com/containers/buildah/pull/4286/files#r977389931
Signed-off-by: Aditya R <arajan@redhat.com>
On non-windows platforms, we can use the uname syscall to get kernel
version information. For uptime, we can use clock_gettime(CLOCK_UPTIME)
on FreeBSD but I don't have a solution for darwin or windows.
Note: the existing code which unconditionally reads from /proc builds
on all platforms but only works on linux since using /proc in this way
is a linux feature.
[NO NEW TESTS NEEDED]
Signed-off-by: Doug Rabson <dfr@rabson.org>
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Add the variant field, along with methods for setting and querying it,
and expose them in the `buildah config` and `buildah inspect` commands.
When setting an initial architecture for a container based on an image
which doesn't contain an architecture, or from "scratch", normalize the
architecture name we've been given, and set both it and the variant
field at the same time.
Provide normalized architecture+variant values in `buildah info`.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
We have moved share code from buildah, podman and others into containers/common.
Specifically for this PR we are moving to use containers/common/pkg/unshare and
containers/common/pkg/cgroups.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #2010
Approved by: QiWang19
We have a function that decides what our OCI runtime command is, and
duplicating that logic for `buildah info` isn't necessary.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1980
Approved by: vrothberg
This commit enabled the `unparam` linter and applies all reported issues.
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
Closes: #1719
Approved by: rhatdan
We don't want to vendor anything from libpod into Buildah.
We want to switch this around. Moving pkg content from libpod
to Buildah allows us to fix this.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #1400
Approved by: giuseppe