diff options
author | Brian Harring <ferringb@gentoo.org> | 2006-01-05 08:10:29 +0000 |
---|---|---|
committer | Brian Harring <ferringb@gentoo.org> | 2006-01-05 08:10:29 +0000 |
commit | afd26ffa8819f1a61a3a41ee5a549f254363b153 (patch) | |
tree | fe3681ed4cfb30587cc9929b1642308eb25f5959 | |
parent | cd100c39ccd92064ae74fceecf0872614d00039c (diff) | |
download | portage-afd26ffa8819f1a61a3a41ee5a549f254363b153.tar.gz portage-afd26ffa8819f1a61a3a41ee5a549f254363b153.tar.bz2 portage-afd26ffa8819f1a61a3a41ee5a549f254363b153.zip |
bug 42299, detect and fail invalid atoms in *DEPEND
svn path=/main/trunk/; revision=2532
-rwxr-xr-x | bin/repoman | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/bin/repoman b/bin/repoman index bc7c80924..19e0c430d 100755 --- a/bin/repoman +++ b/bin/repoman @@ -959,12 +959,12 @@ for x in scanlist: badlicsyntax = False badprovsyntax = False catpkg = catdir+"/"+y + type_list, badsyntax = [], [] for mytype in ("DEPEND", "RDEPEND", "PDEPEND", "LICENSE", "PROVIDE"): mydepstr = myaux[mytype] - badsyntax = None if (string.find(mydepstr, " ?") != -1): - badsyntax = "'?' preceded by space" + badsyntax.append("'?' preceded by space") try: # Missing closing parenthesis will result in a ValueError @@ -973,7 +973,7 @@ for x in scanlist: if "" in mydeplist or "(" in mydeplist: raise ValueError except ValueError: - badsyntax = "parenthesis mismatch" + badsyntax.append("parenthesis mismatch") for token in ("||", "(", ")"): if mydepstr.startswith(token+" "): @@ -985,22 +985,25 @@ for x in scanlist: while myteststr.find(" "+token+" ") != -1: myteststr = " ".join(myteststr.split(" "+token+" ", 1)) if myteststr.find(token) != -1: - print mydepstr - print myteststr - print token - badsyntax = "'%s' not separated by space" % (token) - break + badsyntax.append("'%s' not separated by space" % (token)) - if badsyntax: - stats[mytype+".syntax"] += 1 - fails[mytype+".syntax"].append(catpkg+".ebuild "+mytype+": "+badsyntax) - if mytype == "LICENSE": - badlicsyntax = True - elif mytype == "PROVIDE": - badprovsyntax = True - else: - baddepsyntax = True - continue + + if mytype in ("DEPEND", "RDEPEND", "PDEPEND"): + for token in filter(lambda x: not (x.endswith("?") or x.strip() in ("||", "&&")), mydepstr.split()): + if not "/" in token: + badsyntax.append("'%s' not a valid atom" % token) + + type_list.extend([mytype] * (len(badsyntax) - len(type_list))) + + for m,b in zip(type_list, badsyntax): + stats[m+".syntax"] += 1 + fails[m+".syntax"].append(catpkg+".ebuild "+m+": "+b) + + badlicsyntax = len(filter(lambda x:x=="LICENSE", type_list)) + badprovsyntax = len(filter(lambda x:x=="PROVIDE", type_list)) + baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax + badlicsyntax = badlicsyntax > 0 + badprovsyntax = badprovsyntax > 0 for keyword,arch,groups in arches: portage.groups=groups |