From: David Kalnischkies Date: Wed, 14 Sep 2011 18:22:31 +0000 (+0200) Subject: enable APT in unpack/configure ordering to handle loops as well X-Git-Tag: 0.9.0~53^2 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/75a90b93257ea81d42331c03b56bd6589c62e065?hp=--cc enable APT in unpack/configure ordering to handle loops as well as tight dependencies between immediate packages better enabling also the possibility to mark all packages as immediate (at least Closes: #353290, #540227, #559733, #621836, #639290) --- 75a90b93257ea81d42331c03b56bd6589c62e065 diff --cc apt-pkg/packagemanager.cc index c41a1f1ee,b5d353602..3cd9f6f00 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@@ -168,10 -168,14 +170,14 @@@ bool pkgPackageManager::CreateOrderList delete List; List = new pkgOrderList(&Cache); - static bool const NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true); + NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true); + ImmConfigureAll = _config->FindB("APT::Immediate-Configure-All",false); + + if (Debug && ImmConfigureAll) + clog << "CreateOrderList(): Adding Immediate flag for all packages because of APT::Immediate-Configure-All" << endl; // Generate the list of affected packages and sort it - for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) + for (PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I) { // Ignore no-version packages if (I->VersionList == 0) @@@ -276,12 -283,22 +285,22 @@@ bool pkgPackageManager::ConfigureAll( bool const ConfigurePkgs = (conf == "all"); // Perform the configuring - for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++) + for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I) { PkgIterator Pkg(Cache,*I); + + /* Check if the package has been configured, this can happen if SmartConfigure + calls its self */ + if (List->IsFlag(Pkg,pkgOrderList::Configured)) continue; - if (ConfigurePkgs == true && Configure(Pkg) == false) + if (ConfigurePkgs == true && SmartConfigure(Pkg, 0) == false) { + if (ImmConfigureAll) + _error->Error(_("Could not perform immediate configuration on '%s'. " + "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),1); + else + _error->Error("Internal error, packages left unconfigured. %s",Pkg.Name()); return false; + } List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); } @@@ -306,22 -436,15 +438,15 @@@ bool pkgPackageManager::SmartConfigure( static std::string const conf = _config->Find("PackageManager::Configure","all"); static bool const ConfigurePkgs = (conf == "all" || conf == "smart"); - if (ConfigurePkgs == true) - if (OList.OrderConfigure() == false) - return false; + if (List->IsFlag(Pkg,pkgOrderList::Configured)) + return _error->Error("Internal configure error on '%s'. ",Pkg.Name(),1); - // Perform the configuring - for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I) - { - PkgIterator Pkg(Cache,*I); - - if (ConfigurePkgs == true && Configure(Pkg) == false) - return false; - - List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); - } + if (ConfigurePkgs == true && Configure(Pkg) == false) + return false; - ++ + List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); - if (Cache[Pkg].InstVerIter(Cache)->MultiArch == pkgCache::Version::Same) + if ((Cache[Pkg].InstVerIter(Cache)->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) for (PkgIterator P = Pkg.Group().PackageList(); P.end() == false; P = Pkg.Group().NextPkg(P)) { @@@ -566,9 -627,9 +629,9 @@@ bool pkgPackageManager::SmartUnPack(Pkg return _error->Error("Couldn't configure pre-depend %s for %s, " "probably a dependency cycle.", End.TargetPkg().Name(),Pkg.Name()); - Start++; + ++Start; } - else + else break; } @@@ -596,56 -722,36 +724,59 @@@ // Check for reverse conflicts. if (CheckRConflicts(Pkg,Pkg.RevDependsList(), instVer.VerStr()) == false) - return false; + return false; for (PrvIterator P = instVer.ProvidesList(); - P.end() == false; P++) - CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); + P.end() == false; ++P) + if (Pkg->Group != P.OwnerPkg()->Group) + CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); - if (PkgLoop) return true; ++ if (PkgLoop) ++ return true; + List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); - if (instVer->MultiArch == pkgCache::Version::Same) + if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same) + { + /* Do lockstep M-A:same unpacking in two phases: + First unpack all installed architectures, then the not installed. + This way we avoid that M-A: enabled packages are installed before + their older non-M-A enabled packages are replaced by newer versions */ + bool const installed = Pkg->CurrentVer != 0; + if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false) + return false; + for (PkgIterator P = Pkg.Group().PackageList(); + P.end() == false; P = Pkg.Group().NextPkg(P)) + { + if (P->CurrentVer == 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true || + Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && + (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) + continue; - if (SmartUnPack(P, false) == false) ++ if (SmartUnPack(P, false, Depth + 1) == false) + return false; + } + if (installed == false && Install(Pkg,FileNames[Pkg->ID]) == false) + return false; for (PkgIterator P = Pkg.Group().PackageList(); - P.end() == false; P = Pkg.Group().NextPkg(P)) + P.end() == false; P = Pkg.Group().NextPkg(P)) { - if (Pkg == P || List->IsFlag(P,pkgOrderList::UnPacked) == true || - Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && - (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) - continue; - SmartUnPack(P, false, Depth + 1); + if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true || + Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && + (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) + continue; - if (SmartUnPack(P, false) == false) ++ if (SmartUnPack(P, false, Depth + 1) == false) + return false; } - - if(Install(Pkg,FileNames[Pkg->ID]) == false) + } + else if (Install(Pkg,FileNames[Pkg->ID]) == false) return false; - // Perform immedate configuration of the package. - if (Immediate == true && - List->IsFlag(Pkg,pkgOrderList::Immediate) == true) - if (SmartConfigure(Pkg) == false) - return _error->Error(_("Could not perform immediate configuration on '%s'. " - "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),2); + if (Immediate == true) { + // Perform immedate configuration of the package. + if (SmartConfigure(Pkg, Depth + 1) == false) + _error->Warning(_("Could not perform immediate configuration on '%s'. " + "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),2); + } return true; } @@@ -676,15 -782,22 +807,22 @@@ pkgPackageManager::OrderResult pkgPacka clog << "Done ordering" << endl; bool DoneSomething = false; - for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) + for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I) { PkgIterator Pkg(Cache,*I); - + if (List->IsNow(Pkg) == false) { - if (Debug == true) - clog << "Skipping already done " << Pkg.Name() << endl; + if (!List->IsFlag(Pkg,pkgOrderList::Configured) && !NoImmConfigure) { + if (SmartConfigure(Pkg, 0) == false && Debug) + _error->Warning("Internal Error, Could not configure %s",Pkg.Name()); + // FIXME: The above warning message might need changing + } else { + if (Debug == true) + clog << "Skipping already done " << Pkg.Name() << endl; + } continue; + } if (List->IsMissing(Pkg) == true) diff --cc debian/changelog index 62bbdcdd8,87d25e78f..444a99ba7 --- a/debian/changelog +++ b/debian/changelog @@@ -1,280 -1,3 +1,286 @@@ +apt (0.8.16~exp6) experimental; urgency=low + ++ [ Christopher Baines ] ++ * enable APT in unpack/configure ordering to handle loops as well ++ as tight dependencies between immediate packages better ++ enabling also the possibility to mark all packages as immediate ++ (at least Closes: #353290, #540227, #559733, #621836, #639290) ++ + [ David Kalnischkies ] + * [abi-break] Support large files in the complete toolset. Indexes of this + size are pretty unlikely for now, but we need it for deb + packages which could become bigger than 4GB now (LP: #815895) + * merged the debian-sid branch + + [ Michael Vogt ] + * bump ABI version + + -- Michael Vogt Wed, 14 Sep 2011 13:26:23 +0200 + +apt (0.8.16~exp5) experimental; urgency=low + + * merged the latest debian-sid fixes + * apt-pkg/makefile: + - install sha256.h compat header + * apt-pkg/pkgcachegen.{cc,h}: + - use ref-to-ptr semantic in NewDepends() to ensure that the + libapt does not segfault if the cache is remapped in between + (LP: #812862) + - fix crash when P.Arch() was used but the cache got remapped + * apt-pkg/acquire-item.{cc,h}: + - do not check for a "Package" tag in optional index targets + like the translations index + * apt-pkg/acquire.cc: + - fix potential divide-by-zero + * methods/mirror.cc: + - include the architecture(s) in the query string as well so + that the server can make better decisions + + -- Michael Vogt Mon, 15 Aug 2011 14:52:54 +0200 + +apt (0.8.16~exp4) experimental; urgency=low + + [ Julian Andres Klode ] + * apt-pkg/pkgcache.h: + - [ABI break] Add pkgCache::Header::CacheFileSize, storing the cache size + * apt-pkg/pkgcachegen.cc: + - Write the file size to the cache + * apt-pkg/pkgcache.cc: + - Check that cache is at least CacheFileSize bytes large (LP: #16467) + + [ Michael Vogt ] + * merged latest fixes from debian-sid + * apt-pkg/cdrom.{cc,h}: + - cleanup old ABI break avoidance hacks + * [ABI break] apt-pkg/acquire-item.{cc,h}: + - cleanup around OptionalIndexTarget and SubIndexTarget + * [ABI break] merged patch from Jonathan Thomas to have a new + RecordField() function in the pkgRecorder parser. Many thanks + Thomas + * [ABI break] merge patch from Jonathan Thomas to speed up the + depcache by caching the install-recommends and install-suggests + values + * apt-pkg/contrib/fileutl.{cc,h}: + - add GetModificationTime() helper + * apt-pkg/pkgcachegen.cc: + - regenerate the cache if the sources.list changes to ensure + that changes in the ordering there will be honored by apt + * apt-pkg/sourcelist.{cc,h}: + - add pkgSourceList::GetLastModifiedTime() helper + + -- Michael Vogt Thu, 28 Jul 2011 16:57:08 +0200 + +apt (0.8.16~exp3) experimental; urgency=low + + [ David Kalnischkies ] + * apt-pkg/pkgcache.h: + - readd All{Foreign,Allowed} as suggested by Julian to + remain strictly API compatible + * apt-pkg/acquire*.{cc,h}: + - try even harder to support really big files in the fetcher by + converting (hopefully) everything to 'long long' (Closes: #632271) + * ftparchive/writer.cc: + - generate all checksums in one run over the file for Release + * cmdline/apt-get.cc: + - add an --assume-no option for testing to say 'no' to everything + * apt-pkg/deb/debmetaindex.cc: + - add trusted=yes option to mark unsigned (local) repository as trusted + based on a patch from Ansgar Burchardt, thanks a lot! (Closes: #596498) + + [ Michael Vogt ] + * merge fixes from the debian/unstable upload + * merge lp:~mvo/apt/sha512-template to get fixes for the + sha1/md5 verifiation (closes: #632520) + + -- Michael Vogt Fri, 15 Jul 2011 09:56:17 +0200 + +apt (0.8.16~exp2) experimental; urgency=low + + [ David Kalnischkies ] + * [ABI-Break] Implement EDSP in libapt-pkg so that all front-ends which + use the internal resolver can now be used also with external + ones as the usage is hidden in between the old API + * provide two edsp solvers in apt-utils: + - 'dump' to quickly output a complete scenario and + - 'apt' to use the internal as an external resolver + * apt-pkg/pkgcache.h: + - clean up mess with the "all" handling in MultiArch to + fix LP: #733741 cleanly for everyone now + * apt-pkg/depcache.cc: + - use a boolean instead of an int for Add/Remove in AddStates + similar to how it works with AddSizes + - let the Mark methods return if their marking was successful + - if a Breaks can't be upgraded, remove it. If it or a Conflict + can't be removed the installation of the breaker fails. + * cmdline/apt-get.cc: + - do not discard the error messages from the resolver and instead + only show the general 'Broken packages' message if nothing else + + [ Stefano Zacchiroli ] + * doc/external-dependency-solver-protocol.txt: + - describe EDSP and the configuration interface around it + + [ Michael Vogt ] + * [ABI-Break] merge lp:~mvo/apt/sha512-template to add support for sha512 + * [ABI-Break] merge lp:~mvo/apt/dpointer to support easier extending + without breaking the ABI + * increase ABI version and update package names + + -- Michael Vogt Wed, 29 Jun 2011 13:57:28 +0200 + +apt (0.8.16~exp1) experimental; urgency=low + + * merged with the debian/unstable upload + + -- Michael Vogt Wed, 29 Jun 2011 12:40:31 +0200 + +apt (0.8.15.7) unstable; urgency=low + + [ David Kalnischkies ] + * apt-pkg/packagemanager.cc, apt-pkg/pkgcache.cc: + - ignore "self"-conflicts for all architectures of a package + instead of just for the architecture of the package look at + in the ordering of installations, too (LP: #802901) + - M-A:same lockstep unpack should operate on installed + packages first (LP: #835625) + * test/* + - reorganize the various testcases and helper we have and + integrate them better into the buildsystem + - run the test/libapt testcases at package build-time + * debian/apt.symbols: + - add the newly added symbols since 0.8.15.3 + * cmdline/apt-get.cc: + - remove the binary caches in 'apt-get clean' as it is the first + thing recommend by many supporters in case of APT segfaults + - remove the caches in 'apt-get update', too, as they will be + invalid in most cases anyway + * apt-pkg/acquire-item.cc: + - if no Release.gpg file is found try to verify with hashes, + but do not fail if a hash can't be found + * apt-pkg/acquire.cc: + - non-existing directories are by definition clean + * cmdline/apt-key: + - if command is 'add' do not error out if the specified + keyring doesn't exist, it will be created by gpg + * apt-pkg/orderlist.cc: + - prefer visiting packages marked for deletion in VisitProvides + if we are operating on a negative dependency so that we can + deal early with the fallout of this remove + * apt-pkg/indexrecords.cc: + - fix Acquire::Max-ValidTime option by interpreting it really + as seconds as specified in the manpage and not as days + - add an Acquire::Min-ValidTime option (Closes: #640122) + * doc/apt.conf.5.xml: + - reword Acquire::Max-ValidTime documentation to make clear + that it doesn't provide the new Min-ValidTime functionality + + -- Michael Vogt Mon, 12 Sep 2011 16:38:46 +0200 + +apt (0.8.15.6) unstable; urgency=low + + [ Michael Vogt ] + * apt-pkg/contrib/fileutl.{cc,h}: + - add GetModificationTime() helper + * apt-pkg/pkgcachegen.cc: + - regenerate the cache if the sources.list changes to ensure + that changes in the ordering there will be honored by apt + * apt-pkg/sourcelist.{cc,h}: + - add pkgSourceList::GetLastModifiedTime() helper + * apt-pkg/pkgcachegen.{cc,h}: + - use ref-to-ptr semantic in NewDepends() to ensure that the + libapt does not segfault if the cache is remapped in between + (LP: #812862) + - fix crash when P.Arch() was used but the cache got remapped + * test/integration/test-hashsum-verification: + - add regression test for hashsum verification + * apt-pkg/acquire-item.cc: + - if no Release.gpg file is found, still load the hashes for + verification (closes: #636314) and add test + + [ David Kalnischkies ] + * lots of cppcheck fixes + + -- Michael Vogt Mon, 15 Aug 2011 09:20:35 +0200 + +apt (0.8.15.5) unstable; urgency=low + + [ David Kalnischkies ] + * apt-pkg/deb/deblistparser.cc: + - do not assume that the last char on a line is a \n (Closes: #633350) + + -- Michael Vogt Thu, 28 Jul 2011 16:49:15 +0200 + +apt (0.8.15.4) unstable; urgency=low + + [ David Miller ] + * apt-pkg/contrib/sha1.cc: + - fix illegally casts of on-stack buffer to a type requiring more + alignment than it has resulting in segfaults on sparc (Closes: #634696) + + [ Michael Vogt ] + * apt-pkg/contrib/cdromutl.cc: + - fix escape problem when looking for the mounted devices + * apt-pkg/contrib/strutl.{h,cc}, test/libapt/strutil_test.cc: + - add new DeEscapeString() similar to DeQuoteString but + unescape character escapes like \0XX and \xXX (plus added + test) + * refresh po/* + + -- Michael Vogt Tue, 26 Jul 2011 12:12:27 +0200 + +apt (0.8.15.3) unstable; urgency=low + + [ Michael Vogt ] + * apt-pkg/acquire-item.cc: + - improve error message for a expired Release file + * apt-pkg/algorithms.cc: + - Hold back packages that would enter "policy-broken" state on upgrade + when doing a "apt-get upgrade" + * cmdline/apt-get.cc: + - fix missing download progress in apt-get download + + [ David Kalnischkies ] + * apt-pkg/pkgcachegen.cc: + - fallback to memory if file is not writeable even if access() + told us the opposite before (e.g. in fakeroot 1.16) (Closes: #630591) + * doc/sources.list.5.xml: + - document available [options] for sources.list entries (Closes: 632441) + * doc/apt.conf.5.xml: + - document APT::Architectures list (Closes: #612102) + * cmdline/apt-get.cc: + - restore all important dependencies for garbage packages (LP: #806274) + - do not require unused partial dirs in 'source' (Closes: #633510) + - buildconflicts effect all architectures + - implement MultiarchCross for build-dep and source (Closes: #632221) + * apt-pkg/init.cc: + - use CndSet in pkgInitConfig (Closes: #629617) + * apt-pkg/depcache.cc: + - change default of APT::AutoRemove::SuggestsImportant to true + * cmdline/apt-key: + - use a tmpfile instead of /etc/apt/secring.gpg (Closes: #632596) + * debian/apt.postinst: + - remove /etc/apt/secring.gpg if it is an empty file + * doc/apt-cache.8.xml: + - apply madison typofix from John Feuerstein, thanks! (Closes: #633455) + * apt-pkg/policy.cc: + - emit an error on unknown APT::Default-Release value (Closes: #407511) + * apt-pkg/aptconfiguration.cc: + - ensure that native architecture is if not specified otherwise the + first architecture in the Architectures vector + * apt-pkg/deb/deblistparser.cc: + - Strip only :any and :native if MultiArch should be stripped as it is + save to ignore them in non-MultiArch contexts but if the dependency + is a specific architecture (and not the native) do not strip + + -- Michael Vogt Mon, 25 Jul 2011 15:04:43 +0200 + +apt (0.8.15.2) unstable; urgency=high + + * fix from David Kalnischkies for the InRelease gpg verification + code (LP: #784473) + + -- Michael Vogt Tue, 12 Jul 2011 11:54:47 +0200 + apt (0.8.15.1) unstable; urgency=low [ David Kalnischkies ] diff --cc test/integration/test-bug-618288-multiarch-same-lockstep index a05f03df4,7e384e428..7333054cc --- a/test/integration/test-bug-618288-multiarch-same-lockstep +++ b/test/integration/test-bug-618288-multiarch-same-lockstep @@@ -17,16 -17,16 +17,29 @@@ buildsimplenativepackage 'apt2' 'amd64 setupaptarchive --testequal 'Reading package lists... ++# order in switch libsame:{amd64,i386} are unpacked is irrelevant, as both are installed - but we need to do it together ++testequalor2 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + apt:i386 apt2 libsame libsame:i386 +4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst libsame:i386 [1] (2 unstable [i386]) [libsame:amd64 on libsame:i386] [libsame:i386 on libsame:amd64] [libsame:amd64 apt:i386 ] +Inst libsame [1] (2 unstable [amd64]) [apt2:amd64 apt:i386 ] +Conf libsame:i386 (2 unstable [i386]) [apt2:amd64 apt:i386 ] +Conf libsame (2 unstable [amd64]) [apt2:amd64 apt:i386 ] +Inst apt2 [1] (2 unstable [amd64]) [apt:i386 ] +Conf apt2 (2 unstable [amd64]) [apt:i386 ] +Inst apt:i386 [1] (2 unstable [i386]) ++Conf apt:i386 (2 unstable [i386])' 'Reading package lists... + Building dependency tree... + The following packages will be upgraded: + apt:i386 apt2 libsame libsame:i386 + 4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. + Inst libsame [1] (2 unstable [amd64]) [libsame:amd64 on libsame:i386] [libsame:i386 on libsame:amd64] [libsame:i386 apt2:amd64 ] + Inst libsame:i386 [1] (2 unstable [i386]) [apt2:amd64 apt:i386 ] + Conf libsame:i386 (2 unstable [i386]) [apt2:amd64 apt:i386 ] + Conf libsame (2 unstable [amd64]) [apt2:amd64 apt:i386 ] + Inst apt2 [1] (2 unstable [amd64]) [apt:i386 ] + Conf apt2 (2 unstable [amd64]) [apt:i386 ] + Inst apt:i386 [1] (2 unstable [i386]) Conf apt:i386 (2 unstable [i386])' aptget dist-upgrade -s