ostbuild: Various cleanups
This commit is contained in:
parent
e83a7fa46b
commit
660ff7422f
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue