[Cryptech-Commits] [releng/alpha] branch ksng updated: Update Homebrew formula.

git at cryptech.is git at cryptech.is
Sat Apr 15 15:36:47 UTC 2017


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

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

The following commit(s) were added to refs/heads/ksng by this push:
     new 07f8b94  Update Homebrew formula.
07f8b94 is described below

commit 07f8b946d7dc13a5cf6cfdc3bf1143cb3c3c3d5b
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sat Apr 15 11:32:33 2017 -0400

    Update Homebrew formula.
    
    * Drop dependency on SQLite3;
    * Add dependency on Tornado;
    * Use setup.py to install our own Python code;
    * Document the Python voodoo better, well, differently.
---
 scripts/build-homebrew-formula.py | 58 ++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/scripts/build-homebrew-formula.py b/scripts/build-homebrew-formula.py
index 8090ea8..d5073f9 100755
--- a/scripts/build-homebrew-formula.py
+++ b/scripts/build-homebrew-formula.py
@@ -19,6 +19,26 @@ args = parser.parse_args()
 template = '''\
 # This Homebrew forumula was automatically generated by a script.
 # You might not want to edit it manually.
+#
+# Installation is a bit complex due to the way Homebrew handles Python
+# library dependencies and due to our stuff being a mixture of Python
+# and C.  It's also painfully slow, because we're not using bottles,
+# due to lack of a MacOS build farm.  Sorry.
+#
+# Per Homebrew expectations, we install copies of external Python
+# libraries ("resources") in our own private library directory, using
+# Homebrew's hack to run our executable Python scripts with PYTHONPATH
+# pointing to our private library directory.  Our own Python library
+# code, however, is what Homebrew considers "bindings", so we install
+# those where user scripts as well as our own can find them.
+#
+# We have to build our own software before installing our Python code,
+# because at least one of the Python modules we install
+# (cryptech.py11.attribute_map) is generated during the build.
+#
+# Reference for all the Python voodoo:
+#
+# https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Python-for-Formula-Authors.md
 
 class {classname} < Formula
 
@@ -30,14 +50,6 @@ class {classname} < Formula
 
 {conflicts}
 
-  # See https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md#specifying-other-formulae-as-dependencies
-  # for details on handling dependencies on other homebrew packages (eg, sqlite3).
-
-  # See https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Python-for-Formula-Authors.md
-  # for details on handling dependencies on Python libraries (eg, pyserial).
-
-  depends_on "sqlite3"
-
   resource "pyserial" do
     url    "https://pypi.python.org/packages/3c/d8/a9fa247ca60b02b3bebbd61766b4f321393b57b13c53b18f6f62cf172c08/pyserial-3.1.1.tar.gz"
     sha256 "d657051249ce3cbd0446bcfb2be07a435e1029da4d63f53ed9b4cdde7373364c"
@@ -48,43 +60,31 @@ class {classname} < Formula
     sha256 "c36c938a872e5ff494938b33b14aaa156cb439ec67548fcab3535bb78b0846e8"
   end
 
-  def install
-
-    # Installation is a bit complex due to the way Homebrew handles
-    # Python library dependencies and due to our stuff being a mix of
-    # Python and C.
+  resource "tornado" do
+    url    "https://files.pythonhosted.org/packages/source/t/tornado/tornado-4.4.3.tar.gz"
+    sha256 "f267acc96d5cf3df0fd8a7bfb5a91c2eb4ec81d5962d1a7386ceb34c655634a8"
+  end
 
-    # Set PYTHONPATH to point to our private library location.
+  def install
 
     ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
 
-    # Add all resources (and assume they are all Python, be careful...).
-
     resources.each do |r|
       r.stage do
         system "python", *Language::Python.setup_install_args(libexec/"vendor")
       end
     end
 
-    # Build everything.
-
     ohai "Building PKCS #11 code (including crypto and bignum libraries) from source, this is slow, please be patient..."
     ENV.deparallelize
     system "make", "-C", "sw/pkcs11"
 
-    # Install the Python scripts, then replace them with stubs which
-    # set PYTHONPATH before calling the real scripts.
-
-    bin.install   "sw/stm32/projects/hsm/cryptech_upload"
-    bin.install   "sw/stm32/projects/hsm/cryptech_probe"
-    bin.install   "sw/stm32/projects/hsm/cryptech_miniterm"
+    system "python", *Language::Python.setup_install_args(prefix)
     bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
 
-    # Install other (non-Python) stuff, then we are done.
-
     share.install "cryptech-alpha-firmware.tar.gz"
     lib.install   "sw/pkcs11/libcryptech-pkcs11.dylib"
-    #bin.install  "sw/pkcs11/p11util"
+
   end
 
 end
@@ -98,9 +98,11 @@ 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)
 
+url = os.path.join(args.url_base, os.path.basename(args.tarball))
+
 args.formula.write(template.format(
     version   = args.version,
-    url       = os.path.join(args.url_base, os.path.basename(args.tarball)),
+    url       = url,
     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