ostbuild: More work on partial builds
This commit is contained in:
parent
eae69513a7
commit
92244c80cc
|
|
@ -40,7 +40,7 @@ def parse_src_key(srckey):
|
||||||
if idx < 0:
|
if idx < 0:
|
||||||
raise ValueError("Invalid SRC uri=%s" % (srckey, ))
|
raise ValueError("Invalid SRC uri=%s" % (srckey, ))
|
||||||
keytype = srckey[:idx]
|
keytype = srckey[:idx]
|
||||||
if keytype not in ['git', 'dirty-git']:
|
if keytype not in ['git', 'local']:
|
||||||
raise ValueError("Unsupported SRC uri=%s" % (srckey, ))
|
raise ValueError("Unsupported SRC uri=%s" % (srckey, ))
|
||||||
uri = srckey[idx+1:]
|
uri = srckey[idx+1:]
|
||||||
return (keytype, uri)
|
return (keytype, uri)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class OstbuildBuildComponents(builtins.Builtin):
|
||||||
name = '%s/%s' % (basename, architecture)
|
name = '%s/%s' % (basename, architecture)
|
||||||
buildname = 'components/%s' % (name, )
|
buildname = 'components/%s' % (name, )
|
||||||
|
|
||||||
current_vcs_version = component['revision']
|
current_vcs_version = component.get('revision')
|
||||||
|
|
||||||
# TODO - deduplicate this with chroot_compile_one
|
# TODO - deduplicate this with chroot_compile_one
|
||||||
current_meta_io = StringIO()
|
current_meta_io = StringIO()
|
||||||
|
|
@ -88,7 +88,8 @@ class OstbuildBuildComponents(builtins.Builtin):
|
||||||
'rev-parse', buildname],
|
'rev-parse', buildname],
|
||||||
stderr=open('/dev/null', 'w'),
|
stderr=open('/dev/null', 'w'),
|
||||||
none_on_error=True)
|
none_on_error=True)
|
||||||
if previous_build_version is not None:
|
if (current_vcs_version is not None
|
||||||
|
and previous_build_version is not None):
|
||||||
log("Previous build of '%s' is %s" % (name, previous_build_version))
|
log("Previous build of '%s' is %s" % (name, previous_build_version))
|
||||||
|
|
||||||
previous_metadata_text = run_sync_get_output(['ostree', '--repo=' + self.repo,
|
previous_metadata_text = run_sync_get_output(['ostree', '--repo=' + self.repo,
|
||||||
|
|
@ -103,7 +104,6 @@ class OstbuildBuildComponents(builtins.Builtin):
|
||||||
log("Metadata is unchanged from previous")
|
log("Metadata is unchanged from previous")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
current_vcs_version = component['revision']
|
|
||||||
previous_metadata = json.loads(previous_metadata_text)
|
previous_metadata = json.loads(previous_metadata_text)
|
||||||
previous_vcs_version = previous_metadata['revision']
|
previous_vcs_version = previous_metadata['revision']
|
||||||
if current_vcs_version == previous_vcs_version:
|
if current_vcs_version == previous_vcs_version:
|
||||||
|
|
@ -123,7 +123,8 @@ class OstbuildBuildComponents(builtins.Builtin):
|
||||||
fileutil.ensure_dir(checkoutdir)
|
fileutil.ensure_dir(checkoutdir)
|
||||||
component_src = os.path.join(checkoutdir, basename)
|
component_src = os.path.join(checkoutdir, basename)
|
||||||
run_sync(['ostbuild', 'checkout', '--snapshot=' + self.snapshot_path,
|
run_sync(['ostbuild', 'checkout', '--snapshot=' + self.snapshot_path,
|
||||||
'--clean', '--overwrite', basename], cwd=checkoutdir)
|
'--checkoutdir=' + component_src,
|
||||||
|
'--clean', '--overwrite', basename])
|
||||||
|
|
||||||
artifact_meta = dict(component)
|
artifact_meta = dict(component)
|
||||||
|
|
||||||
|
|
@ -207,9 +208,9 @@ class OstbuildBuildComponents(builtins.Builtin):
|
||||||
|
|
||||||
if len(component_refs_to_resolve) > 0:
|
if len(component_refs_to_resolve) > 0:
|
||||||
resolved_refs = self._resolve_refs(component_refs_to_resolve)
|
resolved_refs = self._resolve_refs(component_refs_to_resolve)
|
||||||
for name,rev in zip(components.iterkeys(), resolved_refs):
|
for name,rev in zip(component_refs_to_resolve, resolved_refs):
|
||||||
for architecture in component_architectures[name]:
|
assert name.startswith('components/')
|
||||||
archname = '%s/%s' % (name, architecture)
|
archname = name[len('components/'):]
|
||||||
component_revisions[archname] = rev
|
component_revisions[archname] = rev
|
||||||
|
|
||||||
bin_snapshot['component-revisions'] = component_revisions
|
bin_snapshot['component-revisions'] = component_revisions
|
||||||
|
|
|
||||||
|
|
@ -42,35 +42,32 @@ class OstbuildCheckout(builtins.Builtin):
|
||||||
parser.add_argument('--overwrite', action='store_true')
|
parser.add_argument('--overwrite', action='store_true')
|
||||||
parser.add_argument('--prefix')
|
parser.add_argument('--prefix')
|
||||||
parser.add_argument('--snapshot')
|
parser.add_argument('--snapshot')
|
||||||
|
parser.add_argument('--checkoutdir')
|
||||||
parser.add_argument('-a', '--active-tree', action='store_true')
|
parser.add_argument('-a', '--active-tree', action='store_true')
|
||||||
parser.add_argument('--clean', action='store_true')
|
parser.add_argument('--clean', action='store_true')
|
||||||
parser.add_argument('components', nargs='*')
|
parser.add_argument('component')
|
||||||
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
self.parse_config()
|
self.parse_config()
|
||||||
|
|
||||||
if len(args.components) > 0:
|
|
||||||
checkout_components = args.components
|
|
||||||
else:
|
|
||||||
checkout_components = [os.path.basename(os.getcwd())]
|
|
||||||
|
|
||||||
if args.active_tree:
|
if args.active_tree:
|
||||||
self.parse_active_branch()
|
self.parse_active_branch()
|
||||||
else:
|
else:
|
||||||
self.parse_snapshot(args.prefix, args.snapshot)
|
self.parse_snapshot(args.prefix, args.snapshot)
|
||||||
|
|
||||||
for component_name in checkout_components:
|
component_name = args.component
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
component = self.get_component_meta(component_name)
|
component = self.get_component_meta(component_name)
|
||||||
(keytype, uri) = buildutil.parse_src_key(component['src'])
|
(keytype, uri) = buildutil.parse_src_key(component['src'])
|
||||||
checkoutdir = os.path.join(os.getcwd(), component_name)
|
|
||||||
fileutil.ensure_parent_dir(checkoutdir)
|
|
||||||
|
|
||||||
is_dirty = (keytype == 'dirty-git')
|
is_local = (keytype == 'local')
|
||||||
|
|
||||||
if is_dirty:
|
if is_local:
|
||||||
|
if args.checkoutdir:
|
||||||
|
checkoutdir = args.checkoutdir
|
||||||
# Kind of a hack, but...
|
# Kind of a hack, but...
|
||||||
if os.path.islink(checkoutdir):
|
if os.path.islink(checkoutdir):
|
||||||
os.unlink(checkoutdir)
|
os.unlink(checkoutdir)
|
||||||
|
|
@ -78,13 +75,20 @@ class OstbuildCheckout(builtins.Builtin):
|
||||||
shutil.rmtree(checkoutdir)
|
shutil.rmtree(checkoutdir)
|
||||||
os.symlink(uri, checkoutdir)
|
os.symlink(uri, checkoutdir)
|
||||||
else:
|
else:
|
||||||
|
checkoutdir = uri
|
||||||
|
else:
|
||||||
|
if args.checkoutdir:
|
||||||
|
checkoutdir = args.checkoutdir
|
||||||
|
else:
|
||||||
|
checkoutdir = os.path.join(os.getcwd(), component_name)
|
||||||
|
fileutil.ensure_parent_dir(checkoutdir)
|
||||||
vcs.get_vcs_checkout(self.mirrordir, keytype, uri, checkoutdir,
|
vcs.get_vcs_checkout(self.mirrordir, keytype, uri, checkoutdir,
|
||||||
component['revision'],
|
component['revision'],
|
||||||
overwrite=args.overwrite)
|
overwrite=args.overwrite)
|
||||||
|
|
||||||
if args.clean:
|
if args.clean:
|
||||||
if is_dirty:
|
if is_local:
|
||||||
log("note: ignoring --clean argument due to \"dirty-git:\" specification")
|
log("note: ignoring --clean argument due to \"local:\" specification")
|
||||||
else:
|
else:
|
||||||
vcs.clean(keytype, checkoutdir)
|
vcs.clean(keytype, checkoutdir)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue