Fix incorrect slice inside _src_uri_validate() and add new test case.
authorZac Medico <zmedico@gentoo.org>
Tue, 10 Mar 2009 05:04:33 +0000 (05:04 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 10 Mar 2009 05:04:33 +0000 (05:04 -0000)
svn path=/main/trunk/; revision=12818

pym/portage/dbapi/porttree.py
pym/portage/tests/dep/test_src_uri.py

index 57bdd9984ecab080c67217abe3e9a851231aad7c..8dcdf1b85454a5d58ce0be54a2b4288b05906bfe 100644 (file)
@@ -45,7 +45,7 @@ def _src_uri_validate(cpv, eapi, src_uri):
                        uri = None
                        _src_uri_validate(cpv, eapi, x)
                        continue
-               if x[:-1] == "?":
+               if x[-1:] == "?":
                        if operator is not None:
                                raise portage.exception.InvalidDependString(
                                        ("getFetchMap(): '%s' SRC_URI arrow missing " + \
@@ -74,7 +74,7 @@ def _src_uri_validate(cpv, eapi, src_uri):
                                raise portage.exception.InvalidDependString(
                                        ("getFetchMap(): '%s' SRC_URI '/' character in " + \
                                        "file name: '%s'") % (cpv, x))
-                       if x[-1] == "?":
+                       if x[-1:] == "?":
                                raise portage.exception.InvalidDependString(
                                        ("getFetchMap(): '%s' SRC_URI arrow missing " + \
                                        "right operand") % (cpv,))
index e53297968c540636ae4255fb620f33e22ec648c0..499d1e295bfd063d6113b6cb8047b02924badba8 100644 (file)
@@ -21,6 +21,7 @@ class SrcUri(TestCase):
                        ( "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  ),