diff options
-rw-r--r-- | apt-pkg/depcache.h | 4 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 34 | ||||
-rw-r--r-- | debian/apt.cron.daily | 26 | ||||
-rw-r--r-- | debian/changelog | 10 | ||||
-rw-r--r-- | doc/apt_preferences.5.xml | 2 | ||||
-rw-r--r-- | methods/http.cc | 4 |
6 files changed, 62 insertions, 18 deletions
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 7adf6fe7f..f41ad17e9 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -92,7 +92,7 @@ class pkgDepCache : protected pkgCache::Namespace * \param rootFunc A callback that can be used to add extra * packages to the root set. * - * \return \b false if an error occured. + * \return \b false if an error occurred. */ bool MarkRequired(InRootSetFunc &rootFunc); @@ -103,7 +103,7 @@ class pkgDepCache : protected pkgCache::Namespace * are tested to see whether they are actually garbage. If so, * they are marked as such. * - * \return \b false if an error occured. + * \return \b false if an error occurred. */ bool Sweep(); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index be194f2db..92a263e50 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1495,21 +1495,29 @@ bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix, bool found = false; bool res = true; - for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++) + + // two runs, first ignore dependencies, second install any missing + for(int IgnoreBroken=1; IgnoreBroken >= 0; IgnoreBroken--) { - pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache); - if(ver.end()) - continue; - pkgRecords::Parser &parser = Recs.Lookup(ver.FileList()); - parser.GetRec(start,end); - strncpy(buf, start, end-start); - buf[end-start] = 0x0; - if (regexec(&Pattern,buf,0,0,0) != 0) - continue; - res &= TryToInstall(Pkg,Cache,Fix,Remove,false,ExpectedInst); - found = true; + for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++) + { + pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache); + if(ver.end()) + continue; + pkgRecords::Parser &parser = Recs.Lookup(ver.FileList()); + parser.GetRec(start,end); + strncpy(buf, start, end-start); + buf[end-start] = 0x0; + if (regexec(&Pattern,buf,0,0,0) != 0) + continue; + res &= TryToInstall(Pkg,Cache,Fix,Remove,IgnoreBroken,ExpectedInst); + found = true; + } } + // now let the problem resolver deal with any issues + Fix.Resolve(true); + if(!found) _error->Error(_("Couldn't find task %s"),taskname); @@ -2635,7 +2643,7 @@ bool ShowHelp(CommandLine &CmdL) " -d Download only - do NOT install or unpack archives\n" " -s No-act. Perform ordering simulation\n" " -y Assume Yes to all queries and do not prompt\n" - " -f Attempt to continue if the integrity check fails\n" + " -f Attempt to correct a system with broken dependencies in place\n" " -m Attempt to continue if archives are unlocatable\n" " -u Show a list of upgraded packages as well\n" " -b Build the source package after fetching it\n" diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily index 7af689e1f..ec53a7f2f 100644 --- a/debian/apt.cron.daily +++ b/debian/apt.cron.daily @@ -147,6 +147,25 @@ check_size_constraints() fi } +# sleep for a random intervall of time (default 30min) +# (some code taken from cron-apt, thanks) +random_sleep() +{ + RandomSleep=1800 + eval $(apt-config shell RandomSleep APT::Periodic::RandomSleep) + if [ $RandomSleep -eq 0 ]; then + return + fi + if [ -z "$RANDOM" ] ; then + # A fix for shells that do not have this bash feature. + RANDOM=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5") + fi + TIME=$(($RANDOM % $RandomSleep)) + sleep $TIME +} + +# main + if ! which apt-config >/dev/null; then exit 0 fi @@ -179,6 +198,13 @@ if ! apt-get check -q -q 2>/dev/null; then exit 1 fi +# sleep random amount of time +random_sleep + +# check again if we can access the cache +if ! apt-get check -q -q 2>/dev/null; then + exit 1 +fi UPDATE_STAMP=/var/lib/apt/periodic/update-stamp if check_stamp $UPDATE_STAMP $UpdateInterval; then diff --git a/debian/changelog b/debian/changelog index 4b0195979..ff2d56cc6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,16 @@ apt (0.7.12) UNRELEASED; urgency=low is run * methods/connect.cc: - remember hosts with Resolve failures or connect Timeouts + * cmdline/apt-get.cc: + - fix incorrect help output for -f (LP: #57487) + - do two passes when installing tasks, first ignoring dependencies, + then resolving them and run the problemResolver at the end + so that it can correct any missing dependencies + * debian/apt.cron.daily: + - sleep random amount of time (default within 0-30min) before + starting the upate to hit the mirrors less hard + * doc/apt_preferences.5.xml: + - fix typo [ Christian Perrier ] * Fix typos in manpages. Thanks to Daniel Leidert for the fixes diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml index 3f8d4568d..c55bb4ee2 100644 --- a/doc/apt_preferences.5.xml +++ b/doc/apt_preferences.5.xml @@ -184,7 +184,7 @@ belonging to any distribution whose Archive name is "<literal>unstable</literal> <programlisting> Package: * Pin: release a=unstable -Pin-Priority: 500 +Pin-Priority: 50 </programlisting> <simpara>The following record assigns a high priority to all package versions diff --git a/methods/http.cc b/methods/http.cc index d4e231fbe..26d435dea 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -368,8 +368,8 @@ bool ServerState::Close() /*}}}*/ // ServerState::RunHeaders - Get the headers before the data /*{{{*/ // --------------------------------------------------------------------- -/* Returns 0 if things are OK, 1 if an IO error occursed and 2 if a header - parse error occured */ +/* Returns 0 if things are OK, 1 if an IO error occurred and 2 if a header + parse error occurred */ int ServerState::RunHeaders() { State = Header; |