* methods/mirror.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Thu, 11 Aug 2011 14:30:17 +0000 (16:30 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Thu, 11 Aug 2011 14:30:17 +0000 (16:30 +0200)
  - include the architecture(s) in the query string as well so
    that the server can make better decisions

debian/changelog
methods/mirror.cc

index db80c14..3d9bdb3 100644 (file)
@@ -12,6 +12,9 @@ apt (0.8.16~exp5) experimental; urgency=low
       like the translations index
   * apt-pkg/acquire.cc:
     - fix potential divide-by-zero
+  * methods/mirror.cc:
+    - include the architecture(s) in the query string as well so 
+      that the server can make better decisions
 
  -- Michael Vogt <mvo@debian.org>  Fri, 05 Aug 2011 10:57:08 +0200
 
index 713dc21..7f28c04 100644 (file)
@@ -8,6 +8,7 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/acquire-item.h>
@@ -134,9 +135,24 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
    string fetch = BaseUri;
    fetch.replace(0,strlen("mirror://"),"http://");
 
+#if 0 // no need for this, the getArchitectures() will also include the main 
+      // arch
+   // append main architecture
+   fetch += "?arch=" + _config->Find("Apt::Architecture");
+#endif
+
+   // append all architectures
+   std::vector<std::string> vec = APT::Configuration::getArchitectures();
+   for (std::vector<std::string>::const_iterator I = vec.begin();
+        I != vec.end(); I++)
+      if (I == vec.begin())
+         fetch += "?arch" + (*I);
+      else
+         fetch += "&arch=" + (*I);
+
    // append the dist as a query string
    if (Dist != "")
-      fetch += "?dist=" + Dist;
+      fetch += "&dist=" + Dist;
 
    if(Debug)
       clog << "MirrorMethod::DownloadMirrorFile(): '" << fetch << "'"