diff options
author | Helmut Grohne <helmut@subdivi.de> | 2019-03-02 08:27:12 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2019-03-02 08:27:12 +0100 |
commit | 9c981665b8cd8cb1957947bda8d41ce97f451f4e (patch) | |
tree | 629552a3faebdfd3824f4ea757e56e59f54307bd /build.py | |
parent | fee81e86d0bda64b6a5b82c46273b7e9980b23bd (diff) | |
download | crossqa-9c981665b8cd8cb1957947bda8d41ce97f451f4e.tar.gz |
build.py: make the build server configurable
Diffstat (limited to 'build.py')
-rwxr-xr-x | build.py | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,5 +1,6 @@ #!/usr/bin/python3 +import argparse import collections import contextlib import datetime @@ -22,11 +23,12 @@ def scan_log_status(filelike): return status[0].decode("ascii") return "unknown" -def do_build(source, version, architecture): + +def do_build(source, version, architecture, server): now = datetime.datetime.utcnow() logtarget = "%s_%s_%s_%s.log.xz" % (source, version, architecture, now.strftime("%Y%m%d%H%M%S")) - cmdline = ["ssh", "gcc131", "sh", "/dev/stdin", architecture, + cmdline = ["ssh", server, "sh", "/dev/stdin", architecture, "%s_%s" % (source, version)] with open(os.path.join("logs", logtarget), "w+b") as output: with open("build.sh", "rb") as instructions: @@ -37,6 +39,9 @@ def do_build(source, version, architecture): return (now, code == 0, logtarget, status == "given-back") def main(): + argp = argparse.ArgumentParser() + argp.add_argument("server", help="machine to build on") + args = argp.parse_args() db = sqlite3.connect("db", detect_types=sqlite3.PARSE_DECLTYPES) with contextlib.closing(db.cursor()) as cur: cur.execute("SELECT source, version, depstate.architecture FROM depstate JOIN depcheck ON depstate.architecture = depcheck.architecture WHERE satisfiable = 1 AND giveback = 0 ORDER BY random() LIMIT 1;") @@ -47,7 +52,8 @@ def main(): return source, version, architecture = row print("building %s_%s for %s" % (source, version, architecture)) - timestamp, success, filename, giveback = do_build(source, version, architecture) + timestamp, success, filename, giveback = \ + 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, |