diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-06-13 06:40:39 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-13 06:40:39 -0700 |
commit | f5a31e2578699f0a0bb91269388702c90cbeab38 (patch) | |
tree | 2b44bb37194d3b15bef1fa4590fa7eb9f90575ad | |
parent | 19c9f21ecddc2ed7092e91a57fe219e3082aa18c (diff) | |
download | portage-f5a31e2578699f0a0bb91269388702c90cbeab38.tar.gz portage-f5a31e2578699f0a0bb91269388702c90cbeab38.tar.bz2 portage-f5a31e2578699f0a0bb91269388702c90cbeab38.zip |
digestgen: always allow fetch from mirror://
This fixes repoman and ebuild(1) to fetch from mirror:// URIs even
though RESTRICT=fetch is set (this behavior already works for emerge
since it does not call fetch() via digestgen).
-rw-r--r-- | pym/portage/package/ebuild/digestgen.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/pym/portage/package/ebuild/digestgen.py b/pym/portage/package/ebuild/digestgen.py index 9408b1456..2b9361de6 100644 --- a/pym/portage/package/ebuild/digestgen.py +++ b/pym/portage/package/ebuild/digestgen.py @@ -1,4 +1,4 @@ -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = ['digestgen'] @@ -106,6 +106,7 @@ def digestgen(myarchives=None, mysettings=None, myportdb=None): os.path.dirname(mysettings["O"]))) for myfile in missing_files: uris = set() + all_restrict = set() for cpv in distfiles_map[myfile]: uris.update(myportdb.getFetchMap( cpv, mytree=mytree)[myfile]) @@ -115,9 +116,19 @@ def digestgen(myarchives=None, mysettings=None, myportdb=None): # they don't apply unconditionally. Assume such # conditionals only apply on the client side where # digestgen() does not need to be called. - restrict = use_reduce(restrict, - flat=True, matchnone=True) - restrict_fetch = 'fetch' in restrict + all_restrict.update(use_reduce(restrict, + flat=True, matchnone=True)) + + # fetch() uses CATEGORY and PF to display a message + # when fetch restriction is triggered. + cat, pf = catsplit(cpv) + mysettings["CATEGORY"] = cat + mysettings["PF"] = pf + + # fetch() uses PORTAGE_RESTRICT to control fetch + # restriction, which is only applied to files that + # are not fetchable via a mirror:// URI. + mysettings["PORTAGE_RESTRICT"] = " ".join(all_restrict) try: st = os.stat(os.path.join( @@ -125,12 +136,9 @@ def digestgen(myarchives=None, mysettings=None, myportdb=None): except OSError: st = None - if restrict_fetch or \ - not fetch({myfile : uris}, mysettings): + if not fetch({myfile : uris}, mysettings): myebuild = os.path.join(mysettings["O"], catsplit(cpv)[1] + ".ebuild") - spawn_nofetch(myportdb, myebuild, - settings=mysettings) writemsg(_("!!! Fetch failed for %s, can't update " "Manifest\n") % myfile, noiselevel=-1) if myfile in dist_hashes and \ |