]> git.saurik.com Git - apt.git/commitdiff
* methods/mirror.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Thu, 19 Mar 2009 14:42:25 +0000 (15:42 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Thu, 19 Mar 2009 14:42:25 +0000 (15:42 +0100)
  - when download the mirror file and the server is down,
    return a propper error message (LP: #278635)

cmdline/apt-report-mirror-failure
debian/changelog
methods/mirror.cc

index 1567e78e30f751b8abe8e7c627154f8817e7e95e..ef77d4954e14710e28878a2c32e3aae51cf0790c 100755 (executable)
@@ -5,7 +5,7 @@ import urllib
 import apt_pkg
 
 apt_pkg.init()
-url = apt_pkg.Config.Find("Acquire::Mirror::ReportFailures", None)
+url = apt_pkg.Config.Find("Acquire::Mirror::ReportFailures", "")
                           #"http://people.ubuntu.com:9000/mirror-failure")
                           #"http://localhost:9000/mirror-failure")
 if not url:
index bef5c3cad5e85bdd08137d810a874f615b123f96..5a764383e18801ec63a5a73474bb042713b2eb0b 100644 (file)
@@ -1,3 +1,11 @@
+apt (0.7.20.2ubuntu3) jaunty; urgency=low
+
+  * methods/mirror.cc:
+    - when download the mirror file and the server is down,
+      return a propper error message (LP: #278635)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Thu, 19 Mar 2009 15:42:15 +0100
+
 apt (0.7.20.2ubuntu2) jaunty; urgency=low
 
   * apt-pkg/deb/dpkgpm.cc:
index bdd783cc77bf6a26fae05ac50edb36024df4b54c..b3a956b95488f87adf56d1c7a0030ccbf76db604 100644 (file)
@@ -123,6 +123,8 @@ bool MirrorMethod::Clean(string Dir)
 
 bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
 {
+   if(Debug)
+      clog << "MirrorMethod::DownloadMirrorFile(): " << endl;
 
    // check the file, if it is not older than RefreshInterval just use it
    // otherwise try to get a new one
@@ -251,6 +253,9 @@ string MirrorMethod::GetMirrorFileName(string mirror_uri_str)
    depth. */
 bool MirrorMethod::Fetch(FetchItem *Itm)
 {
+   if(Debug)
+      clog << "MirrorMethod::Fetch()" << endl;
+
    // the http method uses Fetch(0) as a way to update the pipeline,
    // just let it do its work in this case - Fetch() with a valid
    // Itm will always run before the first Fetch(0)
@@ -269,8 +274,17 @@ bool MirrorMethod::Fetch(FetchItem *Itm)
       DownloadMirrorFile(Itm->Uri);
    }
 
-   if(Mirror.empty())
-      SelectMirror();
+   if(Mirror.empty()) {
+      if(!SelectMirror()) {
+        // no valid mirror selected, something went wrong downloading
+        // from the master mirror site most likely and there is
+        // no old mirror file availalbe
+        return false;
+      }
+   }
+   if(Debug)
+      clog << "selected mirror: " << Mirror << endl;
+
 
    for (FetchItem *I = Queue; I != 0; I = I->Next)
    {