[gnome-ostree] Add --fetch-keep-going option for resolve



commit cdb5941311ee62dff210e560c651aa808f05d17b
Author: Colin Walters <walters verbum org>
Date:   Wed Aug 15 14:31:19 2012 -0400

    Add --fetch-keep-going option for resolve
    
    We really don't want to blow up the resolve process when
    e.g. freedesktop.org goes offline.

 src/ostbuild/pyostbuild/builtin_resolve.py |    4 ++++
 src/ostbuild/pyostbuild/vcs.py             |    9 ++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_resolve.py b/src/ostbuild/pyostbuild/builtin_resolve.py
index 36aa1f0..e415404 100755
--- a/src/ostbuild/pyostbuild/builtin_resolve.py
+++ b/src/ostbuild/pyostbuild/builtin_resolve.py
@@ -48,6 +48,8 @@ class OstbuildResolve(builtins.Builtin):
                             help="Git fetch the patches")
         parser.add_argument('--fetch', action='store_true',
                             help="Also perform a git fetch")
+        parser.add_argument('--fetch-keep-going', action='store_true',
+                            help="Don't exit on fetch failures")
         parser.add_argument('--stamp-file',
                             help="If manifest changes, create this file")
         parser.add_argument('components', nargs='*',
@@ -85,6 +87,8 @@ class OstbuildResolve(builtins.Builtin):
         git_mirror_args = ['ostbuild', 'git-mirror', '--manifest=' + args.manifest]
         if args.fetch:
             git_mirror_args.append('--fetch')
+            if args.fetch_keep_going:
+                git_mirror_args.append('-k')
             git_mirror_args.extend(args.components)
         run_sync(git_mirror_args)
 
diff --git a/src/ostbuild/pyostbuild/vcs.py b/src/ostbuild/pyostbuild/vcs.py
index b8b9ff4..d9090ed 100755
--- a/src/ostbuild/pyostbuild/vcs.py
+++ b/src/ostbuild/pyostbuild/vcs.py
@@ -117,7 +117,8 @@ def _list_submodules(mirrordir, mirror, keytype, uri, branch):
     shutil.rmtree(tmp_checkout)
     return submodules
 
-def ensure_vcs_mirror(mirrordir, keytype, uri, branch, fetch=False):
+def ensure_vcs_mirror(mirrordir, keytype, uri, branch, fetch=False,
+                      fetch_keep_going=False):
     mirror = buildutil.get_mirrordir(mirrordir, keytype, uri)
     tmp_mirror = mirror + '.tmp'
     last_fetch_path = get_lastfetch_path(mirrordir, keytype, uri, branch)
@@ -128,7 +129,8 @@ def ensure_vcs_mirror(mirrordir, keytype, uri, branch, fetch=False):
         run_sync(['git', 'config', 'gc.auto', '0'], cwd=tmp_mirror)
         os.rename(tmp_mirror, mirror)
     elif fetch:
-        run_sync(['git', 'fetch'], cwd=mirror, log_initiation=False) 
+        run_sync(['git', 'fetch'], cwd=mirror, log_initiation=False,
+                 fatal_on_error=(not fetch_keep_going)) 
         current_vcs_version = run_sync_get_output(['git', 'rev-parse', branch], cwd=mirror)
         if current_vcs_version is not None:
             current_vcs_version = current_vcs_version.strip()
@@ -156,5 +158,6 @@ def ensure_vcs_mirror(mirrordir, keytype, uri, branch, fetch=False):
     return mirror
 
 def fetch(mirrordir, keytype, uri, branch, keep_going=False):
-    ensure_vcs_mirror(mirrordir, keytype, uri, branch, fetch=True)
+    ensure_vcs_mirror(mirrordir, keytype, uri, branch, fetch=True,
+                      fetch_keep_going=keep_going)
     



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