Skip to content

Commit

Permalink
Merge pull request #13343 from afbjorklund/dpkg-package
Browse files Browse the repository at this point in the history
Show version of the deb package in info output
  • Loading branch information
openshift-merge-robot authored Feb 25, 2022
2 parents 2cb011e + 6f71fa6 commit 2225c65
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libpod/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ func queryPackageVersion(cmdArg ...string) string {
cmd := exec.Command(cmdArg[0], cmdArg[1:]...)
if outp, err := cmd.Output(); err == nil {
output = string(outp)
if cmdArg[0] == "/usr/bin/dpkg" {
r := strings.Split(output, ": ")
queryFormat := `${Package}_${Version}_${Architecture}`
cmd = exec.Command("/usr/bin/dpkg-query", "-f", queryFormat, "-W", r[0])
if outp, err := cmd.Output(); err == nil {
output = string(outp)
}
}
}
if cmdArg[0] == "/sbin/apk" {
prefix := cmdArg[len(cmdArg)-1] + " is owned by "
Expand Down

0 comments on commit 2225c65

Please sign in to comment.