Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10835 - main/trunk/bin
Date: Sat, 28 Jun 2008 21:54:37
Message-Id: E1KCiNL-0000FQ-WC@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-06-28 21:54:31 +0000 (Sat, 28 Jun 2008)
3 New Revision: 10835
4
5 Modified:
6 main/trunk/bin/portageq
7 Log:
8 Bug #229859 - Make portageq check atom validity when has_version() and
9 best_version() are called from inside the ebuild environment.
10
11
12 Modified: main/trunk/bin/portageq
13 ===================================================================
14 --- main/trunk/bin/portageq 2008-06-28 09:16:08 UTC (rev 10834)
15 +++ main/trunk/bin/portageq 2008-06-28 21:54:31 UTC (rev 10835)
16 @@ -51,6 +51,10 @@
17 if (len(argv) < 2):
18 print "ERROR: insufficient parameters!"
19 sys.exit(2)
20 + if atom_validate_strict and not portage.isvalidatom(argv[1]):
21 + portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
22 + noiselevel=-1)
23 + return 2
24 try:
25 mylist=portage.db[argv[0]]["vartree"].dbapi.match(argv[1])
26 if mylist:
27 @@ -69,6 +73,10 @@
28 if (len(argv) < 2):
29 print "ERROR: insufficient parameters!"
30 sys.exit(2)
31 + if atom_validate_strict and not portage.isvalidatom(argv[1]):
32 + portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
33 + noiselevel=-1)
34 + return 2
35 try:
36 mylist=portage.db[argv[0]]["vartree"].dbapi.match(argv[1])
37 print portage.best(mylist)
38 @@ -437,6 +445,8 @@
39 if (len(sys.argv) == 1):
40 print "\nRun portageq with --help for info"
41
42 +atom_validate_strict = "EBUILD_PHASE" in os.environ
43 +
44 def main():
45 if "-h" in sys.argv or "--help" in sys.argv:
46 usage(sys.argv)
47
48 --
49 gentoo-commits@l.g.o mailing list