diff options
-rwxr-xr-x | depcheck.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/depcheck.py b/depcheck.py index 7f47a58..046b559 100755 --- a/depcheck.py +++ b/depcheck.py @@ -394,7 +394,7 @@ def check_bdsat(mirror, arch): next(dose_result) # skip header for d in dose_result: if d["status"] == "ok": - yield (d["package"], d["version"], True, None) + yield (d["package"], d["version"], None) else: r = d["reasons"][0] if "missing" in r: @@ -405,27 +405,29 @@ def check_bdsat(mirror, arch): reason += r.split()[0].split(':', 1)[0] else: assert False - yield (d["package"], d["version"], False, reason) + yield (d["package"], d["version"], reason) def update_depcheck(mirror, db, architecture): now = datetime.datetime.utcnow() mirror.update_release() state = {} - for source, version, satisfiable, reason in check_bdsat(mirror, architecture): - state[source] = (version, satisfiable, reason) + for source, version, reason in check_bdsat(mirror, architecture): + state[source] = (version, reason) with contextlib.closing(db.cursor()) as cur: cur.execute("BEGIN;") cur.execute("SELECT source, version, satisfiable, reason FROM depstate WHERE architecture = ?;", (architecture,)) for source, version, satisfiable, reason in list(cur.fetchall()): - if state.get(source) == (version, satisfiable, reason): + if satisfiable == (reason is None) and \ + state.get(source) == (version, reason): del state[source] else: cur.execute("DELETE FROM depstate WHERE source = ? AND version = ? AND architecture = ?;", (source, version, architecture)) cur.executemany("INSERT INTO depstate (source, architecture, version, satisfiable, reason) VALUES (?, ?, ?, ?, ?);", - ((source, architecture, version, satisfiable, reason) - for source, (version, satisfiable, reason) in state.items())) + ((source, architecture, version, reason is None, + reason) + for source, (version, reason) in state.items())) cur.execute("UPDATE depcheck SET releasetime = ?, updatetime = ?, giveback = 0 WHERE architecture = ?", (mirror.releasetime, now, architecture)) db.commit() |