"supported with EAPI='%s'") % (cpv, eapi))
operator = x
continue
+ if operator is not None:
+ if "/" in x:
+ raise portage.exception.InvalidDependString(
+ ("getFetchMap(): '%s' SRC_URI '/' character in " + \
+ "file name: '%s'") % (cpv, x))
uri = None
operator = None
if myuris:
continue
if token == "->":
- if eapi in ("0", "1"):
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI arrows are not " + \
- "supported with EAPI='%s'") % (mypkg, eapi))
-
operator = token
continue
if operator is None:
"name: '%s'") % (mypkg, uri))
else:
distfile = token
- if "/" in distfile:
- raise portage.exception.InvalidDependString(
- ("getFetchMap(): '%s' SRC_URI '/' character in " + \
- "file name: '%s'") % (mypkg, distfile))
+
uri_set = uri_map.get(distfile)
if uri_set is None:
uri_set = set()
--- /dev/null
+# Copyright 2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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" , True ),
+ ( "2", "foo? ( http://foo/bar -> blah.tbz2 )" , True ),
+ ( "2", "-> http://foo/bar blah.tbz2 )" , False ),
+ ( "2", "http://foo/bar ->" , False ),
+ ( "2", "foo? ( http://foo/bar -> ) blah.tbz2" , False ),
+ ( "2", "http://foo/bar -> foo/blah.tbz2" , False ),
+ ]
+
+ 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)