* apt-pkg/acquire-item.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Mon, 5 Feb 2007 18:06:42 +0000 (19:06 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Mon, 5 Feb 2007 18:06:42 +0000 (19:06 +0100)
  - use FailReason in pkgAcquire::Item::Failed when available
* methods/mirror.cc:
  - move some debug output into if(Debug)

apt-pkg/acquire-item.cc
cmdline/apt-report-mirror-failure
methods/mirror.cc
po/apt-all.pot

index 08a029f..14610d6 100644 (file)
@@ -82,7 +82,11 @@ void pkgAcquire::Item::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    }   
    
    // report mirror failure back to LP if we actually use a mirror
-   ReportMirrorFailure(ErrorText);
+   string FailReason = LookupTag(Message, "FailReason");
+   if(FailReason.size() != 0)
+      ReportMirrorFailure(FailReason);
+   else
+      ReportMirrorFailure(ErrorText);
 }
                                                                        /*}}}*/
 // Acquire::Item::Start - Item has begun to download                   /*{{{*/
@@ -155,6 +159,7 @@ void pkgAcquire::Item::ReportMirrorFailure(string FailCode)
       return;
    Args[i++] = report.c_str();
    Args[i++] = UsedMirror.c_str();
+   Args[i++] = DescURI().c_str();
    Args[i++] = FailCode.c_str();
    Args[i++] = NULL;
    pid_t pid = ExecFork();
index 277b23e..fb43f0e 100755 (executable)
@@ -14,8 +14,9 @@ if not url:
 print "Reporting mirror failure to '%s'" % url
 
 data = {}
-data['url'] = sys.argv[1]
-data['error'] = sys.argv[2]
+data['mirror'] = sys.argv[1]
+data['failurl'] = sys.argv[2]
+data['error'] = sys.argv[3]
 f = urllib.urlopen(url, urllib.urlencode(data))
 f.read()
 f.close()
index ff91130..c5c0c74 100644 (file)
@@ -143,7 +143,8 @@ bool MirrorMethod::GetMirrorFile(string mirror_uri_str)
    in both cases! So we need to apply some domain knowledge here :( and
    check for /dists/ or /Release.gpg as suffixes
    */
-   std::cerr << "GetMirrorFile: " << mirror_uri_str << std::endl;
+   if(Debug)
+      std::cerr << "GetMirrorFile: " << mirror_uri_str << std::endl;
 
    // read sources.list and find match
    vector<metaIndex *>::const_iterator I;
@@ -152,13 +153,15 @@ bool MirrorMethod::GetMirrorFile(string mirror_uri_str)
    for(I=list.begin(); I != list.end(); I++)
    {
       string uristr = (*I)->GetURI();
-      std::cerr << "Checking: " << uristr << std::endl;
+      if(Debug)
+        std::cerr << "Checking: " << uristr << std::endl;
       if(uristr.substr(0,strlen("mirror://")) != string("mirror://"))
         continue;
       // find matching uri in sources.list
       if(mirror_uri_str.substr(0,uristr.size()) == uristr)
       {
-        std::cerr << "found BaseURI: " << uristr << std::endl;
+        if(Debug)
+           std::cerr << "found BaseURI: " << uristr << std::endl;
         BaseUri = uristr.substr(0,uristr.size()-1);
       }
    }
index 8fa68d2..2355eee 100644 (file)
@@ -1330,7 +1330,7 @@ msgstr ""
 
 #: apt-inst/extract.cc:467 apt-pkg/contrib/configuration.cc:750
 #: apt-pkg/contrib/cdromutl.cc:153 apt-pkg/sourcelist.cc:324
-#: apt-pkg/acquire.cc:421 apt-pkg/clean.cc:38 methods/mirror.cc:90
+#: apt-pkg/acquire.cc:421 apt-pkg/clean.cc:38 methods/mirror.cc:81
 #, c-format
 msgid "Unable to read %s"
 msgstr ""
@@ -1956,7 +1956,7 @@ msgid "Unable to stat the mount point %s"
 msgstr ""
 
 #: apt-pkg/contrib/cdromutl.cc:149 apt-pkg/acquire.cc:427 apt-pkg/clean.cc:44
-#: methods/mirror.cc:96
+#: methods/mirror.cc:87
 #, c-format
 msgid "Unable to change to %s"
 msgstr ""
@@ -2357,40 +2357,40 @@ msgstr ""
 msgid "IO Error saving source cache"
 msgstr ""
 
-#: apt-pkg/acquire-item.cc:130
+#: apt-pkg/acquire-item.cc:134
 #, c-format
 msgid "rename failed, %s (%s -> %s)."
 msgstr ""
 
-#: apt-pkg/acquire-item.cc:281 apt-pkg/acquire-item.cc:992
+#: apt-pkg/acquire-item.cc:286 apt-pkg/acquire-item.cc:997
 msgid "MD5Sum mismatch"
 msgstr ""
 
-#: apt-pkg/acquire-item.cc:686
+#: apt-pkg/acquire-item.cc:691
 msgid "There is no public key available for the following key IDs:\n"
 msgstr ""
 
-#: apt-pkg/acquire-item.cc:800
+#: apt-pkg/acquire-item.cc:805
 #, c-format
 msgid ""
 "I wasn't able to locate a file for the %s package. This might mean you need "
 "to manually fix this package. (due to missing arch)"
 msgstr ""
 
-#: apt-pkg/acquire-item.cc:859
+#: apt-pkg/acquire-item.cc:864
 #, c-format
 msgid ""
 "I wasn't able to locate file for the %s package. This might mean you need to "
 "manually fix this package."
 msgstr ""
 
-#: apt-pkg/acquire-item.cc:895
+#: apt-pkg/acquire-item.cc:900
 #, c-format
 msgid ""
 "The package index files are corrupted. No Filename: field for package %s."
 msgstr ""
 
-#: apt-pkg/acquire-item.cc:982
+#: apt-pkg/acquire-item.cc:987
 msgid "Size mismatch"
 msgstr ""