From: Alexis Christoforides Date: Fri, 21 Oct 2016 13:43:34 +0000 (-0400) Subject: More fixes for the Release ('Xamarin') profile X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=e55526556d5d7c08e70a696837e976a009a66d77 More fixes for the Release ('Xamarin') profile --- diff --git a/bockbuild/MacSDK/__init__.py b/bockbuild/MacSDK/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/bockbuild/MacSDK/profile.py b/bockbuild/MacSDK/profile.py index 99485ae1fdf..757b6be58e0 100755 --- a/bockbuild/MacSDK/profile.py +++ b/bockbuild/MacSDK/profile.py @@ -13,7 +13,7 @@ from bockbuild.util.util import * from glob import glob class MonoReleaseProfile(DarwinProfile): - + description = 'The Mono Framework for MacOS' packages = [ 'gettext', 'pkg-config', diff --git a/bockbuild/MacSDKRelease/mono-extensions.py b/bockbuild/MacSDKRelease/mono-extensions.py new file mode 100644 index 00000000000..2d52fdae973 --- /dev/null +++ b/bockbuild/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/bockbuild/MacSDKRelease/packaging b/bockbuild/MacSDKRelease/packaging new file mode 120000 index 00000000000..4fff3584c06 --- /dev/null +++ b/bockbuild/MacSDKRelease/packaging @@ -0,0 +1 @@ +../mono-mac-release/packaging \ No newline at end of file diff --git a/bockbuild/MacSDKRelease/profile.py b/bockbuild/MacSDKRelease/profile.py new file mode 100755 index 00000000000..4aa5d9824b6 --- /dev/null +++ b/bockbuild/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://storage.bos.xamarin.com/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 self.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 diff --git a/bockbuild/mac-sdk-xamarin/mono-extensions.py b/bockbuild/mac-sdk-xamarin/mono-extensions.py deleted file mode 100644 index 2d52fdae973..00000000000 --- a/bockbuild/mac-sdk-xamarin/mono-extensions.py +++ /dev/null @@ -1,25 +0,0 @@ -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/bockbuild/mac-sdk-xamarin/packaging b/bockbuild/mac-sdk-xamarin/packaging deleted file mode 120000 index 4fff3584c06..00000000000 --- a/bockbuild/mac-sdk-xamarin/packaging +++ /dev/null @@ -1 +0,0 @@ -../mono-mac-release/packaging \ No newline at end of file diff --git a/bockbuild/mac-sdk-xamarin/profile.py b/bockbuild/mac-sdk-xamarin/profile.py deleted file mode 100755 index 257a07bc4dc..00000000000 --- a/bockbuild/mac-sdk-xamarin/profile.py +++ /dev/null @@ -1,90 +0,0 @@ -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 = 'Signed package' - - def attach (self, bockbuild): - print dir(bockbuild) - MonoReleaseProfile.attach(self, bockbuild) - 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://storage.bos.xamarin.com/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 self.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