Преглед изворни кода

* merge from the mvo branch

Michael Vogt пре 18 година
родитељ
комит
d2f3195a03
6 измењених фајлова са 62 додато и 18 уклоњено
  1. 2 2
      apt-pkg/depcache.h
  2. 21 13
      cmdline/apt-get.cc
  3. 26 0
      debian/apt.cron.daily
  4. 10 0
      debian/changelog
  5. 1 1
      doc/apt_preferences.5.xml
  6. 2 2
      methods/http.cc

+ 2 - 2
apt-pkg/depcache.h

@@ -92,7 +92,7 @@ class pkgDepCache : protected pkgCache::Namespace
     *  \param rootFunc A callback that can be used to add extra
     *  \param rootFunc A callback that can be used to add extra
     *  packages to the root set.
     *  packages to the root set.
     *
     *
-    *  \return \b false if an error occured.
+    *  \return \b false if an error occurred.
     */
     */
    bool MarkRequired(InRootSetFunc &rootFunc);
    bool MarkRequired(InRootSetFunc &rootFunc);
 
 
@@ -103,7 +103,7 @@ class pkgDepCache : protected pkgCache::Namespace
     *  are tested to see whether they are actually garbage.  If so,
     *  are tested to see whether they are actually garbage.  If so,
     *  they are marked as such.
     *  they are marked as such.
     *
     *
-    *  \return \b false if an error occured.
+    *  \return \b false if an error occurred.
     */
     */
    bool Sweep();
    bool Sweep();
 
 

+ 21 - 13
cmdline/apt-get.cc

@@ -1495,21 +1495,29 @@ bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix,
    
    
    bool found = false;
    bool found = false;
    bool res = true;
    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)
    if(!found)
       _error->Error(_("Couldn't find task %s"),taskname);
       _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"
       "  -d  Download only - do NOT install or unpack archives\n"
       "  -s  No-act. Perform ordering simulation\n"
       "  -s  No-act. Perform ordering simulation\n"
       "  -y  Assume Yes to all queries and do not prompt\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"
       "  -m  Attempt to continue if archives are unlocatable\n"
       "  -u  Show a list of upgraded packages as well\n"
       "  -u  Show a list of upgraded packages as well\n"
       "  -b  Build the source package after fetching it\n"
       "  -b  Build the source package after fetching it\n"

+ 26 - 0
debian/apt.cron.daily

@@ -147,6 +147,25 @@ check_size_constraints()
     fi
     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
 if ! which apt-config >/dev/null; then
 	exit 0
 	exit 0
 fi
 fi
@@ -179,6 +198,13 @@ if ! apt-get check -q -q 2>/dev/null; then
     exit 1
     exit 1
 fi
 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
 UPDATE_STAMP=/var/lib/apt/periodic/update-stamp
 if check_stamp $UPDATE_STAMP $UpdateInterval; then
 if check_stamp $UPDATE_STAMP $UpdateInterval; then

+ 10 - 0
debian/changelog

@@ -17,6 +17,16 @@ apt (0.7.12) UNRELEASED; urgency=low
       is run
       is run
   * methods/connect.cc:
   * methods/connect.cc:
     - remember hosts with Resolve failures or connect Timeouts
     - 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 ]
   [ Christian Perrier ]
   * Fix typos in manpages. Thanks to Daniel Leidert for the fixes
   * Fix typos in manpages. Thanks to Daniel Leidert for the fixes

+ 1 - 1
doc/apt_preferences.5.xml

@@ -184,7 +184,7 @@ belonging to any distribution whose Archive name is "<literal>unstable</literal>
 <programlisting>
 <programlisting>
 Package: *
 Package: *
 Pin: release a=unstable
 Pin: release a=unstable
-Pin-Priority: 500
+Pin-Priority: 50
 </programlisting>
 </programlisting>
 
 
 <simpara>The following record assigns a high priority to all package versions
 <simpara>The following record assigns a high priority to all package versions

+ 2 - 2
methods/http.cc

@@ -368,8 +368,8 @@ bool ServerState::Close()
 									/*}}}*/
 									/*}}}*/
 // ServerState::RunHeaders - Get the headers before the data		/*{{{*/
 // 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()
 int ServerState::RunHeaders()
 {
 {
    State = Header;
    State = Header;