diff options
-rw-r--r-- | contrib/systemd/system/podman.service | 2 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | libpod/util.go | 30 | ||||
-rw-r--r-- | test/system/600-completion.bats | 33 | ||||
-rw-r--r-- | vendor/github.com/opencontainers/selinux/go-selinux/doc.go | 3 | ||||
-rw-r--r-- | vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go (renamed from vendor/github.com/opencontainers/selinux/go-selinux/label/label_selinux.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go | 2 | ||||
-rw-r--r-- | vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go | 2 | ||||
-rw-r--r-- | vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go | 2 | ||||
-rw-r--r-- | vendor/github.com/opencontainers/selinux/go-selinux/xattrs_linux.go (renamed from vendor/github.com/opencontainers/selinux/go-selinux/xattrs.go) | 2 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
12 files changed, 47 insertions, 39 deletions
diff --git a/contrib/systemd/system/podman.service b/contrib/systemd/system/podman.service index 9b5a1a87f..7e5195e7a 100644 --- a/contrib/systemd/system/podman.service +++ b/contrib/systemd/system/podman.service @@ -6,7 +6,7 @@ Documentation=man:podman-system-service(1) StartLimitIntervalSec=0 [Service] -Type=notify +Type=exec KillMode=process Environment=LOGGING="--log-level=info" ExecStart=/usr/bin/podman $LOGGING system service @@ -45,7 +45,7 @@ require ( github.com/opencontainers/runc v1.0.0-rc91.0.20200708210054-ce54a9d4d79b github.com/opencontainers/runtime-spec v1.0.3-0.20200817204227-f9c09b4ea1df github.com/opencontainers/runtime-tools v0.9.0 - github.com/opencontainers/selinux v1.7.0 + github.com/opencontainers/selinux v1.8.0 github.com/opentracing/opentracing-go v1.2.0 github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.0 @@ -443,8 +443,8 @@ github.com/opencontainers/runtime-tools v0.9.0/go.mod h1:r3f7wjNzSs2extwzU3Y+6pK github.com/opencontainers/selinux v1.5.1/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g= github.com/opencontainers/selinux v1.6.0 h1:+bIAS/Za3q5FTwWym4fTB0vObnfCf3G/NC7K6Jx62mY= github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= -github.com/opencontainers/selinux v1.7.0 h1:I3Qiu8dbuWHHHfwd4id7zXivJ1qWixGQx8nTvQsKnjs= -github.com/opencontainers/selinux v1.7.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= +github.com/opencontainers/selinux v1.8.0 h1:+77ba4ar4jsCbL1GLbFL8fFM57w6suPfSS9PDLDY7KM= +github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= github.com/openshift/imagebuilder v1.1.8 h1:gjiIl8pbNj0eC4XWvFJHATdDvYm64p9/pLDLQWoLZPA= github.com/openshift/imagebuilder v1.1.8/go.mod h1:9aJRczxCH0mvT6XQ+5STAQaPWz7OsWcU5/mRkt8IWeo= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= diff --git a/libpod/util.go b/libpod/util.go index c26039c50..ae9ef7172 100644 --- a/libpod/util.go +++ b/libpod/util.go @@ -142,29 +142,37 @@ func JSONDeepCopy(from, to interface{}) error { return json.Unmarshal(tmp, to) } -func dpkgVersion(path string) string { +func queryPackageVersion(cmdArg ...string) string { output := unknownPackage - cmd := exec.Command("/usr/bin/dpkg", "-S", path) - if outp, err := cmd.Output(); err == nil { - output = string(outp) + if 1 < len(cmdArg) { + cmd := exec.Command(cmdArg[0], cmdArg[1:]...) + if outp, err := cmd.Output(); err == nil { + output = string(outp) + } } return strings.Trim(output, "\n") } +func pacmanVersion(path string) string { + return queryPackageVersion("/usr/bin/pacman", "-Qo", path) +} + +func dpkgVersion(path string) string { + return queryPackageVersion("/usr/bin/dpkg", "-S", path) +} + func rpmVersion(path string) string { - output := unknownPackage - cmd := exec.Command("/usr/bin/rpm", "-q", "-f", path) - if outp, err := cmd.Output(); err == nil { - output = string(outp) - } - return strings.Trim(output, "\n") + return queryPackageVersion("/usr/bin/rpm", "-q", "-f", path) } func packageVersion(program string) string { if out := rpmVersion(program); out != unknownPackage { return out } - return dpkgVersion(program) + if out := dpkgVersion(program); out != unknownPackage { + return out + } + return pacmanVersion(program) } func programVersion(mountProgram string) (string, error) { diff --git a/test/system/600-completion.bats b/test/system/600-completion.bats index 39906704e..e52db9af0 100644 --- a/test/system/600-completion.bats +++ b/test/system/600-completion.bats @@ -72,8 +72,9 @@ function check_shell_completion() { if ! is_remote; then run_completion "$@" $cmd "--" # If this fails there is most likely a problem with the cobra library - is "${lines[0]}" "--.*" "Found flag in suggestions" - [ ${#lines[@]} -gt 2 ] || die "No flag suggestions" + is "${lines[0]}" "--.*" \ + "$* $cmd: flag(s) listed in suggestions" + [ ${#lines[@]} -gt 2 ] || die "$* $cmd: No flag suggestions" _check_completion_end NoFileComp fi # continue the outer for args loop @@ -87,7 +88,8 @@ function check_shell_completion() { fi run_completion "$@" $cmd "${extra_args[@]}" "" - is "$output" ".*-$random_container_name${nl}" "Found expected container in suggestions for '$cmd'" + is "$output" ".*-$random_container_name${nl}" \ + "$* $cmd: actual container listed in suggestions" match=true # resume @@ -95,7 +97,8 @@ function check_shell_completion() { *POD*) run_completion "$@" $cmd "${extra_args[@]}" "" - is "$output" ".*-$random_pod_name${nl}" "Found expected pod in suggestions" + is "$output" ".*-$random_pod_name${nl}" \ + "$* $cmd: actual pod listed in suggestions" _check_completion_end NoFileComp match=true @@ -104,16 +107,20 @@ function check_shell_completion() { *IMAGE*) run_completion "$@" $cmd "${extra_args[@]}" "" - is "$output" ".*localhost/$random_image_name:$random_image_tag${nl}" "Found expected image in suggestions" + is "$output" ".*localhost/$random_image_name:$random_image_tag${nl}" \ + "$* $cmd: actual image listed in suggestions" # check that we complete the image with and without tag after at least one char is typed run_completion "$@" $cmd "${extra_args[@]}" "${random_image_name:0:1}" - is "$output" ".*$random_image_name:$random_image_tag${nl}" "Found expected image with tag in suggestions" - is "$output" ".*$random_image_name${nl}" "Found expected image without tag in suggestions" + is "$output" ".*$random_image_name:$random_image_tag${nl}" \ + "$* $cmd: image name:tag included in suggestions" + is "$output" ".*$random_image_name${nl}" \ + "$* $cmd: image name(w/o tag) included in suggestions" # check that we complete the image id after at least two chars are typed run_completion "$@" $cmd "${extra_args[@]}" "${random_image_id:0:2}" - is "$output" ".*$random_image_id${nl}" "Found expected image id in suggestions" + is "$output" ".*$random_image_id${nl}" \ + "$* $cmd: image id included in suggestions when two leading characters present in command line" match=true # resume @@ -121,7 +128,8 @@ function check_shell_completion() { *NETWORK*) run_completion "$@" $cmd "${extra_args[@]}" "" - is "$output" ".*$random_network_name${nl}" "Found network in suggestions" + is "$output" ".*$random_network_name${nl}" \ + "$* $cmd: actual network listed in suggestions" _check_completion_end NoFileComp match=true @@ -130,7 +138,8 @@ function check_shell_completion() { *VOLUME*) run_completion "$@" $cmd "${extra_args[@]}" "" - is "$output" ".*$random_volume_name${nl}" "Found volume in suggestions" + is "$output" ".*$random_volume_name${nl}" \ + "$* $cmd: actual volume listed in suggestions" _check_completion_end NoFileComp match=true @@ -142,7 +151,7 @@ function check_shell_completion() { ### FIXME how can we get the configured registries? _check_completion_end NoFileComp ### FIXME this fails if no registries are configured - [[ ${#lines[@]} -gt 2 ]] || die "No registries found in suggestions" + [[ ${#lines[@]} -gt 2 ]] || die "$* $cmd: No REGISTRIES found in suggestions" match=true # resume @@ -157,7 +166,7 @@ function check_shell_completion() { _check_completion_end NoSpace else _check_completion_end Default - [[ ${#lines[@]} -eq 2 ]] || die "Suggestions are in the output" + [[ ${#lines[@]} -eq 2 ]] || die "$* $cmd: Suggestions are in the output" fi ;; diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/doc.go b/vendor/github.com/opencontainers/selinux/go-selinux/doc.go index 79a8e6446..9c9cbd120 100644 --- a/vendor/github.com/opencontainers/selinux/go-selinux/doc.go +++ b/vendor/github.com/opencontainers/selinux/go-selinux/doc.go @@ -5,9 +5,6 @@ This package uses a selinux build tag to enable the selinux functionality. This allows non-linux and linux users who do not have selinux support to still use tools that rely on this library. -To compile with full selinux support use the -tags=selinux option in your build -and test commands. - Usage: import "github.com/opencontainers/selinux/go-selinux" diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_selinux.go b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go index 988adc8f4..439455511 100644 --- a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_selinux.go +++ b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_linux.go @@ -1,5 +1,3 @@ -// +build selinux,linux - package label import ( diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go index a7d2d5e34..02d206239 100644 --- a/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go +++ b/vendor/github.com/opencontainers/selinux/go-selinux/label/label_stub.go @@ -1,4 +1,4 @@ -// +build !selinux !linux +// +build !linux package label diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go index 904f5b04f..5bfcc0490 100644 --- a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go +++ b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go @@ -1,5 +1,3 @@ -// +build selinux,linux - package selinux import ( diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go index e4b65c9e2..70b7b7c85 100644 --- a/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go +++ b/vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go @@ -1,4 +1,4 @@ -// +build !selinux !linux +// +build !linux package selinux diff --git a/vendor/github.com/opencontainers/selinux/go-selinux/xattrs.go b/vendor/github.com/opencontainers/selinux/go-selinux/xattrs_linux.go index 2365b4bda..117c255be 100644 --- a/vendor/github.com/opencontainers/selinux/go-selinux/xattrs.go +++ b/vendor/github.com/opencontainers/selinux/go-selinux/xattrs_linux.go @@ -1,5 +1,3 @@ -// +build selinux,linux - package selinux import ( diff --git a/vendor/modules.txt b/vendor/modules.txt index fe45f9237..d15c6d766 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -459,7 +459,7 @@ github.com/opencontainers/runtime-tools/generate github.com/opencontainers/runtime-tools/generate/seccomp github.com/opencontainers/runtime-tools/specerror github.com/opencontainers/runtime-tools/validate -# github.com/opencontainers/selinux v1.7.0 +# github.com/opencontainers/selinux v1.8.0 github.com/opencontainers/selinux/go-selinux github.com/opencontainers/selinux/go-selinux/label github.com/opencontainers/selinux/pkg/pwalk |