[ostree] ostbuild: Add ostree-revision in buildroots, bin-to-src
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] ostbuild: Add ostree-revision in buildroots, bin-to-src
- Date: Thu, 10 May 2012 18:32:10 +0000 (UTC)
commit 6fbe15fc05ec533496fa5d8ebcee33b50c364f80
Author: Colin Walters <walters verbum org>
Date: Thu May 10 14:29:23 2012 -0400
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.
src/ostbuild/pyostbuild/builtin_bin_to_src.py | 5 +++-
.../pyostbuild/builtin_build_components.py | 7 +++++
.../pyostbuild/builtin_chroot_compile_one.py | 25 ++++++++++++++++----
src/ostbuild/pyostbuild/builtin_resolve.py | 6 ++++
4 files changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_bin_to_src.py b/src/ostbuild/pyostbuild/builtin_bin_to_src.py
index d3b75b2..d50e911 100755
--- a/src/ostbuild/pyostbuild/builtin_bin_to_src.py
+++ b/src/ostbuild/pyostbuild/builtin_bin_to_src.py
@@ -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
diff --git a/src/ostbuild/pyostbuild/builtin_build_components.py b/src/ostbuild/pyostbuild/builtin_build_components.py
index c09dd9f..010f498 100755
--- a/src/ostbuild/pyostbuild/builtin_build_components.py
+++ b/src/ostbuild/pyostbuild/builtin_build_components.py
@@ -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]:
diff --git a/src/ostbuild/pyostbuild/builtin_chroot_compile_one.py b/src/ostbuild/pyostbuild/builtin_chroot_compile_one.py
index 318cdd3..4615f05 100755
--- a/src/ostbuild/pyostbuild/builtin_chroot_compile_one.py
+++ b/src/ostbuild/pyostbuild/builtin_chroot_compile_one.py
@@ -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 = {}
+
+ 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
- refs_to_resolve = [base_devel_name]
- checkout_trees = [(base_devel_name, '/')]
+ 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
diff --git a/src/ostbuild/pyostbuild/builtin_resolve.py b/src/ostbuild/pyostbuild/builtin_resolve.py
index 9c66cce..721a580 100755
--- a/src/ostbuild/pyostbuild/builtin_resolve.py
+++ b/src/ostbuild/pyostbuild/builtin_resolve.py
@@ -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 = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]