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:
Colin Walters 2012-05-10 14:29:23 -04:00
parent d1b23f0807
commit 6fbe15fc05
4 changed files with 37 additions and 6 deletions

View File

@ -57,7 +57,10 @@ class OstbuildBinToSrc(builtins.Builtin):
src_components[name] = meta
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

View File

@ -187,6 +187,13 @@ class OstbuildBuildComponents(builtins.Builtin):
'rev-parse', base_name])
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 = []
for name in components.iterkeys():
for architecture in component_architectures[name]:

View File

@ -55,11 +55,27 @@ class OstbuildChrootCompileOne(builtins.Builtin):
dependencies = buildutil.build_depends(component_name, components)
component = components.get(component_name)
buildroots = self.snapshot['architecture-buildroots']
base_devel_name = 'bases/' + buildroots[architecture]
ref_to_rev = {}
refs_to_resolve = [base_devel_name]
checkout_trees = [(base_devel_name, '/')]
arch_buildroot_name = None
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:
buildname = 'components/%s/%s' % (dependency_name, architecture)
refs_to_resolve.append(buildname)
@ -67,7 +83,6 @@ class OstbuildChrootCompileOne(builtins.Builtin):
checkout_trees.append((buildname, '/devel'))
resolved_refs = self._resolve_refs(refs_to_resolve)
ref_to_rev = {}
for ref,rev in zip(refs_to_resolve, resolved_refs):
ref_to_rev[ref] = rev

View File

@ -150,6 +150,12 @@ class OstbuildResolve(builtins.Builtin):
snapshot['architecture-buildroots'] = {}
for architecture in manifest_architectures:
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 = {}
component_ordering = []