ostbuild: Adapt "build" to newly updated expanded manifest
This commit is contained in:
parent
c71770c08c
commit
ff81b21bcf
|
|
@ -165,7 +165,6 @@ class OstbuildBuild(builtins.Builtin):
|
||||||
|
|
||||||
args = ['ostree', '--repo=' + self.repo,
|
args = ['ostree', '--repo=' + self.repo,
|
||||||
'commit', '-b', buildname, '-s', 'Build',
|
'commit', '-b', buildname, '-s', 'Build',
|
||||||
'--add-metadata-string=ostbuild-name=' + artifact_meta['name'],
|
|
||||||
'--add-metadata-string=ostbuild-revision=' + artifact_meta['revision'],
|
'--add-metadata-string=ostbuild-revision=' + artifact_meta['revision'],
|
||||||
'--owner-uid=0', '--owner-gid=0', '--no-xattrs',
|
'--owner-uid=0', '--owner-gid=0', '--no-xattrs',
|
||||||
'--skip-if-unchanged']
|
'--skip-if-unchanged']
|
||||||
|
|
@ -187,30 +186,35 @@ class OstbuildBuild(builtins.Builtin):
|
||||||
os.unlink(statoverride_path)
|
os.unlink(statoverride_path)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _compose_arch(self, architecture, components):
|
def _compose(self, components):
|
||||||
runtime_base = buildutil.manifest_base(self.manifest, 'runtime', architecture)
|
base_ref = 'bases/%s:/' % (self.manifest['base'], )
|
||||||
devel_base = buildutil.manifest_base(self.manifest, 'devel', architecture)
|
contents = [base_ref]
|
||||||
runtime_contents = [runtime_base + ':/']
|
|
||||||
devel_contents = [devel_base + ':/']
|
# HACK
|
||||||
|
manifest_build_name = self.manifest['name']
|
||||||
|
is_runtime = manifest_build_name.endswith('-runtime')
|
||||||
|
# HACK - we should really name builds just like e.g. gnomeos-3.4-i686
|
||||||
|
if is_runtime:
|
||||||
|
manifest_build_name = manifest_build_name[:-len('-runtime')] + '-devel'
|
||||||
|
|
||||||
for component in components:
|
for component in components:
|
||||||
branch = buildutil.manifest_buildname(self.manifest, component, architecture)
|
branch = 'artifacts/%s/%s/%s' % (manifest_build_name,
|
||||||
runtime_contents.append(branch + ':/runtime')
|
component['name'],
|
||||||
devel_contents.append(branch + ':/runtime')
|
component['branch'])
|
||||||
# For now just hardcode docs going in devel
|
contents.append(branch + ':/runtime')
|
||||||
devel_contents.append(branch + ':/doc')
|
if not is_runtime:
|
||||||
devel_contents.append(branch + ':/devel')
|
# For now just hardcode docs going in devel
|
||||||
|
contents.append(branch + ':/doc')
|
||||||
|
contents.append(branch + ':/devel')
|
||||||
|
|
||||||
buildutil.compose(self.repo, '%s-%s-%s' % (self.manifest['name'], architecture, 'runtime'),
|
buildutil.compose(self.repo, self.manifest['name'], contents)
|
||||||
runtime_contents)
|
|
||||||
buildutil.compose(self.repo, '%s-%s-%s' % (self.manifest['name'], architecture, 'devel'),
|
|
||||||
devel_contents)
|
|
||||||
|
|
||||||
def execute(self, argv):
|
def execute(self, argv):
|
||||||
parser = argparse.ArgumentParser(description=self.short_description)
|
parser = argparse.ArgumentParser(description=self.short_description)
|
||||||
parser.add_argument('--skip-built', action='store_true')
|
parser.add_argument('--skip-built', action='store_true')
|
||||||
parser.add_argument('--recompose', action='store_true')
|
parser.add_argument('--recompose', action='store_true')
|
||||||
parser.add_argument('--start-at')
|
parser.add_argument('--start-at')
|
||||||
|
parser.add_argument('--manifest', required=True)
|
||||||
parser.add_argument('--shell-on-failure', action='store_true')
|
parser.add_argument('--shell-on-failure', action='store_true')
|
||||||
parser.add_argument('--debug-shell', action='store_true')
|
parser.add_argument('--debug-shell', action='store_true')
|
||||||
parser.add_argument('components', nargs='*')
|
parser.add_argument('components', nargs='*')
|
||||||
|
|
@ -224,8 +228,7 @@ class OstbuildBuild(builtins.Builtin):
|
||||||
self.buildopts.shell_on_failure = args.shell_on_failure
|
self.buildopts.shell_on_failure = args.shell_on_failure
|
||||||
self.buildopts.skip_built = args.skip_built
|
self.buildopts.skip_built = args.skip_built
|
||||||
|
|
||||||
build_manifest_path = os.path.join(self.workdir, 'snapshot.json')
|
self.manifest = json.load(open(args.manifest))
|
||||||
self.manifest = json.load(open(build_manifest_path))
|
|
||||||
|
|
||||||
components = self.manifest['components']
|
components = self.manifest['components']
|
||||||
if args.recompose:
|
if args.recompose:
|
||||||
|
|
@ -259,10 +262,8 @@ class OstbuildBuild(builtins.Builtin):
|
||||||
|
|
||||||
for component in build_components[start_at_index:]:
|
for component in build_components[start_at_index:]:
|
||||||
index = components.index(component)
|
index = components.index(component)
|
||||||
for architecture in self.manifest['architectures']:
|
self._build_one_component(component)
|
||||||
self._build_one_component(component, architecture)
|
|
||||||
|
|
||||||
for architecture in self.manifest['architectures']:
|
self._compose(components)
|
||||||
self._compose_arch(architecture, components)
|
|
||||||
|
|
||||||
builtins.register(OstbuildBuild)
|
builtins.register(OstbuildBuild)
|
||||||
|
|
|
||||||
|
|
@ -234,9 +234,10 @@ class OstbuildResolve(builtins.Builtin):
|
||||||
else:
|
else:
|
||||||
snapshot['components'] = devel_components
|
snapshot['components'] = devel_components
|
||||||
|
|
||||||
snapshot_name = '%s-%s-%s.snapshot' % (arch_manifest['name'], architecture, component_type)
|
snapshot['name'] = '%s-%s-%s' % (arch_manifest['name'], architecture, component_type)
|
||||||
snapshot['name'] = snapshot_name
|
snapshot_base = snapshot['base']
|
||||||
out_snapshot = os.path.join(self.workdir, snapshot_name)
|
snapshot['base'] = snapshot_base + '-%s-%s' % (architecture, component_type)
|
||||||
|
out_snapshot = os.path.join(self.workdir, snapshot['name'] + '.snapshot')
|
||||||
f = open(out_snapshot, 'w')
|
f = open(out_snapshot, 'w')
|
||||||
json.dump(snapshot, f, indent=4, sort_keys=True)
|
json.dump(snapshot, f, indent=4, sort_keys=True)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue