ostbuild: Add ostree-revision in buildroots, bin-to-src
First, for binary snapshots we need to include the exact revision of the architecture buildroot. To do that, introduce "architecture-buildroots2". Second, for bin-to-src, we'd like to allow "partial" builds. So while we do expand everything to source, *also* include the binary ostree-revision. This will allow building just one component, while reusing the previously built binaries.
This commit is contained in:
parent
d1b23f0807
commit
6fbe15fc05
|
|
@ -57,7 +57,10 @@ class OstbuildBinToSrc(builtins.Builtin):
|
||||||
src_components[name] = meta
|
src_components[name] = meta
|
||||||
|
|
||||||
for target in src_snapshot['targets']:
|
for target in src_snapshot['targets']:
|
||||||
del target['base']['ostree-revision']
|
for content_item in target['contents']:
|
||||||
|
name = content_item['name']
|
||||||
|
rev = bin_components[name]
|
||||||
|
content_item['ostree-revision'] = rev
|
||||||
|
|
||||||
return src_snapshot
|
return src_snapshot
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,13 @@ class OstbuildBuildComponents(builtins.Builtin):
|
||||||
'rev-parse', base_name])
|
'rev-parse', base_name])
|
||||||
base['ostree-revision'] = base_revision
|
base['ostree-revision'] = base_revision
|
||||||
|
|
||||||
|
if 'architecture-buildroots2' in bin_snapshot:
|
||||||
|
for arch,buildroot in bin_snapshot['architecture-buildroots2'].iteritems():
|
||||||
|
name = buildroot['name']
|
||||||
|
rev = run_sync_get_output(['ostree', '--repo=' + self.repo,
|
||||||
|
'rev-parse', name])
|
||||||
|
buildroot['ostree-revision'] = rev
|
||||||
|
|
||||||
component_refs = []
|
component_refs = []
|
||||||
for name in components.iterkeys():
|
for name in components.iterkeys():
|
||||||
for architecture in component_architectures[name]:
|
for architecture in component_architectures[name]:
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,27 @@ class OstbuildChrootCompileOne(builtins.Builtin):
|
||||||
dependencies = buildutil.build_depends(component_name, components)
|
dependencies = buildutil.build_depends(component_name, components)
|
||||||
component = components.get(component_name)
|
component = components.get(component_name)
|
||||||
|
|
||||||
buildroots = self.snapshot['architecture-buildroots']
|
ref_to_rev = {}
|
||||||
base_devel_name = 'bases/' + buildroots[architecture]
|
|
||||||
|
|
||||||
refs_to_resolve = [base_devel_name]
|
arch_buildroot_name = None
|
||||||
checkout_trees = [(base_devel_name, '/')]
|
arch_buildroot_rev = None
|
||||||
|
if 'architecture-buildroots2' in self.snapshot:
|
||||||
|
buildroots = self.snapshot['architecture-buildroots2']
|
||||||
|
arch_buildroot = buildroots[architecture]
|
||||||
|
arch_buildroot_name = arch_buildroot['name']
|
||||||
|
arch_buildroot_rev = arch_buildroot.get('ostree-revision')
|
||||||
|
else:
|
||||||
|
buildroots = self.snapshot['architecture-buildroots']
|
||||||
|
arch_rev_suffix = buildsroots['architecture']
|
||||||
|
arch_buildroot_name = 'bases/' + arch_rev_suffix
|
||||||
|
|
||||||
|
if arch_buildroot_rev is None:
|
||||||
|
arch_buildroot_rev = run_sync_get_output(['ostree', '--repo=' + self.repo, 'rev-parse',
|
||||||
|
arch_buildroot_name]).strip()
|
||||||
|
|
||||||
|
ref_to_rev[arch_buildroot_name] = arch_buildroot_rev
|
||||||
|
checkout_trees = [(arch_buildroot_name, '/')]
|
||||||
|
refs_to_resolve = []
|
||||||
for dependency_name in dependencies:
|
for dependency_name in dependencies:
|
||||||
buildname = 'components/%s/%s' % (dependency_name, architecture)
|
buildname = 'components/%s/%s' % (dependency_name, architecture)
|
||||||
refs_to_resolve.append(buildname)
|
refs_to_resolve.append(buildname)
|
||||||
|
|
@ -67,7 +83,6 @@ class OstbuildChrootCompileOne(builtins.Builtin):
|
||||||
checkout_trees.append((buildname, '/devel'))
|
checkout_trees.append((buildname, '/devel'))
|
||||||
|
|
||||||
resolved_refs = self._resolve_refs(refs_to_resolve)
|
resolved_refs = self._resolve_refs(refs_to_resolve)
|
||||||
ref_to_rev = {}
|
|
||||||
for ref,rev in zip(refs_to_resolve, resolved_refs):
|
for ref,rev in zip(refs_to_resolve, resolved_refs):
|
||||||
ref_to_rev[ref] = rev
|
ref_to_rev[ref] = rev
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,12 @@ class OstbuildResolve(builtins.Builtin):
|
||||||
snapshot['architecture-buildroots'] = {}
|
snapshot['architecture-buildroots'] = {}
|
||||||
for architecture in manifest_architectures:
|
for architecture in manifest_architectures:
|
||||||
snapshot['architecture-buildroots'][architecture] = '%s-%s-devel' % (base_prefix, architecture)
|
snapshot['architecture-buildroots'][architecture] = '%s-%s-devel' % (base_prefix, architecture)
|
||||||
|
# Lame bit neeeded because I didn't have enough foresight to use an object
|
||||||
|
# for this in the first place, and I don't want to break backwards compatibility
|
||||||
|
# right now.
|
||||||
|
snapshot['architecture-buildroots2'] = {}
|
||||||
|
for architecture in manifest_architectures:
|
||||||
|
snapshot['architecture-buildroots2'][architecture] = {'name': 'bases/%s-%s-devel' % (base_prefix, architecture)}
|
||||||
|
|
||||||
components_by_name = {}
|
components_by_name = {}
|
||||||
component_ordering = []
|
component_ordering = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue