diff options
author | Rob Austein <sra@hactrn.net> | 2016-12-14 19:38:13 -0500 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-12-14 19:38:13 -0500 |
commit | 17296538b3ac6a1c060591dac25a29aeb2ed556f (patch) | |
tree | 3dc6c23726f8888708f9385c53928aee5bb5c6e2 /scripts | |
parent | 0da2ab129889b05fdd099b29b424c305f25dad4e (diff) | |
parent | ec2c2aca3eb5c61f24c697c671cf25053653fc6d (diff) |
Merge branch 'master' into ksng.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build-homebrew-formula.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/build-homebrew-formula.py b/scripts/build-homebrew-formula.py index f2f1f54..8090ea8 100755 --- a/scripts/build-homebrew-formula.py +++ b/scripts/build-homebrew-formula.py @@ -9,17 +9,18 @@ import os parser = argparse.ArgumentParser() parser.add_argument("--url-base", default = "https://brew.cryptech.is/tarballs/") -parser.add_argument("tarball") -parser.add_argument("version") -parser.add_argument("formula", type = argparse.FileType("w"), nargs = "?", default = sys.stdout) -parser.add_argument("conflicts", nargs = "*") +parser.add_argument("--tarball", required = True) +parser.add_argument("--package", required = True) +parser.add_argument("--version", required = True) +parser.add_argument("--formula", type = argparse.FileType("w"), nargs = "?", default = sys.stdout) +parser.add_argument("--conflicts", nargs = "*") args = parser.parse_args() template = '''\ # This Homebrew forumula was automatically generated by a script. # You might not want to edit it manually. -class CryptechAlpha < Formula +class {classname} < Formula desc "Software for working with Cryptech Alpha board HSM" homepage "https://cryptech.is/" @@ -92,11 +93,14 @@ end with open(args.tarball, "rb") as f: digest = hashlib.sha256(f.read()).hexdigest() -conflicts = "".join(" conflicts_with \"{}\", :because => \"firmware and pkcs11 library must match\"\n".format(i) +classname = "".join(word.capitalize() for word in args.package.split("-")) + +conflicts = "".join(" conflicts_with \"{}\", :because => \"HSM firmware and PKCS #11 library must match each other\"\n".format(i) for i in args.conflicts) args.formula.write(template.format( version = args.version, url = os.path.join(args.url_base, os.path.basename(args.tarball)), sha256 = digest, + classname = classname, conflicts = conflicts)) |