[ostree] ostbuild: Various cleanups



commit 660ff7422f192effc16da22a5a304850e7a8b4b9
Author: Colin Walters <walters verbum org>
Date:   Wed Jan 18 17:38:31 2012 -0500

    ostbuild: Various cleanups

 src/ostbuild/pyostbuild/builtin_build.py   |   12 ++++++++----
 src/ostbuild/pyostbuild/builtin_resolve.py |    6 ++----
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_build.py b/src/ostbuild/pyostbuild/builtin_build.py
index 900a170..a957afe 100755
--- a/src/ostbuild/pyostbuild/builtin_build.py
+++ b/src/ostbuild/pyostbuild/builtin_build.py
@@ -48,14 +48,17 @@ class OstbuildBuild(builtins.Builtin):
     def _fixup_submodule_references(self, cwd):
         submodules_status_text = run_sync_get_output(['git', 'submodule', 'status'], cwd=cwd)
         submodule_status_lines = submodules_status_text.split('\n')
+        have_submodules = False
         for line in submodule_status_lines:
             if line == '': continue
+            have_submodules = True
             line = line[1:]
             (sub_checksum, sub_name) = line.split(' ', 1)
             sub_url = run_sync_get_output(['git', 'config', '-f', '.gitmodules',
                                            'submodule.%s.url' % (sub_name, )], cwd=cwd)
             mirrordir = self._mirror_for_url(sub_url)
             run_sync(['git', 'config', 'submodule.%s.url' % (sub_name, ), 'file://' + mirrordir], cwd=cwd)
+        return have_submodules
 
     def _get_vcs_checkout(self, name, keytype, mirrordir, branch):
         checkoutdir = os.path.join(self.workdir, 'src')
@@ -75,10 +78,11 @@ class OstbuildBuild(builtins.Builtin):
                   '--no-checkout', mirrordir, tmp_dest])
         run_sync(['git', 'checkout', '-q', branch], cwd=tmp_dest)
         run_sync(['git', 'submodule', 'init'], cwd=tmp_dest)
-        self._fixup_submodule_references(tmp_dest)
-        run_sync(['linux-user-chroot',
-                  '--unshare-net', '--chdir', tmp_dest, '/',
-                  '/usr/bin/git', 'submodule', 'update'])
+        have_submodules = self._fixup_submodule_references(tmp_dest)
+        if have_submodules:
+            run_sync(['linux-user-chroot',
+                      '--unshare-net', '--chdir', tmp_dest, '/',
+                      '/usr/bin/git', 'submodule', 'update'])
         os.rename(tmp_dest, dest)
         return dest
 
diff --git a/src/ostbuild/pyostbuild/builtin_resolve.py b/src/ostbuild/pyostbuild/builtin_resolve.py
index c1f20c0..f4e4521 100755
--- a/src/ostbuild/pyostbuild/builtin_resolve.py
+++ b/src/ostbuild/pyostbuild/builtin_resolve.py
@@ -65,7 +65,7 @@ class OstbuildResolve(builtins.Builtin):
             parent = os.path.dirname(tmp_checkout)
             if not os.path.isdir(parent):
                 os.makedirs(parent)
-            run_sync(['git', 'clone', '-b', branch, mirror, tmp_checkout])
+            run_sync(['git', 'clone', '-q', '--no-checkout', mirror, tmp_checkout])
             run_sync(['git', 'checkout', '-q', '-f', current_vcs_version], cwd=tmp_checkout)
             submodules = []
             submodules_status_text = run_sync_get_output(['git', 'submodule', 'status'], cwd=tmp_checkout)
@@ -164,10 +164,8 @@ class OstbuildResolve(builtins.Builtin):
             (keytype, uri) = self._parse_src_key(component['src'])
             try:
                 fetch_components.index(component['name'])
-                continue
             except ValueError, e:
-                pass
-            mirrordir = self._ensure_vcs_mirror(keytype, uri, component['branch'])
+                mirrordir = self._ensure_vcs_mirror(keytype, uri, component['branch'])
             revision = buildutil.get_git_version_describe(mirrordir,
                                                           component['branch'])
             component['revision'] = revision



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