From 5cf733e18af40fbed978ec84e60ccd0ffc1871d8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 3 Feb 2011 22:48:37 +0100 Subject: remove duplicated config-option setting and rename testdpkgnotinstalled --- test/integration/framework | 7 +++---- test/integration/test-autoremove | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index fe1db14bc..e79d312ca 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -137,7 +137,6 @@ setupenvironment() { echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf echo "Dir::Bin::Methods \"${BUILDDIRECTORY}/methods\";" >> aptconfig.conf echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf - echo "Dir::Bin::methods \"${BUILDDIRECTORY}/methods\";" >> aptconfig.conf echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf @@ -634,9 +633,9 @@ testdpkginstalled() { msgpass } -testdpkgnoninstalled() { - msgtest "Test for correctly non-installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^u]' | wc -l)" +testdpkgnotinstalled() { + msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" + local PKGS="$(dpkg -l $* 2> /dev/null | grep '^[a-z]' | grep '^[^u]' | wc -l)" if [ "$PKGS" != 0 ]; then echo dpkg -l $* | grep '^[a-z]' diff --git a/test/integration/test-autoremove b/test/integration/test-autoremove index 1ca325b29..f1ce4e9e7 100755 --- a/test/integration/test-autoremove +++ b/test/integration/test-autoremove @@ -19,7 +19,7 @@ Architecture: i386 Auto-Installed: 1 ' aptget remove debhelper -y -qq 2>&1 > /dev/null -testdpkgnoninstalled 'debhelper' +testdpkgnotinstalled 'debhelper' testdpkginstalled 'po-debconf unrelated' echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove @@ -42,7 +42,7 @@ testdpkginstalled "po-debconf" rm rootdir/etc/apt/apt.conf.d/00autoremove aptget autoremove -y -qq 2>&1 > /dev/null -testdpkgnoninstalled 'po-debconf' +testdpkgnotinstalled 'po-debconf' testfileequal 'rootdir/var/lib/apt/extended_states' '' -- cgit v1.2.3 From 87bc1c45de94da47587d8e0314e9087f33a2b89e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 3 Feb 2011 23:25:41 +0100 Subject: check that the right amount of packages is installed if multiple passed in --- test/integration/framework | 6 +++--- test/integration/test-autoremove | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index e79d312ca..3aa80db23 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -623,8 +623,8 @@ testnopackage() { testdpkginstalled() { msgtest "Test for correctly installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^i]' | wc -l)" - if [ "$PKGS" != 0 ]; then + local PKGS="$(dpkg -l $* | grep '^i' | wc -l)" + if [ "$PKGS" != $# ]; then echo $PKGS dpkg -l $* | grep '^[a-z]' msgfail @@ -635,7 +635,7 @@ testdpkginstalled() { testdpkgnotinstalled() { msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" - local PKGS="$(dpkg -l $* 2> /dev/null | grep '^[a-z]' | grep '^[^u]' | wc -l)" + local PKGS="$(dpkg -l $* 2> /dev/null | grep '^i' | wc -l)" if [ "$PKGS" != 0 ]; then echo dpkg -l $* | grep '^[a-z]' diff --git a/test/integration/test-autoremove b/test/integration/test-autoremove index f1ce4e9e7..9dfab19f5 100755 --- a/test/integration/test-autoremove +++ b/test/integration/test-autoremove @@ -20,7 +20,7 @@ Auto-Installed: 1 ' aptget remove debhelper -y -qq 2>&1 > /dev/null testdpkgnotinstalled 'debhelper' -testdpkginstalled 'po-debconf unrelated' +testdpkginstalled 'po-debconf' 'unrelated' echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove testequal 'Reading package lists... -- cgit v1.2.3 From eb76e936982bd65ebd6a147c1c23ef2613891367 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 3 Feb 2011 23:25:53 +0100 Subject: test various situation with and without autobit setting --- test/integration/test-bug-611729-mark-as-manual | 105 ++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 test/integration/test-bug-611729-mark-as-manual diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual new file mode 100755 index 000000000..9c1cd3d1b --- /dev/null +++ b/test/integration/test-bug-611729-mark-as-manual @@ -0,0 +1,105 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage "peace-dpkg" "all" "1.0" "stable" + +buildsimplenativepackage "a" "all" "1.0" "stable" "Depends: b" +buildsimplenativepackage "b" "all" "1.0" "stable" +buildsimplenativepackage "c" "all" "1.0" "stable" "Depends: b" + +setupaptarchive + +# dpkg freaks out if the last package is removed so keep one around +aptget install peace-dpkg -y -qq 2>&1 > /dev/null +testdpkginstalled peace-dpkg +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install a -y -qq 2>&1 > /dev/null +testdpkginstalled a b +testdpkgnotinstalled c +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +aptget remove a -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a c +testdpkginstalled b +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +aptget install c -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a +testdpkginstalled b c +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +b is already the newest version. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b --only-upgrade +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +b is already the newest version. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b -d +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +aptget install b --reinstall -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a +testdpkginstalled b c +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 1 +' + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +b is already the newest version. +b set to manually installed. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b +Architecture: i386 +Auto-Installed: 0 +' + +aptget remove b -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install a b -y -qq 2>&1 > /dev/null +testdpkginstalled a b +testdpkgnotinstalled c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget purge a b -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install b c -y -qq 2>&1 > /dev/null +testdpkgnotinstalled a +testdpkginstalled b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +aptget install a -y -qq 2>&1 > /dev/null +testdpkginstalled a b c +testfileequal 'rootdir/var/lib/apt/extended_states' '' -- cgit v1.2.3 From 7fefa1842da668283785113ae174df34f97f6df5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 4 Feb 2011 22:56:51 +0100 Subject: * cmdline/apt-cache.cc: - remove not implemented 'apt-cache add' command * doc/apt-cache.8.xml: - describe reality as apt-cache just queries and doesn't manipulate the caches. Thanks to Enrico Zini for spotting it! (Closes: #612009) --- cmdline/apt-cache.cc | 59 ++-------------------------------------------------- debian/changelog | 7 ++++++- doc/apt-cache.8.xml | 10 ++------- 3 files changed, 10 insertions(+), 66 deletions(-) diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 45ea50433..34070ba9b 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1116,58 +1116,6 @@ bool Dotty(CommandLine &CmdL) printf("}\n"); return true; -} - /*}}}*/ -// DoAdd - Perform an adding operation /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool DoAdd(CommandLine &CmdL) -{ - return _error->Error("Unimplemented"); -#if 0 - // Make sure there is at least one argument - if (CmdL.FileSize() <= 1) - return _error->Error("You must give at least one file name"); - - // Open the cache - FileFd CacheF(_config->FindFile("Dir::Cache::pkgcache"),FileFd::WriteAny); - if (_error->PendingError() == true) - return false; - - DynamicMMap Map(CacheF,MMap::Public); - if (_error->PendingError() == true) - return false; - - OpTextProgress Progress(*_config); - pkgCacheGenerator Gen(Map,Progress); - if (_error->PendingError() == true) - return false; - - unsigned long Length = CmdL.FileSize() - 1; - for (const char **I = CmdL.FileList + 1; *I != 0; I++) - { - Progress.OverallProgress(I - CmdL.FileList,Length,1,"Generating cache"); - Progress.SubProgress(Length); - - // Do the merge - FileFd TagF(*I,FileFd::ReadOnly); - debListParser Parser(TagF); - if (_error->PendingError() == true) - return _error->Error("Problem opening %s",*I); - - if (Gen.SelectFile(*I,"") == false) - return _error->Error("Problem with SelectFile"); - - if (Gen.MergeList(Parser) == false) - return _error->Error("Problem with MergeList"); - } - - Progress.Done(); - GCache = &Gen.GetCache(); - Stats(CmdL); - - return true; -#endif } /*}}}*/ // DisplayRecord - Displays the complete record for the package /*{{{*/ @@ -1743,15 +1691,13 @@ bool ShowHelp(CommandLine &Cmd) cout << _("Usage: apt-cache [options] command\n" - " apt-cache [options] add file1 [file2 ...]\n" " apt-cache [options] showpkg pkg1 [pkg2 ...]\n" " apt-cache [options] showsrc pkg1 [pkg2 ...]\n" "\n" - "apt-cache is a low-level tool used to manipulate APT's binary\n" - "cache files, and query information from them\n" + "apt-cache is a low-level tool used to query information\n" + "from APT's binary cache files\n" "\n" "Commands:\n" - " add - Add a package file to the source cache\n" " gencaches - Build both the package and source cache\n" " showpkg - Show some general information for a single package\n" " showsrc - Show source records\n" @@ -1811,7 +1757,6 @@ int main(int argc,const char *argv[]) /*{{{*/ {0,"enhances","APT::Cache::ShowEnhances",0}, {0,0,0,0}}; CommandLine::Dispatch CmdsA[] = {{"help",&ShowHelp}, - {"add",&DoAdd}, {"gencaches",&GenCaches}, {"showsrc",&ShowSrcPackage}, {0,0}}; diff --git a/debian/changelog b/debian/changelog index 525654732..3f8f52101 100644 --- a/debian/changelog +++ b/debian/changelog @@ -70,6 +70,11 @@ apt (0.8.11) UNRELEASED; urgency=low - print a good error message if FileSize() is zero * apt-pkg/aptconfiguration.cc: - remove the inbuilt Translation files whitelist + * cmdline/apt-cache.cc: + - remove not implemented 'apt-cache add' command + * doc/apt-cache.8.xml: + - describe reality as apt-cache just queries and doesn't manipulate + the caches. Thanks to Enrico Zini for spotting it! (Closes: #612009) [ Michael Vogt ] * methods/http.cc: @@ -87,7 +92,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Fri, 28 Jan 2011 12:22:25 +0100 + -- David Kalnischkies Fri, 04 Feb 2011 22:52:25 +0100 apt (0.8.10.3) unstable; urgency=low diff --git a/doc/apt-cache.8.xml b/doc/apt-cache.8.xml index 359d210ea..9c6c64dac 100644 --- a/doc/apt-cache.8.xml +++ b/doc/apt-cache.8.xml @@ -18,7 +18,7 @@ &apt-email; &apt-product; - 29 February 2004 + 04 February 2011 @@ -30,7 +30,7 @@ apt-cache - APT package handling utility -- cache manipulator + query the APT cache @@ -41,7 +41,6 @@ - add file gencaches showpkg pkg showsrc pkg @@ -72,11 +71,6 @@ commands below must be present. - add file(s) - add adds the named package index files to the package cache. - This is for debugging only. - - gencaches gencaches performs the same operation as apt-get check. It builds the source and package caches from -- cgit v1.2.3 From fbd64f76a595b61d2aaa9c0615903d9b68786930 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:23:28 +0100 Subject: * apt-pkg/algorithms.cc: - mark pseudo packages of installed all packages as configured in the simulation as we don't call configure for these packages --- apt-pkg/algorithms.cc | 23 ++++++++++++++++++++++- debian/changelog | 5 ++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 0fbce3c2a..0d26f8f66 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -162,7 +162,28 @@ bool pkgSimulate::Configure(PkgIterator iPkg) } } -// Sim.MarkInstall(Pkg,false); + if (Sim[Pkg].InstBroken() == true) + { + /* We don't call Configure for Pseudo packages and if the 'all' is already installed + the simulation will think the pseudo package is not installed, so if something is + broken we walk over the dependencies and search for not installed pseudo packages */ + for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++) + { + if (Sim.IsImportantDep(D) == false || + (Sim[D] & pkgDepCache::DepInstall) != 0) + continue; + pkgCache::PkgIterator T = D.TargetPkg(); + if (T.end() == true || T->CurrentVer != 0 || Flags[T->ID] != 0) + continue; + pkgCache::PkgIterator A = T.Group().FindPkg("all"); + if (A.end() == true || A->VersionList == 0 || A->CurrentVer == 0 || + Cache.VS().CheckDep(A.CurVersion(), pkgCache::Dep::Equals, T.CandVersion()) == false) + continue; + Sim.MarkInstall(T, false); + Flags[T->ID] = 2; + } + } + if (Sim[Pkg].InstBroken() == true) { cout << "Conf " << Pkg.FullName(false) << " broken" << endl; diff --git a/debian/changelog b/debian/changelog index 3f8f52101..29d310871 100644 --- a/debian/changelog +++ b/debian/changelog @@ -75,6 +75,9 @@ apt (0.8.11) UNRELEASED; urgency=low * doc/apt-cache.8.xml: - describe reality as apt-cache just queries and doesn't manipulate the caches. Thanks to Enrico Zini for spotting it! (Closes: #612009) + * apt-pkg/algorithms.cc: + - mark pseudo packages of installed all packages as configured + in the simulation as we don't call configure for these packages [ Michael Vogt ] * methods/http.cc: @@ -92,7 +95,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Fri, 04 Feb 2011 22:52:25 +0100 + -- David Kalnischkies Mon, 07 Feb 2011 11:21:12 +0100 apt (0.8.10.3) unstable; urgency=low -- cgit v1.2.3 From 6a910c9db4d450241a57f61b2d3d3e302bb9c11c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:32:55 +0100 Subject: allow conflicts in the same group again (Closes: #612099) --- apt-pkg/depcache.cc | 2 +- debian/changelog | 3 +- test/integration/framework | 2 +- .../test-bug-612099-multiarch-conflicts | 209 +++++++++++++++++++++ 4 files changed, 213 insertions(+), 3 deletions(-) create mode 100755 test/integration/test-bug-612099-multiarch-conflicts diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 5f59b6d49..7c09d3a38 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -339,7 +339,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res) /* Check simple depends. A depends -should- never self match but we allow it anyhow because dpkg does. Technically it is a packaging bug. Conflicts may never self match */ - if (Dep.TargetPkg()->Group != Dep.ParentPkg()->Group || + if (Dep.TargetPkg() != Dep.ParentPkg() || (Dep->Type != Dep::Conflicts && Dep->Type != Dep::DpkgBreaks && Dep->Type != Dep::Obsoletes)) { PkgIterator Pkg = Dep.TargetPkg(); diff --git a/debian/changelog b/debian/changelog index 29d310871..7fb6557e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ apt (0.8.11) UNRELEASED; urgency=low - add SetCandidateRelease() to set a candidate version and the candidates of dependencies if needed to a specified release (Closes: #572709) + - allow conflicts in the same group again (Closes: #612099) * cmdline/apt-get.cc: - if --print-uris is used don't setup downloader as we don't need progress, lock nor the directories it would create otherwise @@ -95,7 +96,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Mon, 07 Feb 2011 11:21:12 +0100 + -- David Kalnischkies Mon, 07 Feb 2011 11:26:03 +0100 apt (0.8.10.3) unstable; urgency=low diff --git a/test/integration/framework b/test/integration/framework index 3aa80db23..d91599f1b 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -267,7 +267,7 @@ Package: $NAME" > ${BUILDDIR}/debian/control (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$ARCH) (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) - dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. > /dev/null + dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null echo "pool/${NAME}_${VERSION}_${ARCH}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist for SRC in $SRCS; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts new file mode 100755 index 000000000..caac75db4 --- /dev/null +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -0,0 +1,209 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" "amd64" + +buildsimplenativepackage 'peace-dpkg' 'all' '1.0' 'stable' + +buildsimplenativepackage 'libc6' 'i386' '1.0' 'stable' +buildsimplenativepackage 'libc6' 'amd64' '1.0' 'stable' +buildsimplenativepackage 'libc6' 'all' '2.0' 'testing' + +buildsimplenativepackage 'foobar' 'i386' '1.0' 'stable' 'Depends: libc6' +buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6' + +setupaptarchive + +aptget install peace-dpkg:i386 -y -qq 2>&1 > /dev/null +testdpkginstalled peace-dpkg + +aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null +testdpkginstalled libc6 +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + libc6 +The following NEW packages will be installed: + libc6:amd64 +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libc6 [1.0] +Inst libc6:amd64 (1.0 stable [amd64]) +Conf libc6:amd64 (1.0 stable [amd64])' aptget install libc6:amd64 -s -t stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar (1.0 stable [i386]) +Conf foobar (1.0 stable [i386])' aptget install foobar -st stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libc6:amd64 +The following packages will be REMOVED: + libc6 +The following NEW packages will be installed: + foobar:amd64 libc6:amd64 +0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv libc6 [1.0] +Inst libc6:amd64 (1.0 stable [amd64]) +Inst foobar:amd64 (1.0 stable [amd64]) +Conf libc6:amd64 (1.0 stable [amd64]) +Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64 -st stable + +# FIXME: libc6:i386 is installed, we are switching to libc6:all +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libc6 +The following NEW packages will be installed: + foobar libc6 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (2.0 testing, testing [all]) +Inst foobar (1.0 stable [i386]) +Conf libc6 (2.0 testing, testing [all]) +Conf foobar (1.0 stable [i386])' aptget install foobar/stable libc6 -st testing + +# FIXME: libc6:i386 is installed, we are switching to libc6:all +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + libc6 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (2.0 testing, testing [all]) +Conf libc6 (2.0 testing, testing [all])' aptget upgrade -t testing -s +aptget upgrade -y -qq 2>&1 > /dev/null +testdpkginstalled libc6 + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar (1.0 stable [i386]) [] +Conf foobar (1.0 stable [i386])' aptget install foobar/stable -st testing + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar:amd64 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar:amd64 (1.0 stable [amd64]) +Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64/stable -st testing + + +# FIXME: the display is a strange (its a downgrade), but the handling itself correct +testequal "Reading package lists... +Building dependency tree... +Reading state information... +Selected version '1.0' (stable [i386]) for 'libc6' +The following packages will be REMOVED: + libc6 +The following NEW packages will be installed: + libc6 +0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +Remv libc6 [2.0] +Inst libc6 (1.0 stable [i386]) +Conf libc6 (1.0 stable [i386])" aptget install libc6/stable -s -q=0 + + +buildsimplenativepackage 'libc6-same' 'i386' '1.0' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libc6-same' 'amd64' '1.0' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libc6-same' 'all' '2.0' 'testing' + +buildsimplenativepackage 'foobar-same' 'i386' '1.0' 'stable' 'Depends: libc6-same' +buildsimplenativepackage 'foobar-same' 'amd64' '1.0' 'stable' 'Depends: libc6-same' + +setupaptarchive + +aptget install libc6-same:i386 -t stable -y -qq 2>&1 > /dev/null +testdpkginstalled libc6-same + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar-same +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-same (1.0 stable [i386]) +Conf foobar-same (1.0 stable [i386])' aptget install foobar-same -st stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libc6-same:amd64 +The following NEW packages will be installed: + foobar-same:amd64 libc6-same:amd64 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6-same:amd64 (1.0 stable [amd64]) +Inst foobar-same:amd64 (1.0 stable [amd64]) +Conf libc6-same:amd64 (1.0 stable [amd64]) +Conf foobar-same:amd64 (1.0 stable [amd64])' aptget install foobar-same:amd64 -st stable + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + libc6-same:amd64 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libc6-same:amd64 (1.0 stable [amd64]) +Conf libc6-same:amd64 (1.0 stable [amd64])' aptget install libc6-same:amd64 -s -t stable + +# FIXME: We should test installing libc6-same:amd64 here, but dpkg doesn't allow it currently + +# FIXME: upgrade any to all as above +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + libc6-same +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libc6-same (2.0 testing, testing [all]) +Conf libc6-same (2.0 testing, testing [all])' aptget upgrade -t testing -s +aptget upgrade -y -qq 2>&1 > /dev/null +testdpkginstalled libc6-same + +# FIXME: the display is a strange (its a downgrade), but the handling itself correct +testequal "Reading package lists... +Building dependency tree... +Reading state information... +Selected version '1.0' (stable [i386]) for 'libc6-same' +The following packages will be REMOVED: + libc6-same +The following NEW packages will be installed: + libc6-same +0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +Remv libc6-same [2.0] +Inst libc6-same (1.0 stable [i386]) +Conf libc6-same (1.0 stable [i386])" aptget install libc6-same/stable -s -q=0 + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar-same +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-same (1.0 stable [i386]) [] +Conf foobar-same (1.0 stable [i386])' aptget install foobar-same/stable -st testing + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following NEW packages will be installed: + foobar-same:amd64 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foobar-same:amd64 (1.0 stable [amd64]) +Conf foobar-same:amd64 (1.0 stable [amd64])' aptget install foobar-same:amd64/stable -st testing -- cgit v1.2.3 From a1ac2ca85ae4d7c8b3ab3c4e2f3ba6c26202c363 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:45:06 +0100 Subject: * apt-pkg/pkgcachegen.cc: - in multiarch, let :all packages conflict with :any packages with a different version to be sure --- apt-pkg/pkgcachegen.cc | 18 +++++++++++------- debian/changelog | 5 ++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index ed35174bb..5b943cca1 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -638,21 +638,19 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) Dynamic DynP(P); for (; P.end() != true; P = G.NextPkg(P)) { - if (strcmp(P.Arch(),"all") == 0) - continue; pkgCache::PkgIterator allPkg; Dynamic DynallPkg(allPkg); pkgCache::VerIterator V = P.VersionList(); Dynamic DynV(V); for (; V.end() != true; V++) { - string const Arch = V.Arch(true); + char const * const Arch = P.Arch(); map_ptrloc *OldDepLast = NULL; /* MultiArch handling introduces a lot of implicit Dependencies: - MultiArch: same → Co-Installable if they have the same version - Architecture: all → Need to be Co-Installable for internal reasons - All others conflict with all other group members */ - bool const coInstall = (V->MultiArch == pkgCache::Version::All || + bool const coInstall = ((V->MultiArch == pkgCache::Version::All && strcmp(Arch, "all") != 0) || V->MultiArch == pkgCache::Version::Same); if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true) allPkg = G.FindPkg("all"); @@ -686,9 +684,15 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) } } else { // Conflicts: ${self}:other - NewDepends(D, V, "", - pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, - OldDepLast); + if (strcmp(Arch, "all") == 0) { + NewDepends(D, V, V.VerStr(), + pkgCache::Dep::NotEquals, pkgCache::Dep::Conflicts, + OldDepLast); + } else { + NewDepends(D, V, "", + pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, + OldDepLast); + } } } } diff --git a/debian/changelog b/debian/changelog index 7fb6557e9..ecaca2a9b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -79,6 +79,9 @@ apt (0.8.11) UNRELEASED; urgency=low * apt-pkg/algorithms.cc: - mark pseudo packages of installed all packages as configured in the simulation as we don't call configure for these packages + * apt-pkg/pkgcachegen.cc: + - in multiarch, let :all packages conflict with :any packages + with a different version to be sure [ Michael Vogt ] * methods/http.cc: @@ -96,7 +99,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Mon, 07 Feb 2011 11:26:03 +0100 + -- David Kalnischkies Mon, 07 Feb 2011 11:42:41 +0100 apt (0.8.10.3) unstable; urgency=low -- cgit v1.2.3 From bea417121247afe00cdd4ba13215544d5b5d3262 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 13:08:43 +0100 Subject: always do removes first and set not installed remove packages on hold to prevent temporary installation later (Closes: #549968) --- cmdline/apt-get.cc | 13 +++++------ debian/changelog | 4 +++- ...est-bug-549968-install-depends-of-not-installed | 26 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-) create mode 100755 test/integration/test-bug-549968-install-depends-of-not-installed diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index e93d12c2b..a6377f9f1 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -895,7 +895,11 @@ struct TryToRemove { if ((Pkg->CurrentVer == 0 && PurgePkgs == false) || (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled)) + { ioprintf(c1out,_("Package %s is not installed, so not removed\n"),Pkg.FullName(true).c_str()); + // MarkInstall refuses to install packages on hold + Pkg->SelectedState = pkgCache::State::Hold; + } else Cache->GetDepCache()->MarkDelete(Pkg, PurgePkgs); } @@ -1790,14 +1794,7 @@ bool DoInstall(CommandLine &CmdL) return false; } - unsigned short order[] = { 0, 0, 0 }; - if (fallback == MOD_INSTALL) { - order[0] = MOD_INSTALL; - order[1] = MOD_REMOVE; - } else { - order[0] = MOD_REMOVE; - order[1] = MOD_INSTALL; - } + unsigned short const order[] = { MOD_REMOVE, MOD_INSTALL, 0 }; TryToInstall InstallAction(Cache, Fix, BrokenFix); TryToRemove RemoveAction(Cache, Fix); diff --git a/debian/changelog b/debian/changelog index ecaca2a9b..3adb9d76f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ apt (0.8.11) UNRELEASED; urgency=low so installing packages from experimental or backports is easier - really do not show packages in the extra section if they were requested on the commandline, e.g. with a modifier (Closes: #184730) + - always do removes first and set not installed remove packages + on hold to prevent temporary installation later (Closes: #549968) * debian/control: - add Vcs-Browser now that loggerhead works again (Closes: #511168) - depend on debhelper 7 to raise compat level @@ -99,7 +101,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Mon, 07 Feb 2011 11:42:41 +0100 + -- David Kalnischkies Mon, 07 Feb 2011 13:06:50 +0100 apt (0.8.10.3) unstable; urgency=low diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed new file mode 100755 index 000000000..864dd340a --- /dev/null +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'libc6' 'all' '1.0' +insertpackage 'unstable' 'coolstuff' 'all' '1.0' 'Recommends: extracoolstuff' +insertpackage 'unstable' 'extracoolstuff' 'all' '1.0' 'Depends: libc6' + +setupaptarchive + +# We check the Markers here as the autoremove nuker will also +# prevent it, but to late - its better to fail earlier +testequal 'Reading package lists... +Building dependency tree... + MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 + Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) FU=0 +Package extracoolstuff is not installed, so not removed +The following NEW packages will be installed: + coolstuff +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst coolstuff (1.0 unstable [all]) +Conf coolstuff (1.0 unstable [all])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s -- cgit v1.2.3 From 1384504286b7923a85d6235ba6f8e2eb4766d967 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 14:38:01 +0100 Subject: test changelogs locally instead of depending on an online service --- test/integration/framework | 3 +++ test/integration/test-changelog | 34 +++++++++++++--------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index d91599f1b..e10709079 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -272,6 +272,9 @@ Package: $NAME" > ${BUILDDIR}/debian/control for SRC in $SRCS; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist done + mkdir -p ${BUILDDIR}/../${NAME}_${VERSION} + cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/ + cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog rm -rf "${BUILDDIR}" msgdone "info" } diff --git a/test/integration/test-changelog b/test/integration/test-changelog index 292df6e32..f05279356 100755 --- a/test/integration/test-changelog +++ b/test/integration/test-changelog @@ -7,28 +7,20 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -# this will be valid until ubuntu lucid is EOL (04/2015) -pkgchangelogtest="Package: apt -Architecture: i386 -Version: 0.7.25.3ubuntu7 -Filename: pool/main/a/apt/apt_0.7.25.3ubuntu7_i386.deb -Section: admin -" -cat <<-EOF >aptarchive/Packages -$pkgchangelogtest -EOF +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' setupaptarchive +changetowebserver +aptget update -qq -echo "Apt::Changelogs::Server \"http://changelogs.ubuntu.com/\";" >> ./aptconfig.conf -msgnmsg "apt-get changelog: " -aptget changelog apt -qq > downloaded-changelog -expected="apt (0.7.25.3ubuntu7) lucid; urgency=low" -got="$(head -n1 downloaded-changelog)" -if [ -s downloaded-changelog ] && [ "$got" = "$expected" ]; then - msgpass -else - msgfail - msgwarn "$got != $expected" -fi +echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf +aptget changelog apt -qq > apt.changelog +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" +rm aptarchive/pool/apt_1.0/changelog + +aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' > apt.changelog +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" +rm aptarchive/pool/apt_1.0.changelog + +testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' -- cgit v1.2.3 From fcb144b91a91ef9b6016ede0be05e07dacc8aaf9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 14:55:11 +0100 Subject: implement --print-uris support for changelog command --- cmdline/apt-get.cc | 21 +++++++++++++++++---- test/integration/test-changelog | 2 ++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index a6377f9f1..99c0e5d66 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2876,6 +2876,7 @@ bool GuessThirdPartyChangelogUri(CacheFile &Cache, // now strip away the filename and add srcpkg_srcver.changelog return true; } + /*}}}*/ // DownloadChangelog - Download the changelog /*{{{*/ // --------------------------------------------------------------------- bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, @@ -2900,13 +2901,19 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, "http://packages.debian.org/changelogs"); path = GetChangelogPath(CacheFile, Pkg, Ver); strprintf(changelog_uri, "%s/%s/changelog", server.c_str(), path.c_str()); + if (_config->FindB("APT::Get::Print-URIs", false) == true) + { + std::cout << '\'' << changelog_uri << '\'' << std::endl; + return true; + } + strprintf(descr, _("Changelog for %s (%s)"), Pkg.Name(), changelog_uri.c_str()); // queue it new pkgAcqFile(&Fetcher, changelog_uri, "", 0, descr, Pkg.Name(), "ignored", targetfile); - // try downloading it, if that fails, they third-party-changelogs location - // FIXME: res is "Continue" even if I get a 404?!? - int res = Fetcher.Run(); + // try downloading it, if that fails, try third-party-changelogs location + // FIXME: Fetcher.Run() is "Continue" even if I get a 404?!? + Fetcher.Run(); if (!FileExists(targetfile)) { string third_party_uri; @@ -2914,7 +2921,7 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, { strprintf(descr, _("Changelog for %s (%s)"), Pkg.Name(), third_party_uri.c_str()); new pkgAcqFile(&Fetcher, third_party_uri, "", 0, descr, Pkg.Name(), "ignored", targetfile); - res = Fetcher.Run(); + Fetcher.Run(); } } @@ -2955,6 +2962,12 @@ bool DoChangelog(CommandLine &CmdL) APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); pkgAcquire Fetcher; + + if (_config->FindB("APT::Get::Print-URIs", false) == true) + for (APT::VersionSet::const_iterator Ver = verset.begin(); + Ver != verset.end(); ++Ver) + return DownloadChangelog(Cache, Fetcher, Ver, ""); + AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); Fetcher.Setup(&Stat); diff --git a/test/integration/test-changelog b/test/integration/test-changelog index f05279356..b5c204a53 100755 --- a/test/integration/test-changelog +++ b/test/integration/test-changelog @@ -15,6 +15,8 @@ aptget update -qq echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf +testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris + aptget changelog apt -qq > apt.changelog testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" rm aptarchive/pool/apt_1.0/changelog -- cgit v1.2.3 From 72dd5bec06d8d50ff9e8022e36a7d8a6f0cfd7a0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 17:30:06 +0100 Subject: implement download-only for changelog command which downloads the changelog to the file $PKGNAME.changelog in the current directory --- cmdline/apt-get.cc | 41 +++++++++++++++++++++++++++++------------ test/integration/test-changelog | 12 ++++++++++-- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 99c0e5d66..93f167f19 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2961,6 +2961,8 @@ bool DoChangelog(CommandLine &CmdL) APT::CacheSetHelper helper(c0out); APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); + if (verset.empty() == true) + return false; pkgAcquire Fetcher; if (_config->FindB("APT::Get::Print-URIs", false) == true) @@ -2971,26 +2973,41 @@ bool DoChangelog(CommandLine &CmdL) AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); Fetcher.Setup(&Stat); - if (verset.empty() == true) - return false; - char *tmpdir = mkdtemp(strdup("/tmp/apt-changelog-XXXXXX")); - if (tmpdir == NULL) { - return _error->Errno("mkdtemp", "mkdtemp failed"); + bool const downOnly = _config->FindB("APT::Get::Download-Only", false); + + char tmpname[100]; + char* tmpdir = NULL; + if (downOnly == false) + { + const char* const tmpDir = getenv("TMPDIR"); + if (tmpDir != NULL && *tmpDir != '\0') + snprintf(tmpname, sizeof(tmpname), "%s/apt-changelog-XXXXXX", tmpDir); + else + strncpy(tmpname, "/tmp/apt-changelog-XXXXXX", sizeof(tmpname)); + tmpdir = mkdtemp(tmpname); + if (tmpdir == NULL) + return _error->Errno("mkdtemp", "mkdtemp failed"); } - + for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver) { - string changelogfile = string(tmpdir) + "changelog"; - if (DownloadChangelog(Cache, Fetcher, Ver, changelogfile)) + string changelogfile; + if (downOnly == false) + changelogfile.append(tmpname).append("changelog"); + else + changelogfile.append(Ver.ParentPkg().Name()).append(".changelog"); + if (DownloadChangelog(Cache, Fetcher, Ver, changelogfile) && downOnly == false) + { DisplayFileInPager(changelogfile); - // cleanup temp file - unlink(changelogfile.c_str()); + // cleanup temp file + unlink(changelogfile.c_str()); + } } // clenaup tmp dir - rmdir(tmpdir); - free(tmpdir); + if (tmpdir != NULL) + rmdir(tmpdir); return true; } /*}}}*/ diff --git a/test/integration/test-changelog b/test/integration/test-changelog index b5c204a53..0a80cc08c 100755 --- a/test/integration/test-changelog +++ b/test/integration/test-changelog @@ -19,10 +19,18 @@ testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt aptget changelog apt -qq > apt.changelog testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" -rm aptarchive/pool/apt_1.0/changelog +rm apt.changelog + +aptget changelog apt -d -qq +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" +rm apt.changelog aptarchive/pool/apt_1.0/changelog aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' > apt.changelog testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -rm aptarchive/pool/apt_1.0.changelog +rm apt.changelog + +aptget changelog apt -d -qq +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" +rm apt.changelog aptarchive/pool/apt_1.0.changelog testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' -- cgit v1.2.3 From 42d41ddbcb8238add82609badd1fbb16f54c4077 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 17:54:49 +0100 Subject: implement --print-uris for download command --- cmdline/apt-get.cc | 21 ++++++++++++++++----- test/integration/test-apt-get-download | 29 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) create mode 100755 test/integration/test-apt-get-download diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 93f167f19..878313212 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2208,13 +2208,15 @@ bool DoDownload(CommandLine &CmdL) APT::CacheSetHelper helper(c0out); APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); - pkgAcquire Fetcher; - AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); - Fetcher.Setup(&Stat); if (verset.empty() == true) return false; + pkgAcquire Fetcher; + AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); + if (_config->FindB("APT::Get::Print-URIs") == true) + Fetcher.Setup(&Stat); + pkgRecords Recs(Cache); pkgSourceList *SrcList = Cache.GetSourceList(); for (APT::VersionSet::const_iterator Ver = verset.begin(); @@ -2245,9 +2247,18 @@ bool DoDownload(CommandLine &CmdL) // get the file new pkgAcqFile(&Fetcher, uri, hash.toStr(), (*Ver)->Size, descr, Pkg.Name(), "."); } - bool result = (Fetcher.Run() == pkgAcquire::Continue); - return result; + // Just print out the uris and exit if the --print-uris flag was used + if (_config->FindB("APT::Get::Print-URIs") == true) + { + pkgAcquire::UriIterator I = Fetcher.UriBegin(); + for (; I != Fetcher.UriEnd(); I++) + cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << + I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; + return true; + } + + return (Fetcher.Run() == pkgAcquire::Continue); } /*}}}*/ // DoCheck - Perform the check operation /*{{{*/ diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download new file mode 100755 index 000000000..7db93c32f --- /dev/null +++ b/test/integration/test-apt-get-download @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' +buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' + +setupaptarchive + +testdownload() { + msgtest 'Test download of package file' $1 + if [ -z "$3" ]; then + aptget download ${2} + else + aptget download ${2}/${3} + fi + test -f $1 && msgpass || msgfail +} + +testdownload apt_1.0_all.deb apt stable +testdownload apt_2.0_all.deb apt + +DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb" +testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) sha256:$(sha256sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris -- cgit v1.2.3 From cfe35dbc01015c6927193fd5da02eaabd753989a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 17:57:06 +0100 Subject: rename changelog and autoremove testfile to indicate better what is tested --- test/integration/test-apt-get-autoremove | 55 ++++++++++++++++++++++++++++++++ test/integration/test-apt-get-changelog | 36 +++++++++++++++++++++ test/integration/test-autoremove | 55 -------------------------------- test/integration/test-changelog | 36 --------------------- 4 files changed, 91 insertions(+), 91 deletions(-) create mode 100755 test/integration/test-apt-get-autoremove create mode 100755 test/integration/test-apt-get-changelog delete mode 100755 test/integration/test-autoremove delete mode 100755 test/integration/test-changelog diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove new file mode 100755 index 000000000..9dfab19f5 --- /dev/null +++ b/test/integration/test-apt-get-autoremove @@ -0,0 +1,55 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +buildsimplenativepackage 'unrelated' 'all' '1' 'unstable' +buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable' +buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf' +setupaptarchive + +aptget install unrelated debhelper -qq 2>&1 > /dev/null +testdpkginstalled 'unrelated' 'debhelper' 'po-debconf' + +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: po-debconf +Architecture: i386 +Auto-Installed: 1 +' +aptget remove debhelper -y -qq 2>&1 > /dev/null +testdpkgnotinstalled 'debhelper' +testdpkginstalled 'po-debconf' 'unrelated' + +echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + po-debconf +0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv po-debconf [1.0.16]' aptget autoremove -s +testdpkginstalled 'po-debconf' + +echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove +aptget autoremove -y -qq 2>&1 > /dev/null +testdpkginstalled 'po-debconf' + +echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove +aptget autoremove -y -qq 2>&1 > /dev/null +testdpkginstalled "po-debconf" + +rm rootdir/etc/apt/apt.conf.d/00autoremove +aptget autoremove -y -qq 2>&1 > /dev/null +testdpkgnotinstalled 'po-debconf' + +testfileequal 'rootdir/var/lib/apt/extended_states' '' + +sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' +testfileequal 'rootdir/var/log/apt/history.log' ' +Install: unrelated:i386 (1), debhelper:i386 (8.0.0), po-debconf:i386 (1.0.16, automatic) + +Remove: debhelper:i386 (8.0.0) + +Remove: po-debconf:i386 (1.0.16)' diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog new file mode 100755 index 000000000..0a80cc08c --- /dev/null +++ b/test/integration/test-apt-get-changelog @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver +aptget update -qq + +echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf + +testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris + +aptget changelog apt -qq > apt.changelog +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" +rm apt.changelog + +aptget changelog apt -d -qq +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" +rm apt.changelog aptarchive/pool/apt_1.0/changelog + +aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' > apt.changelog +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" +rm apt.changelog + +aptget changelog apt -d -qq +testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" +rm apt.changelog aptarchive/pool/apt_1.0.changelog + +testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' diff --git a/test/integration/test-autoremove b/test/integration/test-autoremove deleted file mode 100755 index 9dfab19f5..000000000 --- a/test/integration/test-autoremove +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework -setupenvironment -configarchitecture 'i386' - -buildsimplenativepackage 'unrelated' 'all' '1' 'unstable' -buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable' -buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf' -setupaptarchive - -aptget install unrelated debhelper -qq 2>&1 > /dev/null -testdpkginstalled 'unrelated' 'debhelper' 'po-debconf' - -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: po-debconf -Architecture: i386 -Auto-Installed: 1 -' -aptget remove debhelper -y -qq 2>&1 > /dev/null -testdpkgnotinstalled 'debhelper' -testdpkginstalled 'po-debconf' 'unrelated' - -echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove -testequal 'Reading package lists... -Building dependency tree... -Reading state information... -The following packages will be REMOVED: - po-debconf -0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. -Remv po-debconf [1.0.16]' aptget autoremove -s -testdpkginstalled 'po-debconf' - -echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove -aptget autoremove -y -qq 2>&1 > /dev/null -testdpkginstalled 'po-debconf' - -echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove -aptget autoremove -y -qq 2>&1 > /dev/null -testdpkginstalled "po-debconf" - -rm rootdir/etc/apt/apt.conf.d/00autoremove -aptget autoremove -y -qq 2>&1 > /dev/null -testdpkgnotinstalled 'po-debconf' - -testfileequal 'rootdir/var/lib/apt/extended_states' '' - -sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -testfileequal 'rootdir/var/log/apt/history.log' ' -Install: unrelated:i386 (1), debhelper:i386 (8.0.0), po-debconf:i386 (1.0.16, automatic) - -Remove: debhelper:i386 (8.0.0) - -Remove: po-debconf:i386 (1.0.16)' diff --git a/test/integration/test-changelog b/test/integration/test-changelog deleted file mode 100755 index 0a80cc08c..000000000 --- a/test/integration/test-changelog +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -configarchitecture "i386" - -buildsimplenativepackage 'apt' 'all' '1.0' 'stable' - -setupaptarchive -changetowebserver -aptget update -qq - -echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf - -testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris - -aptget changelog apt -qq > apt.changelog -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" -rm apt.changelog - -aptget changelog apt -d -qq -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" -rm apt.changelog aptarchive/pool/apt_1.0/changelog - -aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' > apt.changelog -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -rm apt.changelog - -aptget changelog apt -d -qq -testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)" -rm apt.changelog aptarchive/pool/apt_1.0.changelog - -testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' -- cgit v1.2.3 From 8f3853baea6191788da6befb437e92ba246c86a3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 21:42:36 +0100 Subject: * apt-pkg/contrib/error.cc: - remove 400 char size limit of error messages (LP: #365611) --- apt-pkg/contrib/error.cc | 31 +++++++++++++++++----- debian/changelog | 4 ++- .../test-ubuntu-bug-365611-long-package-names | 11 ++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100755 test/integration/test-ubuntu-bug-365611-long-package-names diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index e2e8d6e57..7dad11689 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -103,10 +104,21 @@ bool GlobalError::InsertErrno(MsgType const &type, const char *Function, // GlobalError::InsertErrno - formats an error message with the errno /*{{{*/ bool GlobalError::InsertErrno(MsgType type, const char* Function, const char* Description, va_list &args) { - char S[400]; - snprintf(S, sizeof(S), "%s - %s (%i: %s)", Description, - Function, errno, strerror(errno)); - return Insert(type, S, args); + int const errsv = errno; + char* S = (char*) malloc(400); + size_t const Ssize = snprintf(S, 400, "%s - %s (%i: %s)", Description, + Function, errsv, strerror(errsv)) + 1; + + if (Ssize > 400) { + free(S); + S = (char*) malloc(Ssize); + snprintf(S, Ssize, "%s - %s (%i: %s)", Description, + Function, errsv, strerror(errsv)); + } + + bool const geins = Insert(type, S, args); + free(S); + return geins; } /*}}}*/ // GlobalError::Fatal - Add a fatal error to the list /*{{{*/ @@ -157,8 +169,14 @@ bool GlobalError::Insert(MsgType const &type, const char *Description,...) // GlobalError::Insert - Insert a new item at the end /*{{{*/ bool GlobalError::Insert(MsgType type, const char* Description, va_list &args) { - char S[400]; - vsnprintf(S,sizeof(S),Description,args); + char* S = (char*) malloc(400); + size_t const Ssize = vsnprintf(S, 400, Description, args) + 1; + + if (Ssize > 400) { + free(S); + S = (char*) malloc(Ssize); + vsnprintf(S, Ssize, Description, args); + } Item const m(S, type); Messages.push_back(m); @@ -169,6 +187,7 @@ bool GlobalError::Insert(MsgType type, const char* Description, if (type == FATAL || type == DEBUG) std::clog << m << std::endl; + free(S); return false; } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index 3adb9d76f..a44a603e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -84,6 +84,8 @@ apt (0.8.11) UNRELEASED; urgency=low * apt-pkg/pkgcachegen.cc: - in multiarch, let :all packages conflict with :any packages with a different version to be sure + * apt-pkg/contrib/error.cc: + - remove 400 char size limit of error messages (LP: #365611) [ Michael Vogt ] * methods/http.cc: @@ -101,7 +103,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Mon, 07 Feb 2011 13:06:50 +0100 + -- David Kalnischkies Mon, 07 Feb 2011 21:42:06 +0100 apt (0.8.10.3) unstable; urgency=low diff --git a/test/integration/test-ubuntu-bug-365611-long-package-names b/test/integration/test-ubuntu-bug-365611-long-package-names new file mode 100755 index 000000000..28b55df3b --- /dev/null +++ b/test/integration/test-ubuntu-bug-365611-long-package-names @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +local TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" +setupaptarchive + +aptget install $(for i in $(seq 0 1000); do echo -n 'a'; done) 2> longpackagename.log > /dev/null || true +testfileequal 'longpackagename.log' "E: Unable to locate package $(for i in $(seq 0 1000); do echo -n 'a'; done)" -- cgit v1.2.3 From 7376837d338fd9399cfa4820b6f9bacbb2634d46 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 22:15:51 +0100 Subject: a notice is printed for ignored files (Closes: #597615) --- debian/changelog | 3 ++- doc/apt.conf.5.xml | 6 ++++-- doc/apt_preferences.5.xml | 6 ++++-- doc/sources.list.5.xml | 4 +++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index a44a603e3..9e14c562c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -45,6 +45,7 @@ apt (0.8.11) UNRELEASED; urgency=low - remove duplicated mentioning of --install-recommends * doc/sources.list.5.xml: - remove obsolete references to non-us (Closes: #594495) + - a notice is printed for ignored files (Closes: #597615) * debian/rules: - use -- instead of deprecated -u for dh_gencontrol - remove shlibs.local creation and usage @@ -103,7 +104,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Mon, 07 Feb 2011 21:42:06 +0100 + -- David Kalnischkies Mon, 07 Feb 2011 22:14:09 +0100 apt (0.8.10.3) unstable; urgency=low diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index a423dac24..477507598 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -52,8 +52,10 @@ all files in Dir::Etc::Parts in alphanumeric ascending order which have no or "conf" as filename extension and which only contain alphanumeric, - hyphen (-), underscore (_) and period (.) characters - - otherwise they will be silently ignored. + hyphen (-), underscore (_) and period (.) characters. + Otherwise APT will print a notice that it has ignored a file if the file + doesn't match a pattern in the Dir::Ignore-Files-Silently + configuration list - in this case it will be silently ignored. the main configuration file specified by Dir::Etc::main the command line options are applied to override the diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml index 54c01100c..0d22d0413 100644 --- a/doc/apt_preferences.5.xml +++ b/doc/apt_preferences.5.xml @@ -71,8 +71,10 @@ You have been warned. directory are parsed in alphanumeric ascending order and need to obey the following naming convention: The files have no or "pref" as filename extension and which only contain alphanumeric, hyphen (-), -underscore (_) and period (.) characters - otherwise they will be silently -ignored. +underscore (_) and period (.) characters. +Otherwise APT will print a notice that it has ignored a file if the file +doesn't match a pattern in the Dir::Ignore-Files-Silently +configuration list - in this case it will be silently ignored. APT's Default Priority Assignments diff --git a/doc/sources.list.5.xml b/doc/sources.list.5.xml index 212ed6d98..837f07683 100644 --- a/doc/sources.list.5.xml +++ b/doc/sources.list.5.xml @@ -57,7 +57,9 @@ File names need to end with .list and may only contain letters (a-z and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.) characters. - Otherwise they will be silently ignored. + Otherwise APT will print a notice that it has ignored a file if the file + doesn't match a pattern in the Dir::Ignore-Files-Silently + configuration list - in this case it will be silently ignored. The deb and deb-src types -- cgit v1.2.3