diff options
author | Helmut Grohne <helmut@subdivi.de> | 2019-03-02 10:36:45 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2019-03-02 10:36:45 +0100 |
commit | 552e075641a7a620b5fec2916338195bf4c2758a (patch) | |
tree | e29fc2dad12bc3781ed79f7bf2c7fc50993b13ac /depcheck.py | |
parent | 9c981665b8cd8cb1957947bda8d41ce97f451f4e (diff) | |
download | crossqa-552e075641a7a620b5fec2916338195bf4c2758a.tar.gz |
depcheck: elide redundant element from tuple
Diffstat (limited to 'depcheck.py')
-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() |