]> git.saurik.com Git - apt.git/commitdiff
test: More portable check for dpkg versions
authorJulian Andres Klode <jak@debian.org>
Wed, 24 Aug 2016 14:21:12 +0000 (16:21 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 20:22:47 +0000 (22:22 +0200)
This check should work regardless if dpkg was installed by dpkg
or by a native package manager like RPM or pkg.

Gbp-Dch: ignore

test/integration/framework
test/integration/test-bug-661537-build-profiles-support
test/integration/test-bug-769609-triggers-still-pending-after-run
test/integration/test-no-fds-leaked-to-maintainer-scripts

index 677c40711ba842bbdab7c71072699e4f75f5d4de..ec57a23c34b7e0fbc194793b373ed161cceadb49 100644 (file)
@@ -195,6 +195,9 @@ aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; }
 dpkg() {
        "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@"
 }
+dpkg_version() {
+       command perl -MDpkg -E 'say $Dpkg::PROGVERSION'
+}
 dpkgcheckbuilddeps() {
        command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@"
 }
index 91115ea18a1c1cbbdeb7a082728902f69306b586..d24484de9f453d8eddd82bf0fa6a9ead63eda2a6 100755 (executable)
@@ -76,7 +76,7 @@ Building dependency tree...
 }
 
 msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
-if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.14'; then
+if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.17.14'; then
        msgpass
        testwithdpkg() {
                msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
index b44ebf74f0b9aa1856e3f36b9328ba5a1f8b684d..ce2c193ddfd8b040197be36b8392314018e7d6ef 100755 (executable)
@@ -8,7 +8,7 @@ setupenvironment
 configarchitecture 'amd64'
 
 msgtest 'Check if installed dpkg supports' 'noawait trigger'
-if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then
+if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.16.1'; then
        msgpass
 else
        msgskip 'dpkg version too old'
index ca93f78b4f7e9e707d70234a87e4dc770d999b53..7b5d6727ef0781ed7f1279bd678364aae46f7b9d 100755 (executable)
@@ -29,7 +29,7 @@ buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
 rm -rf "$BUILDDIR"
 
 PKGNAME='fdleaks:all'
-if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null >/dev/null 2>&1; then
+if dpkg --compare-versions "$(dpkg_version)" 'lt' '1.16.2'; then
        PKGNAME='fdleaks'
 fi