summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/repoman4
-rw-r--r--pym/portage/dbapi/porttree.py74
-rw-r--r--pym/portage/package/ebuild/doebuild.py6
-rw-r--r--pym/portage/tests/dep/test_src_uri.py36
4 files changed, 10 insertions, 110 deletions
diff --git a/bin/repoman b/bin/repoman
index 24065805c..ffb435238 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -1445,7 +1445,9 @@ for x in scanlist:
if not src_uri_error:
# Check that URIs don't reference a server from thirdpartymirrors.
- for uri in portage.flatten(portage.dep.use_reduce(myaux["SRC_URI"], matchall=True)):
+ for uri in portage.flatten(portage.dep.use_reduce( \
+ myaux["SRC_URI"], matchall=True, is_src_uri=True, \
+ allow_src_uri_file_renames=(eapi not in ("0", "1")))):
contains_mirror = False
for mirror in thirdpartymirrors:
if uri.startswith(mirror):
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index f530b6170..886b765f7 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -10,7 +10,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.checksum',
'portage.data:portage_gid,secpass',
'portage.dbapi.dep_expand:dep_expand',
- 'portage.dep:dep_getkey,flatten,match_from_list,paren_reduce,use_reduce',
+ 'portage.dep:dep_getkey,flatten,match_from_list,use_reduce',
'portage.env.loaders:KeyValuePairFileLoader',
'portage.package.ebuild.doebuild:doebuild',
'portage.util:ensure_dirs,shlex_split,writemsg,writemsg_level',
@@ -49,73 +49,6 @@ if sys.hexversion >= 0x3000000:
basestring = str
long = int
-def _src_uri_validate(cpv, eapi, src_uri):
- """
- Take a SRC_URI structure as returned by paren_reduce or use_reduce
- and validate it. Raises InvalidDependString if a problem is detected,
- such as missing operand for a -> operator.
- """
- uri = None
- operator = None
- for x in src_uri:
- if isinstance(x, list):
- if operator is not None:
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI arrow missing " + \
- "right operand") % (cpv,))
- uri = None
- _src_uri_validate(cpv, eapi, x)
- continue
- if x == '||':
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI contains invalid " + \
- "|| operator") % (cpv,))
-
- if x[-1:] == "?":
- if operator is not None:
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI arrow missing " + \
- "right operand") % (cpv,))
- uri = None
- continue
- if uri is None:
- if x == "->":
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI arrow missing " + \
- "left operand") % (cpv,))
- uri = x
- continue
- if x == "->":
- if eapi in ("0", "1"):
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI arrows are not " + \
- "supported with EAPI='%s'") % (cpv, eapi))
- operator = x
- continue
- if operator is None:
- uri = x
- continue
-
- # This should be the right operand of an arrow operator.
- if "/" in x:
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI '/' character in " + \
- "file name: '%s'") % (cpv, x))
-
- if x[-1:] == "?":
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI arrow missing " + \
- "right operand") % (cpv,))
-
- # Found the right operand, so reset state.
- uri = None
- operator = None
-
- if operator is not None:
- raise portage.exception.InvalidDependString(
- "getFetchMap(): '%s' SRC_URI arrow missing right operand" % \
- (cpv,))
-
class _repo_info(object):
__slots__ = ('name', 'path', 'eclass_db', 'portdir', 'portdir_overlay')
def __init__(self, name, path, eclass_db):
@@ -742,9 +675,8 @@ class portdbapi(dbapi):
"getFetchMap(): '%s' has unsupported EAPI: '%s'" % \
(mypkg, eapi.lstrip("-")))
- _src_uri_validate(mypkg, eapi, paren_reduce(myuris))
- myuris = use_reduce(myuris, uselist=useflags,
- matchall=(useflags is None))
+ myuris = use_reduce(myuris, uselist=useflags, matchall=(useflags is None), \
+ is_src_uri=True, allow_src_uri_file_renames=(eapi not in ("0", "1")))
myuris = flatten(myuris)
uri_map = OrderedDict()
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 6ceafb0e1..f066df757 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1050,7 +1050,7 @@ def _validate_deps(mysettings, myroot, mydo, mydbapi):
set(["clean", "cleanrm", "help", "prerm", "postrm"])
dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
misc_keys = ["LICENSE", "PROPERTIES", "PROVIDE", "RESTRICT", "SRC_URI"]
- other_keys = ["SLOT"]
+ other_keys = ["SLOT", "EAPI"]
all_keys = dep_keys + misc_keys + other_keys
metadata = dict(zip(all_keys,
mydbapi.aux_get(mysettings.mycpv, all_keys)))
@@ -1070,9 +1070,11 @@ def _validate_deps(mysettings, myroot, mydo, mydbapi):
msgs.append(" %s: %s\n %s\n" % (
dep_type, metadata[dep_type], mycheck[1]))
+ eapi = metadata["EAPI"]
for k in misc_keys:
try:
- use_reduce(metadata[k], matchall=True)
+ use_reduce(metadata[k], matchall=True, is_src_uri=(k=="SRC_URI"), \
+ allow_src_uri_file_renames=(eapi not in ("0", "1")))
except InvalidDependString as e:
msgs.append(" %s: %s\n %s\n" % (
k, metadata[k], str(e)))
diff --git a/pym/portage/tests/dep/test_src_uri.py b/pym/portage/tests/dep/test_src_uri.py
deleted file mode 100644
index 45ba09bc2..000000000
--- a/pym/portage/tests/dep/test_src_uri.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from portage.tests import TestCase
-from portage.dep import paren_reduce
-from portage.dbapi.porttree import _src_uri_validate
-from portage.exception import InvalidDependString
-
-class SrcUri(TestCase):
-
- def testSrcUri(self):
-
- tests = [
- ( "0", "http://foo/bar -> blah.tbz2" , False ),
- ( "1", "http://foo/bar -> blah.tbz2" , False ),
- ( "2", "|| ( http://foo/bar -> blah.tbz2 )" , False ),
- ( "2", "http://foo/bar -> blah.tbz2" , True ),
- ( "2", "foo? ( http://foo/bar -> blah.tbz2 )" , True ),
- ( "2", "http://foo/bar -> foo? ( ftp://foo/a )" , False ),
- ( "2", "http://foo/bar -> bar.tbz2 foo? ( ftp://foo/a )" , True ),
- ( "2", "http://foo/bar blah.tbz2 ->" , False ),
- ( "2", "-> http://foo/bar blah.tbz2 )" , False ),
- ( "2", "http://foo/bar ->" , False ),
- ( "2", "http://foo/bar -> foo? ( http://foo.com/foo )" , False ),
- ( "2", "foo? ( http://foo/bar -> ) blah.tbz2" , False ),
- ( "2", "http://foo/bar -> foo/blah.tbz2" , False ),
- ( "2", "http://foo.com/foo http://foo/bar -> blah.tbz2" , True ),
- ]
-
- for eapi, src_uri, valid in tests:
- try:
- _src_uri_validate("cat/pkg-1", eapi, paren_reduce(src_uri))
- except InvalidDependString:
- self.assertEqual(valid, False)
- else:
- self.assertEqual(valid, True)