From 6f71fa6d9dc82a42cc3823247bd0aed0ea138162 Mon Sep 17 00:00:00 2001 From: Anders F Björklund Date: Thu, 24 Feb 2022 20:23:00 +0100 Subject: Show version of the deb package in info output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously just showing name of the package, followed by the path repeated again (already stated on the line above) [NO NEW TESTS NEEDED] Signed-off-by: Anders F Björklund --- libpod/util.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libpod/util.go b/libpod/util.go index 307caa8c5..51fe60427 100644 --- a/libpod/util.go +++ b/libpod/util.go @@ -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 " -- cgit v1.2.3-54-g00ecf