summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/edsp/edspsystem.cc1
-rw-r--r--apt-private/private-source.cc15
-rw-r--r--debian/control3
-rwxr-xr-xtest/integration/test-apt-get-build-dep-file (renamed from test/integration/test-apt-get-build-dep)0
-rwxr-xr-xtest/integration/test-apt-get-source-arch3
-rwxr-xr-xtest/integration/test-apt-get-source-multisources3
-rwxr-xr-xtest/integration/test-apt-source-and-build-dep (renamed from test/integration/test-apt-get-source)86
-rwxr-xr-xtest/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum11
8 files changed, 69 insertions, 53 deletions
diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc
index 95abc1527..0d967863e 100644
--- a/apt-pkg/edsp/edspsystem.cc
+++ b/apt-pkg/edsp/edspsystem.cc
@@ -20,6 +20,7 @@
#include <apt-pkg/fileutl.h>
#include <stddef.h>
+#include <stdlib.h>
#include <unistd.h>
#include <string>
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc
index c45af6651..7126feb78 100644
--- a/apt-private/private-source.cc
+++ b/apt-private/private-source.cc
@@ -152,12 +152,12 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
// pick highest version for the arch unless the user wants
// something else
if (ArchTag != "" && VerTag == "" && RelTag == "")
- if(Cache->VS().CmpVersion(VerTag, Ver.VerStr()) < 0)
+ if(Cache.GetPkgCache()->VS->CmpVersion(VerTag, Ver.VerStr()) < 0)
VerTag = Ver.VerStr();
// We match against a concrete version (or a part of this version)
if (VerTag.empty() == false &&
- (fuzzy == true || Cache->VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match
+ (fuzzy == true || Cache.GetPkgCache()->VS->CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match
(fuzzy == false || strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0)) // fuzzy match
continue;
@@ -275,11 +275,11 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
// Ignore all versions which doesn't fit
if (VerTag.empty() == false &&
- Cache->VS().CmpVersion(VerTag, Ver) != 0) // exact match
+ Cache.GetPkgCache()->VS->CmpVersion(VerTag, Ver) != 0) // exact match
continue;
// Newer version or an exact match? Save the hit
- if (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0) {
+ if (Last == 0 || Cache.GetPkgCache()->VS->CmpVersion(Version,Ver) < 0) {
Last = Parse;
Offset = Parse->Offset();
Version = Ver;
@@ -317,13 +317,10 @@ struct DscFile
};
bool DoSource(CommandLine &CmdL)
{
- CacheFile Cache;
- if (Cache.Open(false) == false)
- return false;
-
if (CmdL.FileSize() <= 1)
return _error->Error(_("Must specify at least one package to fetch source for"));
+ CacheFile Cache;
// Read the source list
if (Cache.BuildSourceList() == false)
return false;
@@ -514,7 +511,7 @@ bool DoSource(CommandLine &CmdL)
bool const fixBroken = _config->FindB("APT::Get::Fix-Broken", false);
for (unsigned I = 0; I != J; ++I)
{
- std::string Dir = Dsc[I].Package + '-' + Cache->VS().UpstreamVersion(Dsc[I].Version.c_str());
+ std::string Dir = Dsc[I].Package + '-' + Cache.GetPkgCache()->VS->UpstreamVersion(Dsc[I].Version.c_str());
// Diff only mode only fetches .diff files
if (_config->FindB("APT::Get::Diff-Only",false) == true ||
diff --git a/debian/control b/debian/control
index 9139c347f..54d5b5aaa 100644
--- a/debian/control
+++ b/debian/control
@@ -9,8 +9,7 @@ Build-Depends: dpkg-dev (>= 1.17.14), debhelper (>= 9.20141010), libdb-dev,
gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~),
zlib1g-dev, libbz2-dev, liblzma-dev, liblz4-dev (>= 0.0~r126),
xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2),
- autotools-dev, autoconf, automake, libgtest-dev <!nocheck>,
- g++ (>= 4:5.2)
+ autotools-dev, autoconf, automake, libgtest-dev <!nocheck>
Build-Depends-Indep: doxygen, w3m, graphviz
Build-Conflicts: autoconf2.13, automake1.4
Vcs-Git: git://anonscm.debian.org/apt/apt.git
diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep-file
index 2cd4f57ec..2cd4f57ec 100755
--- a/test/integration/test-apt-get-build-dep
+++ b/test/integration/test-apt-get-build-dep-file
diff --git a/test/integration/test-apt-get-source-arch b/test/integration/test-apt-get-source-arch
index 4958fda06..ca586f46a 100755
--- a/test/integration/test-apt-get-source-arch
+++ b/test/integration/test-apt-get-source-arch
@@ -26,8 +26,7 @@ setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
-HEADER="Reading package lists...
-Building dependency tree..."
+HEADER='Reading package lists...'
DOWNLOAD10="Need to get 0 B/25 B of source archives.
'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 11 SHA256:ed7c25c832596339bee13e4e7c45cf49f869b60d2bf57252f18191d75866c2a7
'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 14 SHA256:f3da8c6ebc62c8ef2dae439a498dddcdacc1a07f45ff67ad12f44b6e2353c239"
diff --git a/test/integration/test-apt-get-source-multisources b/test/integration/test-apt-get-source-multisources
index 136867ead..06fe19641 100755
--- a/test/integration/test-apt-get-source-multisources
+++ b/test/integration/test-apt-get-source-multisources
@@ -17,8 +17,7 @@ setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
-HEADER="Reading package lists...
-Building dependency tree..."
+HEADER='Reading package lists...'
testsuccessequal "$HEADER
Need to get 0 B/43 B of source archives.
'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 22 SHA256:19cc1abe85063976bf71c033f62f3e6bf6621647fe44a6ee31ed687e3fa5cbb7
diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-source-and-build-dep
index 4b5375d0c..5fa87d57d 100755
--- a/test/integration/test-apt-get-source
+++ b/test/integration/test-apt-source-and-build-dep
@@ -5,11 +5,11 @@ TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
# we need to insert a package into "unstable" so that a Release file is
# create for the test
-insertpackage 'wheezy' 'unreleated-package' 'all' '1.0'
+insertpackage 'wheezy' 'build-essential' 'all' '1.0'
# a "normal" package with source and binary
insertpackage 'unstable' 'foo' 'all' '2.0'
@@ -55,8 +55,7 @@ setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
# normal operation gets highest version number
-HEADER="Reading package lists...
-Building dependency tree..."
+HEADER='Reading package lists...'
DOWNLOAD1="Need to get 0 B/25 B of source archives.
'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 11 SHA256:ed7c25c832596339bee13e4e7c45cf49f869b60d2bf57252f18191d75866c2a7
'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 14 SHA256:f3da8c6ebc62c8ef2dae439a498dddcdacc1a07f45ff67ad12f44b6e2353c239"
@@ -70,41 +69,65 @@ DOWNLOAD4="Need to get 0 B/25 B of source archives.
'file://${APTARCHIVE}/baz_2.0.dsc' baz_2.0.dsc 11 SHA256:47d062d29070b3f592d1c8aed8c1e7913804bbb67ca1d64877c8219dac5e0420
'file://${APTARCHIVE}/baz_2.0.tar.gz' baz_2.0.tar.gz 14 SHA256:11c1b202c94a64ab6433d9f0ed5515fce1dc7b20e6bcf51cec9ef8b9455f5a41"
testsuccessequal "$HEADER
-$DOWNLOAD2" aptget source -q --print-uris foo
+$DOWNLOAD2" apt source -q --print-uris foo
testsuccessequal "$HEADER
-$DOWNLOAD2" aptget source -q --print-uris foo foo
+$DOWNLOAD2" apt source -q --print-uris foo foo
+getbuilddep() {
+ echo 'Reading package lists...'
+ if [ -n "$2" ]; then
+ echo "$2"
+ fi
+ echo "${1} has no build depends.
+Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ build-essential
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst build-essential (1.0 wheezy [all])
+Conf build-essential (1.0 wheezy [all])"
+}
+testsuccessequal "$(getbuilddep 'foo')" apt build-dep foo -s
# select by release: suite
testsuccessequal "$HEADER
Selected version '1.0' (stable) for foo
-$DOWNLOAD1" aptget source -q --print-uris foo/stable
+$DOWNLOAD1" apt source -q --print-uris foo/stable
+testsuccessequal "$(getbuilddep 'foo' "Selected version '1.0' (stable) for foo")" apt build-dep foo/stable -s
testsuccessequal "$HEADER
Selected version '2.0' (unstable) for foo
-$DOWNLOAD2" aptget source -q --print-uris foo/unstable
+$DOWNLOAD2" apt source -q --print-uris foo/unstable
+testsuccessequal "$(getbuilddep 'foo' "Selected version '2.0' (unstable) for foo")" apt build-dep foo/unstable -s
testsuccessequal "$HEADER
Selected version '1.0' (stable) for foo
-$DOWNLOAD1" aptget source -q --print-uris foo -t stable
+$DOWNLOAD1" apt source -q --print-uris foo -t stable
+testsuccessequal "$(getbuilddep 'foo' "Selected version '1.0' (stable) for foo")" apt build-dep foo -t stable -s
testsuccessequal "$HEADER
Selected version '2.0' (unstable) for foo
-$DOWNLOAD2" aptget source -q --print-uris foo -t unstable
+$DOWNLOAD2" apt source -q --print-uris foo -t unstable
+testsuccessequal "$(getbuilddep 'foo' "Selected version '2.0' (unstable) for foo")" apt build-dep foo -t unstable -s
testsuccessequal "$HEADER
Selected version '1.0' (stable) for baz
-$DOWNLOAD3" aptget source -q --print-uris baz -t stable
+$DOWNLOAD3" apt source -q --print-uris baz -t stable
+testsuccessequal "$(getbuilddep 'baz' "Selected version '1.0' (stable) for baz")" apt build-dep baz -t stable -s
# select by release: codename
testsuccessequal "$HEADER
Selected version '2.0' (sid) for foo
-$DOWNLOAD2" aptget source -q --print-uris foo/sid
+$DOWNLOAD2" apt source -q --print-uris foo/sid
+testsuccessequal "$(getbuilddep 'foo' "Selected version '2.0' (sid) for foo")" apt build-dep foo/sid -s
testsuccessequal "$HEADER
Selected version '2.0' (sid) for foo
-$DOWNLOAD2" aptget source -q --print-uris foo -t sid
+$DOWNLOAD2" apt source -q --print-uris foo -t sid
+testsuccessequal "$(getbuilddep 'foo' "Selected version '2.0' (sid) for foo")" apt build-dep foo -t sid -s
testsuccessequal "$HEADER
Selected version '2.0' (sid) for baz
-$DOWNLOAD4" aptget source -q --print-uris baz -t sid
+$DOWNLOAD4" apt source -q --print-uris baz -t sid
+testsuccessequal "$(getbuilddep 'baz' "Selected version '2.0' (sid) for baz")" apt build-dep baz -t sid -s
# select by version
testsuccessequal "$HEADER
-$DOWNLOAD1" aptget source -q --print-uris foo=1.0
+$DOWNLOAD1" apt source -q --print-uris foo=1.0
+testsuccessequal "$(getbuilddep 'foo')" apt build-dep foo=1.0 -s
# select by release with no binary package (Bug#731102) but ensure to get
# highest version
@@ -113,47 +136,56 @@ DOWNLOAD01="Need to get 0 B/25 B of source archives.
'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 14 SHA256:ec748ad88a71f98bfdc012e1a7632377d05fe3ebbf9c0922e0691fe4d79c0585"
testsuccessequal "$HEADER
Selected version '0.1' (wheezy) for foo
-$DOWNLOAD01" aptget source -q --print-uris foo/wheezy
+$DOWNLOAD01" apt source -q --print-uris foo/wheezy
+testsuccessequal "$(getbuilddep 'foo' "Selected version '0.1' (wheezy) for foo")" apt build-dep foo/wheezy -s
# unavailable one
testfailureequal "$HEADER
E: Can not find version '9.9-not-there' of package 'foo'
-E: Unable to find a source package for foo" aptget source -q --print-uris foo=9.9-not-there
+E: Unable to find a source package for foo" apt source -q --print-uris foo=9.9-not-there
+testfailureequal "Reading package lists...
+E: Can not find version '9.9-not-there' of package 'foo'
+E: Unable to find a source package for foo=9.9-not-there" apt build-dep -s foo=9.9-not-there
# version and release
DOWNLOAD001="Need to get 0 B/29 B of source archives.
'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 13 SHA256:649dfe03bbb70cebdfe7c6bf9036f9f2472510b8f52e823bdf5ade362ebaa76f
'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 16 SHA256:ab7ba789d178362ecc808e49705e2338988a7f5b9410ec11a6c9555c017de907"
testsuccessequal "$HEADER
-$DOWNLOAD001" aptget source -q --print-uris -t unstable foo=0.0.1
+$DOWNLOAD001" apt source -q --print-uris -t unstable foo=0.0.1
+testsuccessequal "$(getbuilddep 'foo')" apt build-dep foo=0.0.1 -s
testsuccessequal "$HEADER
Need to get 0 B/25 B of source archives.
-Fetch source foo" aptget source -q -s foo
+Fetch source foo" apt source -q -s foo
+testsuccessequal "$(getbuilddep 'foo')" apt build-dep foo -s
-testfailureequal 'Reading package lists...
-Building dependency tree...
-E: Must specify at least one package to fetch source for' aptget source
+testfailureequal 'E: Must specify at least one package to fetch source for' apt source
+testfailureequal 'E: Must specify at least one package to check builddeps for' apt build-dep
testsuccessequal "Reading package lists...
-Building dependency tree...
NOTICE: 'bar' packaging is maintained in the 'Git' version control system at:
git://anonscm.debian.org/bar/bar.git -b debian/experimental
Please use:
git clone git://anonscm.debian.org/bar/bar.git -b debian/experimental
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 0 B/25 B of source archives.
-Fetch source bar" aptget source bar -s
+Fetch source bar" apt source bar -s
+testsuccessequal "$(getbuilddep 'bar')" apt build-dep bar -s
testsuccessequal "$HEADER
Need to get 0 B/25 B of source archives.
-Fetch source bin" aptget source bin -s -q
+Fetch source bin" apt source bin -s -q
+testsuccessequal "$(getbuilddep 'bin')" apt build-dep bin -s
testsuccessequal "$HEADER
Selected version '3-2' (unstable) for bin
Need to get 0 B/25 B of source archives.
-Fetch source bin" aptget source bin/unstable -s -q
+Fetch source bin" apt source bin/unstable -s -q
+testsuccessequal "$(getbuilddep 'bin' "Selected version '3-2' (unstable) for bin")" apt build-dep bin/unstable -s
testsuccessequal "$HEADER
Picking 'bin-backport' as source package instead of 'bin'
Selected version '2-2' (stable) for bin-backport
Need to get 0 B/43 B of source archives.
-Fetch source bin-backport" aptget source bin/stable -s -q
+Fetch source bin-backport" apt source bin/stable -s -q
+testsuccessequal "$(getbuilddep 'bin-backport' "Picking 'bin-backport' as source package instead of 'bin'
+Selected version '2-2' (stable) for bin-backport")" apt build-dep bin/stable -s
diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum
index f030a03dc..015a803bc 100755
--- a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum
+++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum
@@ -156,7 +156,6 @@ cd downloaded
testok() {
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
testsuccessequal "Reading package lists...
-Building dependency tree...
Need to get 6 B of source archives.
Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [3 B]
Get:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) [3 B]
@@ -170,7 +169,6 @@ testkeep() {
echo -n 'dsc' > ${1}_1.0.dsc
echo -n 'tar' > ${1}_1.0.tar.gz
testsuccessequal "Reading package lists...
-Building dependency tree...
Skipping already downloaded file '${1}_1.0.dsc'
Skipping already downloaded file '${1}_1.0.tar.gz'
Need to get 0 B of source archives.
@@ -184,7 +182,6 @@ testnohash() {
#FIXME: Maybe we should fail in this case instead of skipping
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
testsuccessequal "Reading package lists...
-Building dependency tree...
Skipping download of file '${1}_1.0.dsc' as requested hashsum is not available for authentication
Skipping download of file '${1}_1.0.tar.gz' as requested hashsum is not available for authentication
Need to get 0 B of source archives.
@@ -196,7 +193,6 @@ Download complete and in download only mode" aptget source -d "$@"
testmismatch() {
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
testfailureequal "Reading package lists...
-Building dependency tree...
Need to get 6 B of source archives.
Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [3 B]
Err:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc)
@@ -215,7 +211,6 @@ E: Failed to fetch some archives." aptget source -d "$@"
if [ "$2" != '--allow-unauthenticated' ]; then
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
testsuccessequal "Reading package lists...
-Building dependency tree...
Skipping download of file '${1}_1.0.dsc' as requested hashsum is not available for authentication
Skipping download of file '${1}_1.0.tar.gz' as requested hashsum is not available for authentication
Need to get 0 B of source archives.
@@ -226,7 +221,6 @@ Download complete and in download only mode" aptget source -d "$@" -o Acquire::F
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
testsuccessequal "Reading package lists...
-Building dependency tree...
Need to get 6 B of source archives.
Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [3 B]
Get:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) [3 B]
@@ -252,7 +246,6 @@ testmismatch pkg-md5-bad --allow-unauthenticated
testok pkg-no-md5
testok pkg-no-md5 -o Acquire::ForceHash=SHA256
testsuccessequal "Reading package lists...
-Building dependency tree...
Skipping download of file 'pkg-no-md5_1.0.dsc' as requested hashsum is not available for authentication
Skipping download of file 'pkg-no-md5_1.0.tar.gz' as requested hashsum is not available for authentication
Need to get 0 B of source archives.
@@ -264,7 +257,6 @@ testfailure --nomsg test -e pkg-no-md5_1.0.dsc -a -e pkg-no-md5_1.0.tar.gz
# mostly pathologic as this shouldn't happen, but just to be sure
testok pkg-mixed-ok
testfailureequal "Reading package lists...
-Building dependency tree...
Need to get 6 B of source archives.
Get:1 http://localhost:${APTHTTPPORT} pkg-mixed-sha1-bad 1.0 (tar) [3 B]
Get:2 http://localhost:${APTHTTPPORT} pkg-mixed-sha1-bad 1.0 (dsc) [3 B]
@@ -276,7 +268,6 @@ E: Failed to fetch some archives." aptget source -d pkg-mixed-sha1-bad
msgtest 'Only tar file is downloaded as the dsc has hashsum mismatch' 'pkg-mixed-sha1-bad'
testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-bad_1.0.tar.gz
testfailureequal "Reading package lists...
-Building dependency tree...
Need to get 6 B of source archives.
Get:1 http://localhost:${APTHTTPPORT} pkg-mixed-sha2-bad 1.0 (tar) [3 B]
Err:1 http://localhost:${APTHTTPPORT} pkg-mixed-sha2-bad 1.0 (tar)
@@ -291,8 +282,6 @@ testsuccess --nomsg test -e pkg-mixed-sha2-bad_1.0.dsc -a ! -e pkg-mixed-sha2-ba
# it gets even more pathologic: multiple entries for one file, some even disagreeing!
testnohash pkg-md5-agree
testfailureequal 'Reading package lists...
-Building dependency tree...
E: Error parsing checksum in Files of source package pkg-md5-disagree' aptget source -d pkg-md5-disagree
testfailureequal 'Reading package lists...
-Building dependency tree...
E: Error parsing checksum in Checksums-SHA256 of source package pkg-sha256-disagree' aptget source -d pkg-sha256-disagree