summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <egon@tas>2007-01-24 14:42:17 +0100
committerMichael Vogt <egon@tas>2007-01-24 14:42:17 +0100
commit362d29343e5d25248bcd84300aa1b18effe891e7 (patch)
treec00a61e7e519e7b3d43bf7ba794c54e6e5c7d06d
parentb47081521b0df1f835a2111254fa1fcd77240a85 (diff)
make the mirror failures actually produce a error message
-rw-r--r--cmdline/makefile6
-rwxr-xr-xcmdline/report-mirror-failure21
-rw-r--r--configure.in2
-rw-r--r--debian/changelog2
-rw-r--r--methods/mirror.cc46
-rw-r--r--po/apt-all.pot6
6 files changed, 46 insertions, 37 deletions
diff --git a/cmdline/makefile b/cmdline/makefile
index 882a0e1b5..f07c7da3b 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -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
index 8301ed079..000000000
--- a/cmdline/report-mirror-failure
+++ /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()
-
-
diff --git a/configure.in b/configure.in
index 81f327c37..df452ba34 100644
--- a/configure.in
+++ b/configure.in
@@ -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)
diff --git a/debian/changelog b/debian/changelog
index 24e10dcd5..6c9ada3a5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/methods/mirror.cc b/methods/mirror.cc
index 6621d47e2..8f9b8ed34 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -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()
diff --git a/po/apt-all.pot b/po/apt-all.pot
index aee5c09c8..dd140bd63 100644
--- a/po/apt-all.pot
+++ b/po/apt-all.pot
@@ -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 ""