From 487802e2ce713ffda70f2911670772dad9c5e7d8 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 20 Sep 2008 16:55:27 +0000 Subject: More SRC_URI validation. svn path=/main/trunk/; revision=11526 --- pym/portage/dbapi/porttree.py | 4 ++++ pym/portage/tests/dep/test_src_uri.py | 3 +++ 2 files changed, 7 insertions(+) (limited to 'pym') diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 67e7955d4..33c8b52f2 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -68,6 +68,10 @@ 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] == "?": + raise portage.exception.InvalidDependString( + ("getFetchMap(): '%s' SRC_URI arrow missing " + \ + "right operand") % (cpv,)) uri = None operator = None diff --git a/pym/portage/tests/dep/test_src_uri.py b/pym/portage/tests/dep/test_src_uri.py index 3b9f08052..84c9f29b6 100644 --- a/pym/portage/tests/dep/test_src_uri.py +++ b/pym/portage/tests/dep/test_src_uri.py @@ -16,6 +16,9 @@ class SrcUri(TestCase): ( "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 -> 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", "foo? ( http://foo/bar -> ) blah.tbz2" , False ), -- cgit v1.2.3-1-g7c22