add build architecture to schema of builds table
authorHelmut Grohne <helmut@subdivi.de>
Wed, 7 Oct 2020 14:48:12 +0000 (16:48 +0200)
committerHelmut Grohne <helmut@subdivi.de>
Wed, 7 Oct 2020 14:48:12 +0000 (16:48 +0200)
build.py
schema.sql
webapp.py

index 340802b..e7eea33 100755 (executable)
--- a/build.py
+++ b/build.py
@@ -93,10 +93,11 @@ def main():
             do_build(source, version, architecture, args.server)
         with contextlib.closing(db.cursor()) as cur:
             cur.execute("""INSERT INTO builds
-                            (source, version, architecture, success, starttime,
-                             filename) VALUES (?, ?, ?, ?, ?, ?);""",
-                        (source, version, architecture, success, timestamp,
-                         filename))
+                            (source, version, buildarch, hostarch, success,
+                             starttime, filename)
+                            VALUES (?, ?, ?, ?, ?, ?);""",
+                        (source, version, 'amd64', architecture, success,
+                         timestamp, filename))
             if requestid is not None:
                 cur.execute("DELETE FROM buildrequests WHERE id = ?;",
                             (requestid,))
index 56184be..3569eac 100644 (file)
@@ -25,7 +25,8 @@ INSERT INTO depcheck (architecture, releasetime, updatetime, giveback) VALUES
 CREATE TABLE builds (
        source TEXT NOT NULL,
        version TEXT NOT NULL,
-       architecture TEXT NOT NULL,
+       buildarch TEXT NOT NULL,
+       hostarch TEXT NOT NULL,
        success BOOLEAN NOT NULL CHECK (success in (0, 1)),
        starttime TIMESTAMP NOT NULL,
        filename TEXT NOT NULL);
index cc9de37..3d3af0d 100644 (file)
--- a/webapp.py
+++ b/webapp.py
@@ -370,8 +370,7 @@ def collect_depstate(conn, source):
 def show_index():
     with db.engine.connect() as conn:
         builds = list(conn.execute("""
-            SELECT source, version, 'amd64' AS buildarch,
-                architecture AS hostarch, starttime, filename,
+            SELECT source, version, buildarch, hostarch, starttime, filename,
                 ifnull((SELECT max(patched + 1) FROM bugs
                                                 WHERE affects = source),
                        0) AS buglvl
@@ -392,8 +391,7 @@ def show_source(source):
         context["version"], context["depresult"] = collect_depstate(conn,
                                                                     source)
         query = sqlalchemy.text("""
-            SELECT version, 'amd64' AS buildarch, architecture AS hostarch,
-                   success, starttime, filename
+            SELECT version, buildarch, hostarch, success, starttime, filename
                 FROM builds WHERE source = :source;""")
         context["builds"] = list(conn.execute(query, source=source))
         query = sqlalchemy.text("""