Fix fetch() mirror:// handling in to comply with section 9.2.8 of PMS.
authorZac Medico <zmedico@gentoo.org>
Wed, 24 Sep 2008 19:09:07 +0000 (19:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 24 Sep 2008 19:09:07 +0000 (19:09 -0000)
svn path=/main/trunk/; revision=11537

pym/portage/__init__.py

index 4e88931d7c3804aa0e80787617ea8085c20f813a..dcd399f243a93664001c167e0e7161d09a49a348 100644 (file)
@@ -3508,11 +3508,19 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                        eidx = myuri.find("/", 9)
                        if eidx != -1:
                                mirrorname = myuri[9:eidx]
+                               if myfile != os.path.basename(myuri):
+                                       # If a SRC_URI arrow is used together with
+                                       # mirror://, preserve the remote path that's
+                                       # specified within the uri.
+                                       path = myuri[eidx+1:]
+                               else:
+                                       path = myfile
 
                                # Try user-defined mirrors first
                                if mirrorname in custommirrors:
                                        for cmirr in custommirrors[mirrorname]:
-                                               filedict[myfile].append(cmirr+"/"+myuri[eidx+1:])
+                                               filedict[myfile].append(
+                                                       cmirr.rstrip("/") + "/" + path)
                                                # remove the mirrors we tried from the list of official mirrors
                                                if cmirr.strip() in thirdpartymirrors[mirrorname]:
                                                        thirdpartymirrors[mirrorname].remove(cmirr)
@@ -3521,7 +3529,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                                        shuffle(thirdpartymirrors[mirrorname])
 
                                        for locmirr in thirdpartymirrors[mirrorname]:
-                                               filedict[myfile].append(locmirr+"/"+myuri[eidx+1:])
+                                               filedict[myfile].append(
+                                                       locmirr.rstrip("/") + "/" + path)
 
                                if not filedict[myfile]:
                                        writemsg("No known mirror by the name: %s\n" % (mirrorname))