[Cryptech-Commits] [releng/alpha] branch master updated: Fix Homebrew formula class name.
git at cryptech.is
git at cryptech.is
Thu Dec 15 00:37:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch master
in repository releng/alpha.
The following commit(s) were added to refs/heads/master by this push:
new ec2c2ac Fix Homebrew formula class name.
ec2c2ac is described below
commit ec2c2aca3eb5c61f24c697c671cf25053653fc6d
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Wed Dec 14 19:32:29 2016 -0500
Fix Homebrew formula class name.
Apparently Homebrew expects the formula class name to match the name
of the recipe, and gets tetchy when they do not. Minimal fix, wires
in assumptions about how we punctuate package names, but simple and
should suffice for now.
While we were at this, changed argument parsing for
build-homebrew-formula.py to use named (--foo) rather than positional
arguments.
---
Makefile | 3 ++-
scripts/build-homebrew-formula.py | 16 ++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index d3318e9..69766ac 100644
--- a/Makefile
+++ b/Makefile
@@ -119,7 +119,8 @@ homebrew:
umask ${REPO_UMASK}; \
git clone ${REPO_BASE}/brew/tap tap; \
cd tap; \
- ../scripts/build-homebrew-formula.py ${REPO_BASE}/brew/tarballs/${PACKAGE_NAME}_${PACKAGE_VERSION}.tar.xz ${PACKAGE_VERSION} ${PACKAGE_NAME}.rb ${PACKAGE_CONFLICT}; \
+ ../scripts/build-homebrew-formula.py --tarball ${REPO_BASE}/brew/tarballs/${PACKAGE_NAME}_${PACKAGE_VERSION}.tar.xz --formula ${PACKAGE_NAME}.rb \
+ --package ${PACKAGE_NAME} --version ${PACKAGE_VERSION} --conflicts ${PACKAGE_CONFLICT}; \
git add ${PACKAGE_NAME}.rb; \
git commit -S${GPG_KEYID} --author='${GPG_USER}' -m '${PACKAGE_NAME} ${PACKAGE_VERSION}'; \
git push
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))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Commits
mailing list