diff options
author | Helmut Grohne <helmut@subdivi.de> | 2020-10-08 17:16:06 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2020-10-08 17:16:06 +0200 |
commit | aaae5693485ae850bfe2c9506f2586a9542641bf (patch) | |
tree | 40058cc72f43afedcf952aab96d1e00705939048 /depcheck.py | |
parent | bab219106d1b6761b4869ba60743e0c32ab7bf8c (diff) | |
download | crossqa-aaae5693485ae850bfe2c9506f2586a9542641bf.tar.gz |
add build architecture to schema of depstate table
Diffstat (limited to 'depcheck.py')
-rwxr-xr-x | depcheck.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/depcheck.py b/depcheck.py index ad0a18d..b1f7458 100755 --- a/depcheck.py +++ b/depcheck.py @@ -415,24 +415,34 @@ def check_bdsat(mirror, buildarch, hostarch): return result -def update_depcheck(mirror, db, updatetime, architecture, state): +def update_depcheck(mirror, db, updatetime, buildarch, hostarch, state): with contextlib.closing(db.cursor()) as cur: cur.execute("BEGIN;") - cur.execute("SELECT source, version, satisfiable, reason FROM depstate WHERE architecture = ?;", - (architecture,)) + cur.execute(""" + SELECT source, version, satisfiable, reason FROM depstate + WHERE buildarch = ? AND hostarch = ?;""", + (buildarch, hostarch,)) for source, version, satisfiable, reason in list(cur.fetchall()): 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, reason is None, + cur.execute(""" + DELETE FROM depstate + WHERE source = ? AND version = ? AND buildarch = ? + AND hostarch = ?;""", + (source, version, buildarch, hostarch)) + cur.executemany(""" + INSERT INTO depstate (source, buildarch, hostarch, version, + satisfiable, reason) + VALUES (?, ?, ?, ?, ?, ?);""", + ((source, buildarch, hostarch, 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, updatetime, architecture)) + cur.execute(""" + UPDATE depcheck SET releasetime = ?, updatetime = ?, giveback = 0 + WHERE architecture = ?""", + (mirror.releasetime, updatetime, hostarch)) db.commit() @@ -476,7 +486,8 @@ def main(): try: for architecture, state in pool.imap_unordered(docheck, archs): print("update %s" % architecture) - update_depcheck(mirror, db, now, architecture, state) + update_depcheck(mirror, db, now, BUILD_ARCH, architecture, + state) finally: pool.close() pool.join() |