From 4643d931f6adc4f7f55c7c2fbb37532614742c74 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Sun, 20 Sep 2009 14:50:34 +0200 Subject: 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 Signed-off-by: Aaron Griffin --- cron-jobs/check_archlinux/check_packages.py | 24 ++++++++++++++---------- 1 file 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 -- cgit v1.2.3-24-g4f1b