summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-02-03 14:56:49 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2016-02-03 14:56:49 +0100
commitd603afd970e4bc84ed7176b988cd72bd9cf339b3 (patch)
tree8d09abf1955d7e5f0a8f68a4edb9ab8d1915c562
parentcd907113561d5eb75054f981be3bcc22eee8db27 (diff)
downloadapt-d603afd970e4bc84ed7176b988cd72bd9cf339b3.tar.gz
avoid building dependency tree in 'source' command
We don't need the dependencies for obvious reasons and we don't need the candidate version either, so building a pkgDepCache is wasted effort, which we can stop doing now that build-dep cleared the path.
-rw-r--r--apt-private/private-source.cc5
-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-dep8
-rwxr-xr-xtest/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum11
5 files changed, 5 insertions, 25 deletions
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc
index c2f5f5d3a..7126feb78 100644
--- a/apt-private/private-source.cc
+++ b/apt-private/private-source.cc
@@ -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;
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-source-and-build-dep b/test/integration/test-apt-source-and-build-dep
index a813cfe39..5fa87d57d 100755
--- a/test/integration/test-apt-source-and-build-dep
+++ b/test/integration/test-apt-source-and-build-dep
@@ -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"
@@ -161,13 +160,10 @@ Need to get 0 B/25 B of source archives.
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' apt 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:
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