From cd907113561d5eb75054f981be3bcc22eee8db27 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 3 Feb 2016 12:58:23 +0100 Subject: use pkgCache::VS instead of pkgDepCache::VS() The later just calls the earlier, but the later needs the fullblown dependency cache to be initialized, which is a very costly operation and isn't done anymore that early in the run as we would need to throw away and rebuild it again after we got all the information about source pkgs. As we end up with a nullptr for the pkgDepCache, we use a slightly longer calling convention to make sure that we use the pkgCache directly, avoiding nullptr induced segfaults and costly operations. Git-Dch: Ignore Reported-By: Balint Reczey --- test/integration/test-apt-get-build-dep-file | 194 +++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100755 test/integration/test-apt-get-build-dep-file (limited to 'test/integration/test-apt-get-build-dep-file') diff --git a/test/integration/test-apt-get-build-dep-file b/test/integration/test-apt-get-build-dep-file new file mode 100755 index 000000000..2cd4f57ec --- /dev/null +++ b/test/integration/test-apt-get-build-dep-file @@ -0,0 +1,194 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'i386' + +insertpackage 'stable' 'debhelper' 'i386' '7' +insertpackage 'stable' 'build-essential' 'i386' '1' +insertpackage 'stable' 'build-depends' 'i386' '1' +insertinstalledpackage 'build-conflict' 'i386' '1' + +setupaptarchive + +msgmsg 'Test with' 'unsigned dsc' +cat > 2vcard_0.5-3.dsc < +Uploaders: Marcela Tiznado +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 5.0.37) +Build-Conflicts: build-conflict (<< 2) +Checksums-Sha1: + b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz + 5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz +Checksums-Sha256: + efdc22859ac2f8f030d038dc4faa9020082ebae34212498c288968ffd45c9764 9398 2vcard_0.5.orig.tar.gz + 82673ff3456af571094066c89bcea87b25c23c87cf1d0050b731e5222563626b 2036 2vcard_0.5-3.diff.gz +Files: + f73a69c170f772f3f6e75f2d11bbb792 9398 2vcard_0.5.orig.tar.gz + 1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz +EOF + +test2vcardbuilddep() { + testsuccessequal "Note, using file './2vcard_0.5-3.dsc' to get the build dependencies +Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + build-conflict +The following NEW packages will be installed: + build-essential debhelper +0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv build-conflict [1] +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep -s ./2vcard_0.5-3.dsc +testfailure aptget build-dep --simulate 2vcard_0.5-3.dsc +cd downloaded +testsuccess aptget build-dep --simulate ../2vcard_0.5-3.dsc +testsuccess aptget build-dep --simulate "$(readlink -f ../2vcard_0.5-3.dsc)" +cd .. +} +test2vcardbuilddep + +msgmsg 'Test with' 'signed dsc' +cat > 2vcard_0.5-3.dsc < +Uploaders: Marcela Tiznado +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 5.0.37) +Build-Conflicts: build-conflict (<< 2) +Checksums-Sha1: + b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz + 5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz +Checksums-Sha256: + efdc22859ac2f8f030d038dc4faa9020082ebae34212498c288968ffd45c9764 9398 2vcard_0.5.orig.tar.gz + 82673ff3456af571094066c89bcea87b25c23c87cf1d0050b731e5222563626b 2036 2vcard_0.5-3.diff.gz +Files: + f73a69c170f772f3f6e75f2d11bbb792 9398 2vcard_0.5.orig.tar.gz + 1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iEYEARECAAYFAkijKhsACgkQsrBfRdYmq7aA2gCfaOW9riTYVQMx5ajKQVAcctlC +z2UAn1oXgTai6opwhVfkxrlmJ+iRxzuc +=4eRd +-----END PGP SIGNATURE----- +EOF +test2vcardbuilddep + + +msgmsg 'Test with' 'unpacked source dir' +mkdir -p foo-1.0/debian +cat > foo-1.0/debian/control <<'EOF' +Source: apturl +Section: admin +Priority: optional +Maintainer: Michael Vogt +Build-Depends: debhelper (>= 7) +X-Python3-Version: >= 3.2 +Standards-Version: 3.9.3 + +Package: apturl-common +Architecture: any +Depends: ${python3:Depends}, + ${shlibs:Depends}, + ${misc:Depends}, + python3-apt, + python3-update-manager +Replaces: apturl (<< 0.3.6ubuntu2) +Description: install packages using the apt protocol - common data + AptUrl is a simple graphical application that takes an URL (which follows the + apt-protocol) as a command line option, parses it and carries out the + operations that the URL describes (that is, it asks the user if he wants the + indicated packages to be installed and if the answer is positive does so for + him). + . + This package contains the common data shared between the frontends. + +EOF + +testsuccessequal "Note, using directory './foo-1.0' to get the build dependencies +Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + build-essential debhelper +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./foo-1.0 +testfailure aptget build-dep --simulate foo-1.0 +cd downloaded +testsuccess aptget build-dep --simulate ../foo-1.0 +testsuccess aptget build-dep --simulate "$(readlink -f ../foo-1.0)" +cd .. + +testfailureequal 'E: Must specify at least one package to check builddeps for' aptget build-dep +testfailureequal 'E: No architecture information available for armel. See apt.conf(5) APT::Architectures for setup' aptget build-dep --simulate ./foo-1.0 -a armel +testfailureequal 'Reading package lists... +E: Unable to find a source package for foo' aptget build-dep --simulate foo + +msgmsg 'Test with a dsc' 'with comments' +cat > comments.dsc < +Build-Depends: debhelper (>= 5), +# TODO: add more + build-depends (= 1), +Standards-Version: 3.9.6 +# This is the end… + +# or this? +EOF +testsuccessequal "Note, using file './comments.dsc' to get the build dependencies +Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + build-depends build-essential debhelper +0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Inst build-depends (1 stable [i386]) +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-depends (1 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./comments.dsc +testsuccessequal "Note, using file './comments.dsc' to get the build dependencies +Reading package lists... +Building dependency tree... +Execute external solver... +The following NEW packages will be installed: + build-depends build-essential debhelper +0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Inst build-depends (1 stable [i386]) +Inst build-essential (1 stable [i386]) +Inst debhelper (7 stable [i386]) +Conf build-depends (1 stable [i386]) +Conf build-essential (1 stable [i386]) +Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./comments.dsc --solver apt -- cgit v1.2.3