Skip to content

Commit

Permalink
Review updates
Browse files Browse the repository at this point in the history
* extend and use GetBraveSigningConfig from signing_helper.py
* remove commented out section from create_config
* remove check for do_notarization
  • Loading branch information
mbacchi authored and mihaiplesa committed Oct 30, 2019
1 parent 86147dc commit b228ea5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 52 deletions.
63 changes: 15 additions & 48 deletions build/mac/notarize_dmg_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# Import the entire module to avoid circular dependencies in the functions
from signing import config, commands, model, notarize, pipeline, signing # noqa: E402

from signing_helper import GetBraveSigningConfig

def run_command(args, **kwargs):
print('Running command: {}'.format(args))
Expand All @@ -48,16 +48,6 @@ def create_config(config_args, development, mac_provisioning_profile):
An instance of |model.CodeSignConfig|.
"""
config_class = config.CodeSignConfig
"""
try:
import signing.internal_config
config_class = signing.internal_config.InternalCodeSignConfig
except ImportError as e:
# If the build specified Google Chrome as the product, then the
# internal config has to be available.
if config_class(identity, keychain).product == 'Google Chrome':
raise e
"""

if development:

Expand All @@ -81,46 +71,23 @@ def run_spctl_assess(self):
return config_class(*config_args)


def GetBraveSigningConfig(config_class, development, mac_provisioning_profile):
if development:
return config_class

if mac_provisioning_profile:
provisioning_profile = mac_provisioning_profile
assert len(provisioning_profile), 'Argument mac_provisioning_profile not provided!'

class ProvisioningProfileCodeSignConfig(config_class):

@property
def provisioning_profile_basename(self):
return os.path.splitext(os.path.basename(
provisioning_profile))[0]

@property
def run_spctl_assess(self):
return True

return ProvisioningProfileCodeSignConfig


def NotarizeBraveDmgPkg(paths, config, dmg, pkg, outdir, signed, do_notarization=True):
def NotarizeBraveDmgPkg(paths, config, dmg, pkg, outdir, signed):
"""
Notarize Brave .dmg and .pkg files.
"""
if do_notarization:
uuids_to_path_map = {}
for dist in config.distributions:
dist_config = dist.to_config(config)
uuid = notarize.submit(dmg, dist_config)
uuids_to_path_map[uuid] = dmg
uuid1 = notarize.submit(pkg, dist_config)
uuids_to_path_map[uuid1] = pkg
for result in notarize.wait_for_results(
uuids_to_path_map.keys(), config):
brave_path = uuids_to_path_map[result]
notarize.staple(brave_path)
for item in uuids_to_path_map.values():
commands.copy_files(os.path.join(signed, item), outdir)
uuids_to_path_map = {}
for dist in config.distributions:
dist_config = dist.to_config(config)
uuid = notarize.submit(dmg, dist_config)
uuids_to_path_map[uuid] = dmg
uuid1 = notarize.submit(pkg, dist_config)
uuids_to_path_map[uuid1] = pkg
for result in notarize.wait_for_results(
uuids_to_path_map.keys(), config):
brave_path = uuids_to_path_map[result]
notarize.staple(brave_path)
for item in uuids_to_path_map.values():
commands.copy_files(os.path.join(signed, item), outdir)
return 0


Expand Down
11 changes: 7 additions & 4 deletions script/signing_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,16 @@ def AddBravePartsForSigning(parts, config):
parts['helper-app'].options = CodeSignOptions.RESTRICT + CodeSignOptions.KILL + CodeSignOptions.HARDENED_RUNTIME


def GetBraveSigningConfig(config_class, development):
def GetBraveSigningConfig(config_class, development, mac_provisioning_profile=None):
if development:
return config_class

# Retrieve provisioning profile exported by build/mac/sign_app.sh
provisioning_profile = os.environ['MAC_PROVISIONING_PROFILE']
assert len(provisioning_profile), 'MAC_PROVISIONING_PROFILE is not set'
if mac_provisioning_profile is not None:
provisioning_profile = mac_provisioning_profile
else:
# Retrieve provisioning profile exported by build/mac/sign_app.sh
provisioning_profile = os.environ['MAC_PROVISIONING_PROFILE']
assert len(provisioning_profile), 'MAC_PROVISIONING_PROFILE is not set'

class ProvisioningProfileCodeSignConfig(config_class):

Expand Down

0 comments on commit b228ea5

Please sign in to comment.