]> git.saurik.com Git - apt.git/commitdiff
changelog: Respect Dir setting for local changelog getting
authorJulian Andres Klode <jak@debian.org>
Thu, 25 Aug 2016 12:24:49 +0000 (14:24 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 20:24:24 +0000 (22:24 +0200)
This fixes issues with chroots, but the goal here was to get
the test suite working on systems without dpkg.

apt-pkg/acquire-item.cc
test/integration/test-apt-get-changelog

index 7238d692edea5575f84f155a99dcfaf039315de9..f715e060ebe43bad680600dc3a4e3b08331a189e 100644 (file)
@@ -3488,7 +3488,8 @@ std::string pkgAcqChangelog::URI(pkgCache::VerIterator const &Ver)        /*{{{*/
       pkgCache::PkgIterator const Pkg = Ver.ParentPkg();
       if (Pkg->CurrentVer != 0 && Pkg.CurrentVer() == Ver)
       {
       pkgCache::PkgIterator const Pkg = Ver.ParentPkg();
       if (Pkg->CurrentVer != 0 && Pkg.CurrentVer() == Ver)
       {
-        std::string const basename = std::string("/usr/share/doc/") + Pkg.Name() + "/changelog";
+        std::string const root = _config->FindDir("Dir");
+        std::string const basename = root + std::string("usr/share/doc/") + Pkg.Name() + "/changelog";
         std::string const debianname = basename + ".Debian";
         if (FileExists(debianname))
            return "copy://" + debianname;
         std::string const debianname = basename + ".Debian";
         if (FileExists(debianname))
            return "copy://" + debianname;
index 0812db5007c0debc108b86a05c19ed07676b9ce2..ee7b3ef979346c4f460d2475fb2f01537b5200a2 100755 (executable)
@@ -122,13 +122,13 @@ testsuccess apt install dpkg -y
 # at this moment, we still have the Releasefile claim to be origin:ubuntu
 echo 'Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu "false";' >> rootdir/etc/apt/apt.conf.d/nooriginchangelogs
 testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris
 # at this moment, we still have the Releasefile claim to be origin:ubuntu
 echo 'Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu "false";' >> rootdir/etc/apt/apt.conf.d/nooriginchangelogs
 testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris
-testsuccessequal "'gzip:///usr/share/doc/dpkg/changelog.Debian.gz' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false
+testsuccessequal "'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/dpkg/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false
 testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=true
 testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=true
 testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=true
 testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=true
-testsuccessequal "'gzip:///usr/share/doc/dpkg/changelog.Debian.gz' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Debian=true
+testsuccessequal "'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/dpkg/changelog' dpkg.changelog" apt changelog dpkg --print-uris -o Acquire::Changelogs::AlwaysOnline=false -o Acquire::Changelogs::AlwaysOnline::Origin::Debian=true
 
 testsuccess apt changelog dpkg -d
 testfilestats 'dpkg.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
 head -n 3 dpkg.changelog > dpkg.change
 
 testsuccess apt changelog dpkg -d
 testfilestats 'dpkg.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
 head -n 3 dpkg.changelog > dpkg.change
-testfileequal 'dpkg.change' "$(apthelper cat-file '/usr/share/doc/dpkg/changelog.Debian.gz' | head -n 3)"
+testfileequal 'dpkg.change' "$(apthelper cat-file 'rootdir/usr/share/doc/dpkg/changelog' | head -n 3)"
 rm -f dpkg.change dpkg.changelog
 rm -f dpkg.change dpkg.changelog