[Cryptech-Commits] [releng/alpha] branch python3 updated: Rewrite script to use subprocess.run(), another python -> python3

git at cryptech.is git at cryptech.is
Mon Jul 13 05:27:50 UTC 2020


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch python3
in repository releng/alpha.

The following commit(s) were added to refs/heads/python3 by this push:
     new ed161c5  Rewrite script to use subprocess.run(), another python -> python3
ed161c5 is described below

commit ed161c5f748ce4ffa382b78b4718fe1bc6a98a03
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Mon Jul 13 01:26:43 2020 -0400

    Rewrite script to use subprocess.run(), another python -> python3
---
 scripts/build-firmware-package.py | 21 ++++++++++++---------
 source/sw/pkcs11                  |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/scripts/build-firmware-package.py b/scripts/build-firmware-package.py
index 6ce49ab..b36b55e 100755
--- a/scripts/build-firmware-package.py
+++ b/scripts/build-firmware-package.py
@@ -9,16 +9,22 @@ import json
 import sys
 import os
 
+def run(*args, **kwargs):
+    kwargs.update(stdout = subprocess.PIPE, universal_newlines = True, check = True)
+    return subprocess.run(args, **kwargs)
+
 parser = argparse.ArgumentParser()
 parser.add_argument("tarfile", type = argparse.FileType("wb"),  help = "tarball to create")
 parser.add_argument("firmware", nargs = "+",                    help = "firmware files to stuff into tarball")
 args = parser.parse_args()
 
 tar     = tarfile.TarFile.open(fileobj = args.tarfile, mode = "w|gz")
-head    = subprocess.check_output(("git", "rev-parse", "HEAD")).decode().strip()
-time    = subprocess.check_output(("git", "show", "-s", "--format=%ct", "HEAD")).decode().strip()
-commits = dict((path, hash) for hash, path, branch in
-               (line.decode().split() for line in subprocess.check_output(("git", "submodule", "status")).splitlines()))
+head    = run("git", "rev-parse", "HEAD").stdout.strip()
+time    = run("git", "show", "-s", "--format=%ct", "HEAD").stdout.strip()
+commits = { path: hash
+            for hash, path, branch in (
+                    line.split()
+                    for line in run("git", "submodule", "status").stdout.splitlines() ) }
 sha256  = {}
 
 for fn in args.firmware:
@@ -29,11 +35,8 @@ for fn in args.firmware:
 manifest = json.dumps(dict(head = head, time = time, commits = commits, sha256  = sha256), indent = 2, sort_keys = True)
 
 if os.path.isdir(os.getenv("GNUPGHOME", "")):
-    gpg = subprocess.Popen(("gpg", "--clearsign", "--personal-digest-preferences", "SHA256", "--no-permission-warning"),
-                           stdin = subprocess.PIPE, stdout = subprocess.PIPE, universal_newlines = True)
-    manifest = gpg.communicate(manifest)[0]
-    if gpg.returncode:
-        sys.exit("gpg failed")
+    manifest = run("gpg", "--clearsign", "--personal-digest-preferences", "SHA256", "--no-permission-warning",
+                   input = manifest).stdout
 
 with tempfile.NamedTemporaryFile("w+") as f:
     os.fchmod(f.fileno(), 0o644)
diff --git a/source/sw/pkcs11 b/source/sw/pkcs11
index bf8e254..3b33d6d 160000
--- a/source/sw/pkcs11
+++ b/source/sw/pkcs11
@@ -1 +1 @@
-Subproject commit bf8e254c435c972a7ab28700eab48a2b6ae79c57
+Subproject commit 3b33d6df40d6c6b12611ece5c45592d95bd4c12c

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list