summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-28 21:54:31 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-28 21:54:31 +0000
commiteb3e73c9ade89a7f9d59664c4869fa8a278b095e (patch)
tree208f57cced7fed6b700bf67c5bdea4b97ffe1e37 /bin/portageq
parentUse the EbuildMerge class instead of portage.merge(). (diff)
downloadportage-multirepo-eb3e73c9ade89a7f9d59664c4869fa8a278b095e.tar.gz
portage-multirepo-eb3e73c9ade89a7f9d59664c4869fa8a278b095e.tar.bz2
portage-multirepo-eb3e73c9ade89a7f9d59664c4869fa8a278b095e.zip
Bug #229859 - Make portageq check atom validity when has_version() and
best_version() are called from inside the ebuild environment. svn path=/main/trunk/; revision=10835
Diffstat (limited to 'bin/portageq')
-rwxr-xr-xbin/portageq10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/portageq b/bin/portageq
index 04e65c8e..b7cd1186 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -51,6 +51,10 @@ def has_version(argv):
if (len(argv) < 2):
print "ERROR: insufficient parameters!"
sys.exit(2)
+ if atom_validate_strict and not portage.isvalidatom(argv[1]):
+ portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
+ noiselevel=-1)
+ return 2
try:
mylist=portage.db[argv[0]]["vartree"].dbapi.match(argv[1])
if mylist:
@@ -69,6 +73,10 @@ def best_version(argv):
if (len(argv) < 2):
print "ERROR: insufficient parameters!"
sys.exit(2)
+ if atom_validate_strict and not portage.isvalidatom(argv[1]):
+ portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
+ noiselevel=-1)
+ return 2
try:
mylist=portage.db[argv[0]]["vartree"].dbapi.match(argv[1])
print portage.best(mylist)
@@ -437,6 +445,8 @@ def usage(argv):
if (len(sys.argv) == 1):
print "\nRun portageq with --help for info"
+atom_validate_strict = "EBUILD_PHASE" in os.environ
+
def main():
if "-h" in sys.argv or "--help" in sys.argv:
usage(sys.argv)