@@ -203,6 +203,15 @@ def get_repo_base_url(clone_url: str, repo_git_base: str, force_type: Optional[s
203
203
sys .exit (1 )
204
204
205
205
206
+ def clone_git_repo (clone_url , git_mirror_path ):
207
+ logging .debug (_ ('cloning {url}' ).format (url = clone_url ))
208
+ vcs = common .getvcs ('git' , clone_url , git_mirror_path )
209
+ p = vcs .git (['clone' , '--' , vcs .remote , str (vcs .local )])
210
+ if p .returncode != 0 :
211
+ print ('WARNING: only public git repos are supported!' )
212
+ raise VCSException ('git clone %s failed:' % clone_url , p .output )
213
+
214
+
206
215
def main ():
207
216
"""Deploy to F-Droid repository or generate SSH private key from keystore.
208
217
@@ -338,12 +347,7 @@ def main():
338
347
git_mirror_repodir = os .path .join (git_mirror_fdroiddir , 'repo' )
339
348
git_mirror_metadatadir = os .path .join (git_mirror_fdroiddir , 'metadata' )
340
349
if not os .path .isdir (git_mirror_repodir ):
341
- logging .debug (_ ('cloning {url}' ).format (url = clone_url ))
342
- vcs = common .getvcs ('git' , clone_url , git_mirror_path )
343
- p = vcs .git (['clone' , '--' , vcs .remote , str (vcs .local )])
344
- if p .returncode != 0 :
345
- print ('WARNING: only public git repos are supported!' )
346
- raise VCSException ('git clone %s failed:' % clone_url , p .output )
350
+ clone_git_repo (clone_url , git_mirror_repodir )
347
351
if not os .path .isdir (git_mirror_repodir ):
348
352
os .makedirs (git_mirror_repodir , mode = 0o755 )
349
353
0 commit comments