Explorar o código

* make it possible to fall back to other sources on fail in MediaChange events

Patches applied:

 * michael.vogt@ubuntu.com--2005/apt--cdrom-fallback--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-110

 * michael.vogt@ubuntu.com--2005/apt--cdrom-fallback--0--patch-1
   * initial patch to make falling back from cdrom possible

 * michael.vogt@ubuntu.com--2005/apt--cdrom-fallback--0--patch-2
   * fix in methods/cdrom.cc: don't call Fail() but return false so that apt can fallback to a differencent source

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-56
   * merged from apt--cdrom-fallback--0
Michael Vogt %!s(int64=21) %!d(string=hai) anos
pai
achega
db9df293ef
Modificáronse 4 ficheiros con 20 adicións e 7 borrados
  1. 1 1
      apt-pkg/acquire-method.cc
  2. 10 4
      cmdline/acqprogress.cc
  3. 8 0
      debian/changelog
  4. 1 2
      methods/cdrom.cc

+ 1 - 1
apt-pkg/acquire-method.cc

@@ -277,7 +277,7 @@ bool pkgAcqMethod::MediaFail(string Required,string Drive)
 	    MyMessages.erase(MyMessages.begin());
 	    MyMessages.erase(MyMessages.begin());
 	 }
 	 }
 
 
-	 return !StringToBool(LookupTag(Message,"Fail"),false);
+	 return !StringToBool(LookupTag(Message,"Failed"),false);
       }
       }
       
       
       Messages.push_back(Message);
       Messages.push_back(Message);

+ 10 - 4
cmdline/acqprogress.cc

@@ -274,10 +274,16 @@ bool AcqTextStatus::MediaChange(string Media,string Drive)
 	    Media.c_str(),Drive.c_str());
 	    Media.c_str(),Drive.c_str());
 
 
    char C = 0;
    char C = 0;
+   bool bStatus = true;
    while (C != '\n' && C != '\r')
    while (C != '\n' && C != '\r')
-      read(STDIN_FILENO,&C,1);
-   
-   Update = true;
-   return true;
+   {
+      int len = read(STDIN_FILENO,&C,1);
+      if(C == 'c' || len <= 0)
+	 bStatus = false;
+   }
+
+   if(bStatus)
+      Update = true;
+   return bStatus;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 8 - 0
debian/changelog

@@ -1,3 +1,11 @@
+apt (0.6.40.1ubuntu6) breezy; urgency=low
+
+  * Cherry picked michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-56:
+    - make it possible for apt to handle a failed MediaChange event and
+      fall back to other sources (ubuntu #13713)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Tue, 13 Sep 2005 22:09:50 +0200
+
 apt (0.6.40.1ubuntu5) breezy; urgency=low
 apt (0.6.40.1ubuntu5) breezy; urgency=low
 
 
   * Cherry picked michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-{50,51}.
   * Cherry picked michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-{50,51}.

+ 1 - 2
methods/cdrom.cc

@@ -166,8 +166,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
       if (MediaFail(Get.Host,CDROM) == false)
       if (MediaFail(Get.Host,CDROM) == false)
       {
       {
 	 CurrentID = "FAIL";
 	 CurrentID = "FAIL";
-	 Fail(_("Wrong CD-ROM"),true);
-	 return true;
+	 return _error->Error(_("Disk not found."));
       }
       }
    }
    }