Update build scripts

This commit is contained in:
Ali
2022-09-16 22:57:08 +04:00
parent 98bbf0db87
commit 8d4963a159
2 changed files with 56 additions and 19 deletions

View File

@@ -190,6 +190,36 @@ def copy_profiles_from_directory(source_path, destination_path, team_id, bundle_
print('Warning: skipping provisioning profile at {} with bundle_id {} (base_name {})'.format(file_path, profile_name, profile_base_name))
def resolve_aps_environment_from_directory(source_path, team_id, bundle_id):
for file_name in os.listdir(source_path):
file_path = source_path + '/' + file_name
if os.path.isfile(file_path):
if not file_path.endswith('.mobileprovision'):
continue
profile_data = run_executable_with_output('openssl', arguments=[
'smime',
'-inform',
'der',
'-verify',
'-noverify',
'-in',
file_path
], decode=False, stderr_to_stdout=False, check_result=True)
profile_dict = plistlib.loads(profile_data)
profile_name = profile_dict['Entitlements']['application-identifier']
if profile_name.startswith(team_id + '.' + bundle_id):
profile_base_name = profile_name[len(team_id + '.' + bundle_id):]
if profile_base_name == '':
if 'aps-environment' not in profile_dict['Entitlements']:
print('Provisioning profile at {} does not include an aps-environment entitlement'.format(file_path))
sys.exit(1)
return profile_dict['Entitlements']['aps-environment']
return None
def copy_certificates_from_directory(source_path, destination_path):
for file_name in os.listdir(source_path):
file_path = source_path + '/' + file_name
@@ -208,6 +238,9 @@ class CodesigningSource:
def copy_profiles_to_destination(self, destination_path):
raise Exception('Not implemented')
def resolve_aps_environment(self):
raise Exception('Not implemented')
def copy_certificates_to_destination(self, destination_path):
raise Exception('Not implemented')
@@ -242,6 +275,10 @@ class GitCodesigningSource(CodesigningSource):
source_path = self.working_dir + '/decrypted/profiles/{}'.format(self.codesigning_type)
copy_profiles_from_directory(source_path=source_path, destination_path=destination_path, team_id=self.team_id, bundle_id=self.bundle_id)
def resolve_aps_environment(self):
source_path = self.working_dir + '/decrypted/profiles/{}'.format(self.codesigning_type)
return resolve_aps_environment_from_directory(source_path=source_path, team_id=self.team_id, bundle_id=self.bundle_id)
def copy_certificates_to_destination(self, destination_path):
source_path = None
if self.codesigning_type in ['adhoc', 'appstore']:
@@ -267,5 +304,8 @@ class DirectoryCodesigningSource(CodesigningSource):
def copy_profiles_to_destination(self, destination_path):
copy_profiles_from_directory(source_path=self.directory_path + '/profiles', destination_path=destination_path, team_id=self.team_id, bundle_id=self.bundle_id)
def resolve_aps_environment(self):
return resolve_aps_environment_from_directory(source_path=self.directory_path + '/profiles', team_id=self.team_id, bundle_id=self.bundle_id)
def copy_certificates_to_destination(self, destination_path):
copy_certificates_from_directory(source_path=self.directory_path + '/certs', destination_path=destination_path)