diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-03-11 07:45:11 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-03-11 07:45:11 +0000 |
commit | 6c9b84bd06a8511606d242f6124dc206670153c8 (patch) | |
tree | f278f949dfb4546cbe8b330fac7eb6443d7e7e0e | |
parent | 7a894c74f7efcb7d42e90d46a31578bd2e71c2e4 (diff) | |
download | portage-6c9b84bd06a8511606d242f6124dc206670153c8.tar.gz portage-6c9b84bd06a8511606d242f6124dc206670153c8.tar.bz2 portage-6c9b84bd06a8511606d242f6124dc206670153c8.zip |
Fix incorrect slice inside _src_uri_validate() and add new test case.
(trunk r12818)
svn path=/main/branches/2.1.6/; revision=13050
-rw-r--r-- | pym/portage/dbapi/porttree.py | 4 | ||||
-rw-r--r-- | pym/portage/tests/dep/test_src_uri.py | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 57bdd9984..8dcdf1b85 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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,)) diff --git a/pym/portage/tests/dep/test_src_uri.py b/pym/portage/tests/dep/test_src_uri.py index e53297968..499d1e295 100644 --- a/pym/portage/tests/dep/test_src_uri.py +++ b/pym/portage/tests/dep/test_src_uri.py @@ -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 ), |