]> git.saurik.com Git - apt.git/commitdiff
treat .ddeb files like .deb, especially for dpkg
authorDavid Kalnischkies <david@kalnischkies.de>
Thu, 25 Aug 2016 13:52:30 +0000 (15:52 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Thu, 25 Aug 2016 14:12:24 +0000 (16:12 +0200)
Ubuntu uses *.ddeb files for their debug packages, but the interface we
are using since f495992428a396e0f98886c9a761a804aa161c68 to talk to dpkg
isn't supporting *.ddeb files. This used to work previously as apt itself
isn't caring about the filenames at all and if they are explicitly
mentioned dpkg will accept all, too.

It might or might not be a good idea to patch dpkg, too, but regardless
of it happening, we don't want to couple us to closely to dpkg for this
minor feature but testing for this at runtime as it would delay shipping
the fix for the too long commandlines further.

It is also questionable if it is really a good idea to allow any file
extension to be used here (like .foobar in the testcase), but we used to
and we tend to avoid breaking existing usecases if we can help it.

As a bonus, this also allows the installation of ddeb files directly
from the commandline as you can with deb files already. We continue to
ignore udeb through as the user-mistake to useful ratio is too high.

LP: #1616909

apt-pkg/deb/dpkgpm.cc
apt-pkg/sourcelist.cc
test/integration/test-apt-get-install-deb

index a2c7770b3ab6e53b984114254b757e5b294a3947..9c871d477616406220852a9531084249e80578d5 100644 (file)
@@ -1681,7 +1681,9 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
            {
               if (I->File[0] != '/')
                  return _error->Error("Internal Error, Pathname to install is not absolute '%s'",I->File.c_str());
-              auto const file = flNotDir(I->File);
+              auto file = flNotDir(I->File);
+              if (flExtension(file) != "deb")
+                 file.append(".deb");
               std::string linkpath;
               if (dpkg_recursive_install_numbered)
                  strprintf(linkpath, "%s/%.*lu-%s", tmpdir_to_free, p, n, file.c_str());
index cfd824978665686b7ad7c896e03db683bf4ee484..0da6878959f9cd6248761822dbc0b945764ab78d 100644 (file)
@@ -568,7 +568,8 @@ bool pkgSourceList::AddVolatileFile(std::string const &File, std::vector<std::st
       return false;
 
    std::string const ext = flExtension(File);
-   if (ext == "deb")
+   // udeb is not included as installing it is usually a mistake rather than intended
+   if (ext == "deb" || ext == "ddeb")
       AddVolatileFile(new debDebPkgFileIndex(File));
    else if (ext == "dsc")
       AddVolatileFile(new debDscFileIndex(File));
index 5f2877dfd17b69794ee8081165a96600d04fd4d1..7baaf0ee5c86f9ac13f0edbd2232ee7a293bd31d 100755 (executable)
@@ -168,3 +168,29 @@ testsuccess apt show --with-source ./Packages pkg-as-it-should-be
 testequal 'Package: pkg-as-it-should-be' head -n1 rootdir/tmp/testsuccess.output
 testsuccess apt install -y --with-source ./Packages pkg-as-it-should-be
 testdpkginstalled 'pkg-as-it-should-be'
+rm -f ./Packages
+
+echo 'dpkg::install::recursive "true";
+dpkg::install::recursive::force "true";
+dpkg::install::recursive::minimum "0";' > rootdir/etc/apt/apt.conf.d/lowerminimum.conf
+mv ./incoming/pkg-as-it-should-be_0_all.deb ./incoming/pkg-as-it-should-be_0_all.ddeb
+testsuccess aptget install -y ./incoming/pkg-as-it-should-be_0_all.ddeb --reinstall
+testfailure grep 'is already the newest version' rootdir/tmp/testsuccess.output
+testsuccess apt purge -y pkg-as-it-should-be
+testdpkgnotinstalled 'pkg-as-it-should-be'
+
+mv ./incoming/pkg-as-it-should-be_0_all.ddeb ./incoming/pkg-as-it-should-be_0_all.foobar
+echo "Package: pkg-as-it-should-be
+Architecture: all
+Version: 0
+Installed-Size: 2903
+Filename: incoming/pkg-as-it-should-be_0_all.foobar
+Size: $(stat -c %s incoming/pkg-as-it-should-be_0_all.foobar)
+SHA256: $(sha256sum incoming/pkg-as-it-should-be_0_all.foobar | cut -d' ' -f 1)
+" | gzip > Packages.gz
+testsuccess apt install --with-source ./Packages.gz pkg-as-it-should-be -s
+testsuccess apt install --with-source ./Packages.gz pkg-as-it-should-be --print-uris
+testsuccess apt show --with-source ./Packages.gz pkg-as-it-should-be
+testequal 'Package: pkg-as-it-should-be' head -n1 rootdir/tmp/testsuccess.output
+testsuccess apt install -y --with-source ./Packages.gz pkg-as-it-should-be
+testdpkginstalled 'pkg-as-it-should-be'