@@ -112,7 +112,7 @@ def decrypt_codesigning_directory_recursively(source_base_path, destination_base
112
112
decrypt_codesigning_directory_recursively (source_path , destination_path , password )
113
113
114
114
115
- def load_provisioning_profiles_from_git (working_dir , repo_url , branch , password , always_fetch ):
115
+ def load_codesigning_data_from_git (working_dir , repo_url , branch , password , always_fetch ):
116
116
if not os .path .exists (working_dir ):
117
117
os .makedirs (working_dir , exist_ok = True )
118
118
@@ -121,15 +121,15 @@ def load_provisioning_profiles_from_git(working_dir, repo_url, branch, password,
121
121
if always_fetch :
122
122
original_working_dir = os .getcwd ()
123
123
os .chdir (encrypted_working_dir )
124
- os .system ('git fetch' )
124
+ os .system ('GIT_SSH_COMMAND="ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git fetch' )
125
125
os .system ('git checkout "{branch}"' .format (branch = branch ))
126
- os .system ('git pull' )
126
+ os .system ('GIT_SSH_COMMAND="ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git pull' )
127
127
os .chdir (original_working_dir )
128
128
else :
129
129
os .makedirs (encrypted_working_dir , exist_ok = True )
130
130
original_working_dir = os .getcwd ()
131
131
os .chdir (working_dir )
132
- os .system ('git clone {repo_url} -b "{branch}" "{target_path}"' .format (
132
+ os .system ('git -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null clone {repo_url} -b "{branch}" "{target_path}"' .format (
133
133
repo_url = repo_url ,
134
134
branch = branch ,
135
135
target_path = encrypted_working_dir
@@ -185,42 +185,67 @@ def copy_profiles_from_directory(source_path, destination_path, team_id, bundle_
185
185
print ('Warning: skipping provisioning profile at {} with bundle_id {} (base_name {})' .format (file_path , profile_name , profile_base_name ))
186
186
187
187
188
- class ProvisioningProfileSource :
188
+ def copy_certificates_from_directory (source_path , destination_path ):
189
+ for file_name in os .listdir (source_path ):
190
+ file_path = source_path + '/' + file_name
191
+ if os .path .isfile (file_path ):
192
+ if file_path .endswith ('.p12' ) or file_path .endswith ('.cer' ):
193
+ shutil .copyfile (file_path , destination_path + '/' + file_name )
194
+
195
+
196
+ class CodesigningSource :
189
197
def __init__ (self ):
190
198
pass
191
199
200
+ def load_data (self , working_dir ):
201
+ raise Exception ('Not implemented' )
202
+
192
203
def copy_profiles_to_destination (self , destination_path ):
193
204
raise Exception ('Not implemented' )
194
205
206
+ def copy_certificates_to_destination (self , destination_path ):
207
+ raise Exception ('Not implemented' )
208
+
195
209
196
- class GitProvisioningProfileSource (ProvisioningProfileSource ):
197
- def __init__ (self , working_dir , repo_url , team_id , bundle_id , profile_type , password , always_fetch ):
198
- self .working_dir = working_dir
210
+ class GitCodesigningSource (CodesigningSource ):
211
+ def __init__ (self , repo_url , team_id , bundle_id , codesigning_type , password , always_fetch ):
199
212
self .repo_url = repo_url
200
213
self .team_id = team_id
201
214
self .bundle_id = bundle_id
202
- self .profile_type = profile_type
215
+ self .codesigning_type = codesigning_type
203
216
self .password = password
204
217
self .always_fetch = always_fetch
205
218
219
+ def load_data (self , working_dir ):
220
+ self .working_dir = working_dir
221
+ load_codesigning_data_from_git (working_dir = self .working_dir , repo_url = self .repo_url , branch = self .team_id , password = self .password , always_fetch = self .always_fetch )
222
+
206
223
def copy_profiles_to_destination (self , destination_path ):
207
- load_provisioning_profiles_from_git ( working_dir = self .working_dir , repo_url = self . repo_url , branch = self . team_id , password = self .password , always_fetch = self . always_fetch )
208
- copy_profiles_from_directory (source_path = self . working_dir + '/decrypted/profiles/{}' . format ( self . profile_type ) , destination_path = destination_path , team_id = self .team_id , bundle_id = self .bundle_id )
224
+ source_path = self .working_dir + '/decrypted/profiles/{}' . format ( self .codesigning_type )
225
+ copy_profiles_from_directory (source_path = source_path , destination_path = destination_path , team_id = self .team_id , bundle_id = self .bundle_id )
209
226
227
+ def copy_certificates_to_destination (self , destination_path ):
228
+ source_path = None
229
+ if self .codesigning_type in ['adhoc' , 'appstore' , 'enterprise' ]:
230
+ source_path = self .working_dir + '/decrypted/certs/distribution'
231
+ elif self .codesigning_type == 'development' :
232
+ source_path = self .working_dir + '/decrypted/certs/development'
233
+ else :
234
+ raise Exception ('Unknown codesigning type {}' .format (self .codesigning_type ))
235
+ copy_certificates_from_directory (source_path = source_path , destination_path = destination_path )
210
236
211
- class DirectoryProvisioningProfileSource (ProvisioningProfileSource ):
237
+
238
+ class DirectoryCodesigningSource (CodesigningSource ):
212
239
def __init__ (self , directory_path , team_id , bundle_id ):
213
240
self .directory_path = directory_path
214
241
self .team_id = team_id
215
242
self .bundle_id = bundle_id
216
243
217
- def copy_profiles_to_destination (self , destination_path ):
218
- profiles_path = self .directory_path
219
- if not os .path .exists (profiles_path ):
220
- print ('{} does not exist' .format (profiles_path ))
221
- sys .exit (1 )
222
- copy_profiles_from_directory (source_path = profiles_path , destination_path = destination_path , team_id = self .team_id , bundle_id = self .bundle_id )
244
+ def load_data (self , working_dir ):
245
+ pass
223
246
247
+ def copy_profiles_to_destination (self , destination_path ):
248
+ copy_profiles_from_directory (source_path = self .directory_path + '/profiles' , destination_path = destination_path , team_id = self .team_id , bundle_id = self .bundle_id )
224
249
225
- def generate_configuration_repository ( path , profile_source ):
226
- pass
250
+ def copy_certificates_to_destination ( self , destination_path ):
251
+ copy_certificates_from_directory ( source_path = self . directory_path + '/certs' , destination_path = destination_path )
0 commit comments