ostbuild: Various cleanups

This commit is contained in:
Colin Walters 2012-01-18 17:38:31 -05:00
parent e83a7fa46b
commit 660ff7422f
2 changed files with 10 additions and 8 deletions

View File

@ -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,7 +78,8 @@ 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)
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'])

View File

@ -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,9 +164,7 @@ 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'])
revision = buildutil.get_git_version_describe(mirrordir,
component['branch'])