diff options
author | Alexis Christoforides <alexis@thenull.net> | 2016-11-04 17:55:13 +0300 |
---|---|---|
committer | Alexis Christoforides <alexis@thenull.net> | 2016-11-04 18:31:25 +0300 |
commit | 147e97cb6dd501d6c837fdbd6f0c42b6463a463a (patch) | |
tree | b36a653d43a19ffe559a38a1e8cb73cdc8179616 /packaging/MacSDKRelease | |
parent | befd4fa677adbac8b7a0d9353693797bfda66caf (diff) |
Rename 'bockbuild' to 'packaging' so that it can be home to other packaging code
Diffstat (limited to 'packaging/MacSDKRelease')
-rw-r--r-- | packaging/MacSDKRelease/mono-extensions.py | 25 | ||||
l--------- | packaging/MacSDKRelease/packaging | 1 | ||||
-rwxr-xr-x | packaging/MacSDKRelease/profile.py | 88 |
3 files changed, 114 insertions, 0 deletions
diff --git a/packaging/MacSDKRelease/mono-extensions.py b/packaging/MacSDKRelease/mono-extensions.py new file mode 100644 index 00000000000..2d52fdae973 --- /dev/null +++ b/packaging/MacSDKRelease/mono-extensions.py @@ -0,0 +1,25 @@ +from bockbuild.package import Package + + +class MonoExtensionsPackage(Package): + + def __init__(self): + Package.__init__(self, 'mono-extensions', None, + sources=['git@github.com:xamarin/mono-extensions.git'], + git_branch=self.profile.release_packages[ + 'mono'].git_branch + ) + self.source_dir_name = 'mono-extensions' + + # Mono pull requests won't have mono-extensions branches + if not self.git_branch or 'pull/' in self.git_branch: + warn('Using master branch for mono_extensions') + self.git_branch = 'master' + + def build(self): + pass + + def install(self): + pass + +MonoExtensionsPackage() diff --git a/packaging/MacSDKRelease/packaging b/packaging/MacSDKRelease/packaging new file mode 120000 index 00000000000..714bc29ca93 --- /dev/null +++ b/packaging/MacSDKRelease/packaging @@ -0,0 +1 @@ +../MacSDK/packaging
\ No newline at end of file diff --git a/packaging/MacSDKRelease/profile.py b/packaging/MacSDKRelease/profile.py new file mode 100755 index 00000000000..8638324e74c --- /dev/null +++ b/packaging/MacSDKRelease/profile.py @@ -0,0 +1,88 @@ +import itertools +import os +import re +import shutil +import string +import sys +import tempfile +import traceback + +from glob import glob + +from MacSDK import profile +from bockbuild.util.util import * + + +class MonoXamarinPackageProfile(MonoReleaseProfile): + description = 'The Mono Framework for MacOS (official release)' + + def setup (self): + bockbuild.packages_to_build.extend(['mono-extensions']) + if bockbuild.cmd_options.release_build: + self.setup_codesign() + else: + info("'--release' option not set, will not attempt to sign package!") + + self.cache_host = 'http://xamarin-storage/bockbuild_cache/' + + def setup_codesign(self): + self.identity = "Developer ID Installer: Xamarin Inc" + + output = backtick("security -v find-identity") + if self.identity not in " ".join(output): + error("Identity '%s' was not found. You can create an unsigned package by removing '--release' to your command line." % self.identity) + + password = os.getenv("CODESIGN_KEYCHAIN_PASSWORD") + if password: + print "Unlocking the keychain" + run_shell("security unlock-keychain -p %s" % password) + else: + error("CODESIGN_KEYCHAIN_PASSWORD needs to be defined.") + + def setup_release(self): + MonoReleaseProfile.setup_release(self) + self.release_packages['mono'].configure_flags.extend( + ['--enable-extension-module=xamarin --enable-native-types --enable-pecrypt']) + info('Xamarin extensions enabled') + + def run_pkgbuild(self, working_dir, package_type): + output = MonoReleaseProfile.run_pkgbuild( + self, working_dir, package_type) + + output_unsigned = os.path.join(os.path.dirname( + output), os.path.basename(output).replace('.pkg', '.UNSIGNED.pkg')) + shutil.move(output, output_unsigned) + + if not bockbuild.cmd_options.release_build: + return output_unsigned + + productsign = "/usr/bin/productsign" + productsign_cmd = ' '.join([productsign, + "-s '%s'" % self.identity, + "'%s'" % output_unsigned, + "'%s'" % output]) + run_shell(productsign_cmd) + os.remove(output_unsigned) + self.verify_codesign(output) + + return output + + def verify_codesign(self, pkg): + oldcwd = os.getcwd() + try: + name = os.path.basename(pkg) + pkgdir = os.path.dirname(pkg) + os.chdir(pkgdir) + spctl = "/usr/sbin/spctl" + spctl_cmd = ' '.join( + [spctl, "-vvv", "--assess", "--type install", name, "2>&1"]) + output = backtick(spctl_cmd) + + if "accepted" in " ".join(output): + warn("%s IS SIGNED" % pkg) + else: + error("%s IS NOT SIGNED:" % pkg) + finally: + os.chdir(oldcwd) + +MonoXamarinPackageProfile()
\ No newline at end of file |