[ostree] ostbuild: Add -k option to git-mirror



commit c436f8ac61fb9c1a2976a34ef43847ed86a01176
Author: Colin Walters <walters verbum org>
Date:   Tue Jun 5 22:55:47 2012 -0400

    ostbuild: Add -k option to git-mirror
    
    libwacom's sourceforge git server was down...

 src/ostbuild/pyostbuild/builtin_git_mirror.py |    4 +++-
 src/ostbuild/pyostbuild/vcs.py                |   14 ++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_git_mirror.py b/src/ostbuild/pyostbuild/builtin_git_mirror.py
index 0b7f0d5..2b78bcf 100755
--- a/src/ostbuild/pyostbuild/builtin_git_mirror.py
+++ b/src/ostbuild/pyostbuild/builtin_git_mirror.py
@@ -46,6 +46,8 @@ class OstbuildGitMirror(builtins.Builtin):
                             help="Don't perform a fetch if we have done so in the last N seconds")
         parser.add_argument('--fetch', action='store_true',
                             help="Also do a git fetch for components")
+        parser.add_argument('-k', '--keep-going', action='store_true',
+                            help="Don't exit on fetch failures")
         parser.add_argument('components', nargs='*')
 
         args = parser.parse_args(argv)
@@ -95,6 +97,6 @@ class OstbuildGitMirror(builtins.Builtin):
                         continue
 
             log("Running git fetch for %s" % (name, ))
-            vcs.fetch(self.mirrordir, keytype, uri, branch_or_tag)
+            vcs.fetch(self.mirrordir, keytype, uri, branch_or_tag, keep_going=args.keep_going)
 
 builtins.register(OstbuildGitMirror)
diff --git a/src/ostbuild/pyostbuild/vcs.py b/src/ostbuild/pyostbuild/vcs.py
index f47c283..59d4e03 100755
--- a/src/ostbuild/pyostbuild/vcs.py
+++ b/src/ostbuild/pyostbuild/vcs.py
@@ -141,13 +141,15 @@ def ensure_vcs_mirror(mirrordir, keytype, uri, branch):
         f.close()
     return mirror
 
-def fetch(mirrordir, keytype, uri, branch):
+def fetch(mirrordir, keytype, uri, branch, keep_going=False):
     mirror = buildutil.get_mirrordir(mirrordir, keytype, uri)
     last_fetch_path = get_lastfetch_path(mirrordir, keytype, uri, branch)
     run_sync(['git', 'fetch'], cwd=mirror, log_initiation=False) 
-    current_vcs_version = run_sync_get_output(['git', 'rev-parse', branch], cwd=mirror)
-    current_vcs_version = current_vcs_version.strip()
-    f = open(last_fetch_path, 'w')
-    f.write(current_vcs_version + '\n')
-    f.close()
+    current_vcs_version = run_sync_get_output(['git', 'rev-parse', branch], cwd=mirror,
+                                              none_on_error=keep_going)
+    if current_vcs_version is not None:
+        current_vcs_version = current_vcs_version.strip()
+        f = open(last_fetch_path, 'w')
+        f.write(current_vcs_version + '\n')
+        f.close()
     



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]