]> git.saurik.com Git - apt.git/commitdiff
make the mirror failures actually produce a error message
authorMichael Vogt <egon@tas>
Wed, 24 Jan 2007 13:42:17 +0000 (14:42 +0100)
committerMichael Vogt <egon@tas>
Wed, 24 Jan 2007 13:42:17 +0000 (14:42 +0100)
cmdline/makefile
cmdline/report-mirror-failure [deleted file]
configure.in
debian/changelog
methods/mirror.cc
po/apt-all.pot

index 882a0e1b564a9d8125225e6a92b1f961a874392b..f07c7da3bf1ce521afeacea4970c4a868a6e4542 100644 (file)
@@ -52,3 +52,9 @@ SOURCE=apt-key
 TO=$(BIN)
 TARGET=program
 include $(COPY_H)
+
+# The apt-key program
+SOURCE=apt-report-mirror-failure
+TO=$(LIB)
+TARGET=program
+include $(COPY_H)
diff --git a/cmdline/report-mirror-failure b/cmdline/report-mirror-failure
deleted file mode 100755 (executable)
index 8301ed0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import urllib
-import apt_pkg
-
-apt_pkg.init()
-url = apt_pkg.Config.Find("Acquire::Mirror::ReportFailures",
-                          "http://people.ubuntu.com:9000/mirror-failure")
-                          #"http://localhost:9000/mirror-failure")
-if not url:
-    sys.exit(0)
-
-data = {}
-data['url'] = sys.argv[1]
-data['error'] = sys.argv[2]
-f = urllib.urlopen(url, urllib.urlencode(data))
-f.read()
-f.close()
-
-
index 81f327c378ff03c8810151861adbcf47ed6d0630..df452ba34b2e6e4c8f288b5b74b90c8747fd3e20 100644 (file)
@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.46.3")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.46.4")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)
index 24e10dcd5465f525e7b98276ee344e639753c907..6c9ada3a5046ae921a39f5218bc092dcb97f7689 100644 (file)
@@ -2,7 +2,7 @@ apt (0.6.46.4) unstable; urgency=low
 
   * add apt-secure.8 to "See also" section
 
- --
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 24 Jan 2007 14:34:15 +0100
 
 apt (0.6.46.3) unstable; urgency=low
 
index 6621d47e2686d738d594938ae42dd0c972158d79..8f9b8ed343014396848e1cbd0ef92db23a2aa588 100644 (file)
@@ -30,13 +30,18 @@ using namespace std;
 #include "apti18n.h"
                                                                        /*}}}*/
 
-/* 
+/* Done:
+ * - works with http only
+ * - always picks the first mirror from the list
+ * - call out to problem reporting script
+ * - supports "deb mirror://host/path/to/mirror-list/// dist component"
+ * 
  * TODO: 
- * - what about gpgv  failures? better standard format for errors
-     to send back to LP
-   #OR#
- * - implement it at the pkgAcquire::Item::Failed() level but then
-     we need to send back what uri exactly was failing 
+ * what about gpgv  failures? this should call-out to the problem reporting
+   script, but we need to know what mirror was used
+ * better standard format for errors to send back 
+ * - implement failure reporting  at the pkgAcquire::Item::Failed() level 
+     but then we need to send back what uri exactly was failing 
      [mvo: the problem with this approach is ::Failed() is not really
            called for all failures :/ e.g. md5sum mismatch in a archive
            is not]
@@ -46,6 +51,7 @@ using namespace std;
  * - magicmarker is (a bit) evil, maybe just use a similar approach as in
      clean and read the sources.list and use the GetURI() method to find
      the prefix?
+ * support more than http
  * - testing :)
  */
 
@@ -243,16 +249,34 @@ void MirrorMethod::URIDone(FetchResult &Res,FetchResult *Alt)
 void MirrorMethod::ReportMirrorFailure(string FailCode)
 {
    // report that Queue->Uri failed
+#if 0
    std::cerr << "\nReportMirrorFailure: " 
             << Queue->Uri
             << " FailCode: " 
             << FailCode << std::endl;
-#if 0 // FIXME: do not use system, make sure to properly encode
-      //        URI/FailCode, do not hardcode the submit url
-   system("curl -d url=" + Queue->Uri + 
-         " -d FailureCode=" + FailCode + 
-         " http://localhost:8000/ &");
 #endif
+   const char *Args[40];
+   unsigned int i = 0;
+   string report = _config->Find("Methods::Mirror::ProblemReporting", 
+                                "/usr/lib/apt/report-mirror-failure");
+   Args[i++] = report.c_str();
+   Args[i++] = Queue->Uri.c_str();
+   Args[i++] = FailCode.c_str();
+   pid_t pid = ExecFork();
+   if(pid < 0) 
+   {
+      _error->Error("ReportMirrorFailure Fork failed");
+      return;
+   }
+   else if(pid == 0) 
+   {
+      execvp(report.c_str(), (char**)Args);
+   }
+   if(!ExecWait(pid, "report-mirror-failure")) 
+   {
+      _error->Warning("Couldn't report problem to '%s'",
+                     _config->Find("Acquire::Mirror::ReportFailures").c_str());
+   }
 }
 
 int main()
index aee5c09c8aacdbd1af4a29caf89f4caf883b4326..dd140bd639b5629e57fe3dc2aa4b689413b8ec2f 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-11-24 16:37+0100\n"
+"POT-Creation-Date: 2007-01-24 12:51+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -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:92
+#: apt-pkg/acquire.cc:421 apt-pkg/clean.cc:38 methods/mirror.cc:96
 #, 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:98
+#: methods/mirror.cc:102
 #, c-format
 msgid "Unable to change to %s"
 msgstr ""