summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2009-09-20 14:50:34 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2009-09-21 22:09:44 +0200
commit4643d931f6adc4f7f55c7c2fbb37532614742c74 (patch)
tree7d3b5efb384bf70bc6d11aa0a9ae9fe1cd9f2de2
parent17e96ac3d2505ed8841ff9240492e7378472d364 (diff)
downloaddbscripts-4643d931f6adc4f7f55c7c2fbb37532614742c74.tar.gz
dbscripts-4643d931f6adc4f7f55c7c2fbb37532614742c74.tar.xz
check_packages : fix a bug when filling provisions
When we had a duplicate package, we would replace the old ref by the new ref. But the provisions dict kept both the old and new ref. This was not good at all. Now, we just keep the old ref, and we only fill provisions after all packages have been parsed. This should be much more sane. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
-rwxr-xr-xcron-jobs/check_archlinux/check_packages.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/cron-jobs/check_archlinux/check_packages.py b/cron-jobs/check_archlinux/check_packages.py
index 25362c0..e8830e0 100755
--- a/cron-jobs/check_archlinux/check_packages.py
+++ b/cron-jobs/check_archlinux/check_packages.py
@@ -22,8 +22,9 @@ import pdb
DBEXT='.db.tar.gz'
packages = {} # pkgname : PacmanPackage
+repopkgs = {} # pkgname : PacmanPackage
provisions = {} # provision : PacmanPackage
-pkgdeps,makepkgdeps = {},{} # pkgname : list of the PacmanPackage dependencies
+pkgdeps,makepkgdeps = {},{} # PacmanPackage : list of the PacmanPackage dependencies
invalid_pkgbuilds = []
missing_pkgbuilds = []
dups = []
@@ -87,7 +88,8 @@ def parse_data(repo,data):
dup = None
if packages.has_key(pkg.name):
dup = packages[pkg.name]
- packages[pkg.name] = pkg
+ else:
+ packages[pkg.name] = pkg
elif attrname == "base":
pkg.base = line
elif attrname == "version":
@@ -106,10 +108,6 @@ def parse_data(repo,data):
pkg.conflicts.append(line)
elif attrname == "provides":
pkg.provides.append(line)
- provname=line.split("=")[0]
- if not provisions.has_key(provname):
- provisions[provname] = []
- provisions[provname].append(pkg)
def parse_dbs(repos,arch):
dbpkgs = {}
@@ -278,11 +276,9 @@ def tarjan(pkg):
index += 1
checked_deps.append(pkg)
S.append(pkg)
+ deps = []
if pkgdeps.has_key(pkg):
deps = pkgdeps[pkg]
- else:
- print pkg.name
- deps = []
for dep in deps:
if not pkgindex.has_key(dep):
tarjan(dep)
@@ -430,7 +426,15 @@ print "\nPerforming integrity checks..."
print "==> parsing pkgbuilds"
parse_pkgbuilds(loadrepos,arch)
-repopkgs = {}
+# fill provisions
+for name,pkg in packages.iteritems():
+ for prov in pkg.provides:
+ provname=prov.split("=")[0]
+ if not provisions.has_key(provname):
+ provisions[provname] = []
+ provisions[provname].append(pkg)
+
+# fill repopkgs
for name,pkg in packages.iteritems():
if pkg.repo in repos:
repopkgs[name] = pkg