[Collab-qa-commits] r226 - fileconflicts
filippo at alioth.debian.org
filippo at alioth.debian.org
Fri Jun 8 16:15:28 UTC 2007
Author: filippo
Date: 2007-06-08 16:15:28 +0000 (Fri, 08 Jun 2007)
New Revision: 226
Modified:
fileconflicts/get-conflicts.py
Log:
new whitelist format
Modified: fileconflicts/get-conflicts.py
===================================================================
--- fileconflicts/get-conflicts.py 2007-06-08 16:13:28 UTC (rev 225)
+++ fileconflicts/get-conflicts.py 2007-06-08 16:15:28 UTC (rev 226)
@@ -10,6 +10,7 @@
if len(sys.argv) < 4:
# whitelist is a one-per-line file with packages to exclude
+# if line is p1:p2..:pN then a conflict is skipped only if _exactly_ all packages appear as conflicts
print "usage: Packages.gz output.db whitelist"
sys.exit(1)
@@ -19,8 +20,20 @@
parse = apt_pkg.ParseTagFile(stdout)
with_conflicts = set()
-whitelist = set([ x.strip('\n') for x in open(sys.argv[3]).readlines() if not x.startswith('#') ])
+whitelist = []
+
+# whitelist init
+f = open(sys.argv[3])
+for l in f:
+ if l.startswith('#'):
+ continue
+
+ w = l.strip('\n').split(':')
+ whitelist.append(w)
+f.close()
+
+# parse
while parse.Step():
try:
if parse.Section.has_key("Conflicts"):
@@ -36,11 +49,22 @@
out = {}
# file => package1 .. packageN
-#print whitelist
for k,v in dups.items():
- if whitelist and set(v).intersection(whitelist):
- continue
-
+ if whitelist:
+ skip=0
+ for i in whitelist:
+ # old whitelist format, if package appears in list then skip
+ if len(i) == 1 and i[0] in v:
+ skip=1
+ break
+ # new whitelist format, if all packages appears in list then skip
+ if set(i) == set(v):
+ skip=1
+ break
+
+ if skip:
+ continue
+
if not set(v).intersection(with_conflicts):
# merge and reverse the output list:
# package1 .. packageN => list_of_files
More information about the Collab-qa-commits
mailing list