summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-27 08:01:56 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-27 08:01:56 +0000
commitcd8a3bfc31eaa3a8698cc1115493f0f51a70d64d (patch)
treeba6eedaf955c319ca6639220f5a99817351db398 /pym
parentb52d704e8894a72d7caefea40bbd3677ea0bd3e0 (diff)
downloadportage-cd8a3bfc31eaa3a8698cc1115493f0f51a70d64d.tar.gz
portage-cd8a3bfc31eaa3a8698cc1115493f0f51a70d64d.tar.bz2
portage-cd8a3bfc31eaa3a8698cc1115493f0f51a70d64d.zip
Allow fetch restricted files to be fetched from custom local mirrors as per bug #37455. This patch additionally allows a mirror:// uri to override fetch restriction, but only for the specified mirror (or a custom local mirror).
svn path=/main/trunk/; revision=4028
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py49
1 files changed, 25 insertions, 24 deletions
diff --git a/pym/portage.py b/pym/portage.py
index d282d75d3..663741e90 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1814,29 +1814,17 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
noiselevel=-1)
gotit=0
- if "fetch" in mysettings["RESTRICT"].split():
- # fetch is restricted. Ensure all files have already been downloaded; otherwise,
- # print message and exit.
- gotit=1
- for myuri in myuris:
- myfile=os.path.basename(myuri)
- try:
- mystat=os.stat(mysettings["DISTDIR"]+"/"+myfile)
- except (OSError,IOError),e:
- # file does not exist
- writemsg(_("!!! %(file)s not found in %(dir)s\n") % {"file":myfile, "dir":mysettings["DISTDIR"]},
- noiselevel=-1)
- gotit=0
- if not gotit:
- print
- print "!!!",mysettings["CATEGORY"]+"/"+mysettings["PF"],"has fetch restriction turned on."
- print "!!! This probably means that this ebuild's files must be downloaded"
- print "!!! manually. See the comments in the ebuild for more information."
- print
- spawn(EBUILD_SH_BINARY+" nofetch",mysettings)
- return 0
- return 1
- locations=mymirrors[:]
+ restrict_fetch = "fetch" in mysettings["RESTRICT"].split()
+ custom_local_mirrors = custommirrors.get("local", [])
+ if restrict_fetch:
+ # With fetch restriction, a normal uri may only be fetched from
+ # custom local mirrors (if available). A mirror:// uri may also
+ # be fetched from specific mirrors (effectively overriding fetch
+ # restriction, but only for specific mirrors).
+ locations = custom_local_mirrors
+ else:
+ locations = mymirrors
+
filedict={}
primaryuri_indexes={}
for myuri in myuris:
@@ -1880,6 +1868,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
writemsg("Invalid mirror definition in SRC_URI:\n", noiselevel=-1)
writemsg(" %s\n" % (myuri), noiselevel=-1)
else:
+ if restrict_fetch:
+ # Only fetch from specific mirrors is allowed.
+ continue
if "primaryuri" in mysettings["RESTRICT"].split():
# Use the source site first.
if primaryuri_indexes.has_key(myfile):
@@ -2144,8 +2135,18 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
if listonly:
writemsg("\n")
+ if fetched != 2 and restrict_fetch:
+ print "\n!!!", mysettings["CATEGORY"] + "/" + \
+ mysettings["PF"], "has fetch restriction turned on."
+ print "!!! This probably means that this " + \
+ "ebuild's files must be downloaded"
+ print "!!! manually. See the comments in" + \
+ " the ebuild for more information.\n"
+ spawn(EBUILD_SH_BINARY + " nofetch", mysettings)
if (fetched!=2) and not listonly:
- if not filedict[myfile]:
+ if restrict_fetch:
+ pass
+ elif not filedict[myfile]:
writemsg("Warning: No mirrors available for file" + \
" '%s'\n" % (myfile), noiselevel=-1)
else: