From: Michael Vogt Date: Tue, 4 May 2010 08:06:57 +0000 (+0200) Subject: merged from davids branch X-Git-Tag: 0.8.0~9^2~58 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/af8a8da9c1aa6506d230a0df8abc670661176ba3?hp=-c merged from davids branch --- af8a8da9c1aa6506d230a0df8abc670661176ba3 diff --combined apt-pkg/acquire-item.cc index 6d4336425,916fca71e..1f253bb81 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@@ -1327,7 -1327,8 +1327,8 @@@ pkgAcqArchive::pkgAcqArchive(pkgAcquir the archive is already available in the cache and stashs the MD5 for checking later. */ bool pkgAcqArchive::QueueNext() - { + { + string const ForceHash = _config->Find("Acquire::ForceHash"); for (; Vf.end() == false; Vf++) { // Ignore not source sources @@@ -1350,12 -1351,25 +1351,25 @@@ return false; string PkgFile = Parse.FileName(); - if(Parse.SHA256Hash() != "") - ExpectedHash = HashString("SHA256", Parse.SHA256Hash()); - else if (Parse.SHA1Hash() != "") - ExpectedHash = HashString("SHA1", Parse.SHA1Hash()); - else - ExpectedHash = HashString("MD5Sum", Parse.MD5Hash()); + if (ForceHash.empty() == false) + { + if(stringcasecmp(ForceHash, "sha256") == 0) + ExpectedHash = HashString("SHA256", Parse.SHA256Hash()); + else if (stringcasecmp(ForceHash, "sha1") == 0) + ExpectedHash = HashString("SHA1", Parse.SHA1Hash()); + else + ExpectedHash = HashString("MD5Sum", Parse.MD5Hash()); + } + else + { + string Hash; + if ((Hash = Parse.SHA256Hash()).empty() == false) + ExpectedHash = HashString("SHA256", Hash); + else if ((Hash = Parse.SHA1Hash()).empty() == false) + ExpectedHash = HashString("SHA1", Hash); + else + ExpectedHash = HashString("MD5Sum", Parse.MD5Hash()); + } if (PkgFile.empty() == true) return _error->Error(_("The package index files are corrupted. No Filename: " "field for package %s."), @@@ -1547,9 -1561,8 +1561,9 @@@ void pkgAcqArchive::Finished( /* The file is added to the queue */ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash, unsigned long Size,string Dsc,string ShortDesc, - const string &DestDir, const string &DestFilename) : - Item(Owner), ExpectedHash(Hash) + const string &DestDir, const string &DestFilename, + bool IsIndexFile) : + Item(Owner), ExpectedHash(Hash), IsIndexFile(IsIndexFile) { Retries = _config->FindI("Acquire::Retries",0); @@@ -1664,12 -1677,3 +1678,12 @@@ void pkgAcqFile::Failed(string Message, Item::Failed(Message,Cnf); } /*}}}*/ +// AcqIndex::Custom600Headers - Insert custom request headers /*{{{*/ +// --------------------------------------------------------------------- +/* The only header we use is the last-modified header. */ +string pkgAcqFile::Custom600Headers() +{ + if (IsIndexFile) + return "\nIndex-File: true"; +} + /*}}}*/ diff --combined apt-pkg/depcache.cc index 2c7cdd5c2,a63deee3a..423161b13 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@@ -192,7 -192,7 +192,7 @@@ bool pkgDepCache::readStateFile(OpProgr { PkgState[pkg->ID].Flags |= Flag::Auto; if (unlikely(debug_autoremove)) - std::cout << "Auto-Installed : " << pkg.FullName() << std::endl; + std::clog << "Auto-Installed : " << pkg.FullName() << std::endl; if (pkgarch == "any") { pkgCache::GrpIterator G = pkg.Group(); @@@ -841,42 -841,15 +841,15 @@@ void pkgDepCache::Update(OpProgress *Pr if (installed == false) recheck.insert(G.Index()); } - std::vector Archs = APT::Configuration::getArchitectures(); - bool checkChanged = false; - do { - for(std::set::const_iterator g = recheck.begin(); - g != recheck.end(); ++g) { - GrpIterator G = GrpIterator(*Cache, Cache->GrpP + *g); - VerIterator allV = G.FindPkg("all").CurrentVer(); - for (std::vector::const_iterator a = Archs.begin(); - a != Archs.end(); ++a) - { - PkgIterator P = G.FindPkg(*a); - if (P.end() == true) continue; - for (VerIterator V = P.VersionList(); V.end() != true; ++V) - { - // FIXME: String comparison isn't a save indicator! - if (strcmp(allV.VerStr(),V.VerStr()) != 0) - continue; - unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); - if ((CurDepState & DepInstMin) != DepInstMin) - break; // we found the correct version, but it is broken. Better try another arch or later again - P->CurrentVer = V.Index(); - AddStates(P); - Update(P); - AddSizes(P); - checkChanged = true; - break; - } - } - recheck.erase(g); - } - } while (checkChanged == true && recheck.empty() == false); - if (_config->FindB("Debug::MultiArchKiller", false) == true) - for(std::set::const_iterator g = recheck.begin(); - g != recheck.end(); ++g) - std::cout << "No pseudo package for »" << GrpIterator(*Cache, Cache->GrpP + *g).Name() << "« installed" << std::endl; + while (recheck.empty() != true) + { + std::set::const_iterator g = recheck.begin(); + unsigned long const G = *g; + recheck.erase(g); + if (unlikely(ReInstallPseudoForGroup(G, recheck) == false)) + _error->Warning(_("Internal error, group »%s« has no installable pseudo package"), GrpIterator(*Cache, Cache->GrpP + *g).Name()); + } } if (Prog != 0) @@@ -885,6 -858,80 +858,80 @@@ readStateFile(Prog); } /*}}}*/ + // DepCache::ReInstallPseudoForGroup - MultiArch helper for Update() /*{{{*/ + // --------------------------------------------------------------------- + /* RemovePseudoInstalledPkg() is very successful. It even kills packages + to an amount that no pseudo package is left, but we need a pseudo package + for upgrading senarios so we need to reinstall one pseudopackage which + doesn't break everything. Thankfully we can't have architecture depending + negative dependencies so this problem is already eliminated */ + bool pkgDepCache::ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set &recheck) + { + if (P->CurrentVer != 0) + return true; + // recursive call for packages which provide this package + for (pkgCache::PrvIterator Prv = P.ProvidesList(); Prv.end() != true; ++Prv) + ReInstallPseudoForGroup(Prv.OwnerPkg(), recheck); + // check if we actually need to look at this group + unsigned long const G = P->Group; + std::set::const_iterator Pi = recheck.find(G); + if (Pi == recheck.end()) + return true; + recheck.erase(Pi); // remove here, so we can't fall into an endless loop + if (unlikely(ReInstallPseudoForGroup(G, recheck) == false)) + { + recheck.insert(G); + return false; + } + return true; + } + bool pkgDepCache::ReInstallPseudoForGroup(unsigned long const &G, std::set &recheck) + { + std::vector static const Archs = APT::Configuration::getArchitectures(); + pkgCache::GrpIterator Grp(*Cache, Cache->GrpP + G); + if (unlikely(Grp.end() == true)) + return false; + for (std::vector::const_iterator a = Archs.begin(); + a != Archs.end(); ++a) + { + pkgCache::PkgIterator P = Grp.FindPkg(*a); + if (P.end() == true) + continue; + pkgCache::VerIterator allV = Grp.FindPkg("all").CurrentVer(); + for (VerIterator V = P.VersionList(); V.end() != true; ++V) + { + // search for the same version as the all package + if (allV->Hash != V->Hash || strcmp(allV.VerStr(),V.VerStr()) != 0) + continue; + unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); + // If it is broken, try to install dependencies first before retry + if ((CurDepState & DepInstMin) != DepInstMin) + { + for (pkgCache::DepIterator D = V.DependsList(); D.end() != true; ++D) + { + if (D->Type != pkgCache::Dep::PreDepends && D->Type != pkgCache::Dep::Depends) + continue; + ReInstallPseudoForGroup(D.TargetPkg(), recheck); + } + unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); + // if package ist still broken… try another arch + if ((CurDepState & DepInstMin) != DepInstMin) + break; + } + // dependencies satisfied: reinstall the package + RemoveSizes(P); + RemoveStates(P); + P->CurrentVer = V.Index(); + PkgState[P->ID].InstallVer = V; + AddStates(P); + Update(P); + AddSizes(P); + return true; + } + } + return false; + } + /*}}}*/ // DepCache::Update - Update the deps list of a package /*{{{*/ // --------------------------------------------------------------------- /* This is a helper for update that only does the dep portion of the scan. @@@ -1772,7 -1819,7 +1819,7 @@@ bool pkgDepCache::Sweep() /*{{{* { state.Garbage=true; if(debug_autoremove) - std::cout << "Garbage: " << p.FullName() << std::endl; + std::clog << "Garbage: " << p.FullName() << std::endl; } } diff --combined cmdline/apt-get.cc index cd450b27a,b43164c2f..26c731978 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@@ -692,7 -692,7 +692,7 @@@ bool CacheFile::CheckDeps(bool AllowBro } else { - c1out << _("You might want to run `apt-get -f install' to correct these.") << endl; + c1out << _("You might want to run 'apt-get -f install' to correct these.") << endl; ShowBroken(c1out,*this,true); return _error->Error(_("Unmet dependencies. Try using -f.")); @@@ -811,20 -811,19 +811,19 @@@ bool InstallPackages(CacheFile &Cache,b pkgRecords Recs(Cache); if (_error->PendingError() == true) return false; - - // Lock the archive directory - FileFd Lock; - if (_config->FindB("Debug::NoLocking",false) == false && - _config->FindB("APT::Get::Print-URIs") == false) - { - Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock")); - if (_error->PendingError() == true) - return _error->Error(_("Unable to lock the download directory")); - } - + // Create the download object + pkgAcquire Fetcher; AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); - pkgAcquire Fetcher(&Stat); + if (_config->FindB("APT::Get::Print-URIs", false) == true) + { + // force a hashsum for compatibility reasons + _config->CndSet("Acquire::ForceHash", "md5sum"); + if (Fetcher.Setup(&Stat, "") == false) + return false; + } + else if (Fetcher.Setup(&Stat, _config->FindDir("Dir::Cache::Archives")) == false) + return false; // Read the source list pkgSourceList List; @@@ -1148,20 -1147,27 +1147,27 @@@ bool TryToInstall(pkgCache::PkgIterato Pkg.FullName(true).c_str()); pkgCache::PrvIterator I = Pkg.ProvidesList(); + unsigned short provider = 0; for (; I.end() == false; I++) { pkgCache::PkgIterator Pkg = I.OwnerPkg(); if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer()) { + c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr(); if (Cache[Pkg].Install() == true && Cache[Pkg].NewInstall() == false) - c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr() << - _(" [Installed]") << endl; - else - c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr() << endl; - } + c1out << _(" [Installed]"); + c1out << endl; + ++provider; + } } - c1out << _("You should explicitly select one to install.") << endl; + // if we found no candidate which provide this package, show non-candidates + if (provider == 0) + for (I = Pkg.ProvidesList(); I.end() == false; I++) + c1out << " " << I.OwnerPkg().FullName(true) << " " << I.OwnerVer().VerStr() + << _(" [Not candidate version]") << endl; + else + c1out << _("You should explicitly select one to install.") << endl; } else { @@@ -1258,6 -1264,11 +1264,11 @@@ bool TryToChangeVer(pkgCache::PkgIterat } Cache.SetCandidateVersion(Ver); + + // Set the all package to the same candidate + if (Ver.Pseudo() == true) + Cache.SetCandidateVersion(Match.Find(Pkg.Group().FindPkg("all"))); + return true; } /*}}}*/ @@@ -1304,10 -1315,6 +1315,10 @@@ pkgSrcRecords::Parser *FindSrc(const ch break; fuzzy = true; Ver = Pkg.VersionList(); + // exit right away from the Pkg.VersionList() loop if we + // don't have any versions + if (Ver.end() == true) + break; } // We match against a concrete version (or a part of this version) if (VerTag.empty() == false && @@@ -1446,23 -1453,19 +1457,19 @@@ bool DoUpdate(CommandLine &CmdL if (List.ReadMainList() == false) return false; - // Lock the list directory - FileFd Lock; - if (_config->FindB("Debug::NoLocking",false) == false) - { - Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock")); - if (_error->PendingError() == true) - return _error->Error(_("Unable to lock the list directory")); - } - // Create the progress AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); // Just print out the uris an exit if the --print-uris flag was used if (_config->FindB("APT::Get::Print-URIs") == true) { + // force a hashsum for compatibility reasons + _config->CndSet("Acquire::ForceHash", "md5sum"); + // get a fetcher - pkgAcquire Fetcher(&Stat); + pkgAcquire Fetcher; + if (Fetcher.Setup(&Stat) == false) + return false; // Populate it with the source selection and get all Indexes // (GetAll=true) @@@ -1781,11 -1784,14 +1788,14 @@@ bool DoInstall(CommandLine &CmdL // Run over the matches bool Hit = false; - for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++) + for (pkgCache::GrpIterator Grp = Cache->GrpBegin(); Grp.end() == false; ++Grp) { - if (regexec(&Pattern,Pkg.Name(),0,0,0) != 0) + if (regexec(&Pattern,Grp.Name(),0,0,0) != 0) continue; - + Pkg = Grp.FindPkg("native"); + if (unlikely(Pkg.end() == true)) + continue; + ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"), Pkg.Name(),S); @@@ -1832,7 -1838,7 +1842,7 @@@ packages */ if (BrokenFix == true && Cache->BrokenCount() != 0) { - c1out << _("You might want to run `apt-get -f install' to correct these:") << endl; + c1out << _("You might want to run 'apt-get -f install' to correct these:") << endl; ShowBroken(c1out,Cache,false); return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).")); @@@ -2211,7 -2217,9 +2221,9 @@@ bool DoSource(CommandLine &CmdL // Create the download object AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); - pkgAcquire Fetcher(&Stat); + pkgAcquire Fetcher; + if (Fetcher.Setup(&Stat) == false) + return false; DscFile *Dsc = new DscFile[CmdL.FileSize()]; @@@ -2468,7 -2476,9 +2480,9 @@@ bool DoBuildDep(CommandLine &CmdL // Create the download object AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); - pkgAcquire Fetcher(&Stat); + pkgAcquire Fetcher; + if (Fetcher.Setup(&Stat) == false) + return false; unsigned J = 0; for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++) diff --combined debian/changelog index 2c2b038b6,dd003938a..97e15326c --- a/debian/changelog +++ b/debian/changelog @@@ -1,17 -1,53 +1,65 @@@ -apt (0.7.26~exp4) experimental; urgency=low +apt (0.7.26~exp4) UNRELEASEDexperimental; urgency=low + [ David Kalnischkies ] + * apt-pkg/depcache.cc: + - rewrite the pseudo package reinstaller to be more intelligent + in his package choices + * apt-pkg/packagemanager.cc: + - don't try to "unpack" pseudo packages twice + * apt-pkg/contrib/fileutl.cc: + - add a parent-guarded "mkdir -p" as CreateDirectory() + * apt-pkg/acquire.{cc,h}: + - add a delayed constructor with Setup() for success reporting + - check for and create directories in Setup if needed instead of + error out unfriendly in the Constructor (Closes: #523920, #525783) + - optional handle a lock file in Setup() + * apt-pkg/acquire-item.cc: + - Acquire::ForceHash to force method for expected hash + * cmdline/apt-get.cc: + - remove the lock file handling and let Acquire take care of it instead + - display MD5Sum in --print-uris if not forced to use another method + instead of displaying the strongest available (Closes: #576420) + - regex for package names executed on Grp- not PkgIterator + - show non-candidates as fallback for virtual packages (Closes: #578385) + - set also "all" to this version for pseudo packages in TryToChangeVer + * apt-pkg/deb/dpkgpm.cc: + - remove Chroot-Directory from files passed to install commands. + Thanks to Kel Modderman for report & patch! (Closes: #577226) + * ftparchive/writer.cc: + - remove 999 chars Files and Checksums rewrite limit (Closes: #577759) + * cmdline/apt-cache.cc: + - align Installed and Candidate Version in policy so they can be compared + easier, thanks Ralf Gesellensetter for the pointer! (Closes: #578657) + * doc/apt.ent: + - Add a note about APT_CONFIG in the -c description (Closes: #578267) + * doc/po/de.po: + - correct typos in german apt_preferences manpage, thanks Chris Leick! + * apt-pkg/sourcelist.cc: + - be less strict and accept [option=value] as well + * apt-pkg/contrib/configuration.cc: + - error out if #clear directive has no argument + + [ Jari Aalto ] + * cmdline/apt-get.cc: + - replace backticks with single quotes around fix-broken command + in the broken packages message. (Closes: #577168) + * dselect/install: + - modernize if-statements not to use 'x' (Closes: #577117) + - replace backticks with POSIX $() (Closes: #577116) + ++ [ Michael Vogt ] + * [ Abi break ] apt-pkg/acquire-item.{cc,h}: + - add "IsIndexFile" to constructor of pkgAcqFile so that it sends + the right cache control headers + * cmdline/apt-get.cc: + - fix crash when pkg.VersionList() is empty + * apt-pkg/depcache.cc: + - fix incorrect std::cout usage for debug output + * test/libapt/getlanguages_test.cc: + - Add test for Esperanto that has nocounty associated with them + (LP: #560956) + - -- Michael Vogt Tue, 04 May 2010 09:55:08 +0200 + -- David Kalnischkies Sat, 03 Apr 2010 14:58:39 +0200 apt (0.7.26~exp3) experimental; urgency=low