diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am index 41fbbe23..4b6e04db 100644 --- a/Makefile-ostbuild.am +++ b/Makefile-ostbuild.am @@ -39,7 +39,6 @@ pyostbuild_PYTHON = \ src/ostbuild/pyostbuild/builtin_prefix.py \ src/ostbuild/pyostbuild/builtin_resolve.py \ src/ostbuild/pyostbuild/builtin_init.py \ - src/ostbuild/pyostbuild/builtin_status.py \ src/ostbuild/pyostbuild/builtins.py \ src/ostbuild/pyostbuild/filemonitor.py \ src/ostbuild/pyostbuild/fileutil.py \ diff --git a/src/ostbuild/pyostbuild/builtin_git_mirror.py b/src/ostbuild/pyostbuild/builtin_git_mirror.py index 687c0ead..34e23946 100755 --- a/src/ostbuild/pyostbuild/builtin_git_mirror.py +++ b/src/ostbuild/pyostbuild/builtin_git_mirror.py @@ -40,6 +40,7 @@ class OstbuildGitMirror(builtins.Builtin): parser = argparse.ArgumentParser(description=self.short_description) parser.add_argument('--prefix') parser.add_argument('--src-snapshot') + parser.add_argument('--start-at') parser.add_argument('--fetch', action='store_true') parser.add_argument('components', nargs='*') @@ -51,6 +52,9 @@ class OstbuildGitMirror(builtins.Builtin): components = [] for component in self.snapshot['components']: components.append(component['name']) + if args.start_at: + idx = components.index(args.start_at) + components = components[idx:] else: components = args.components diff --git a/src/ostbuild/pyostbuild/builtin_privhelper_run_qemu.py b/src/ostbuild/pyostbuild/builtin_privhelper_run_qemu.py index 7f069d1d..a3e556e5 100755 --- a/src/ostbuild/pyostbuild/builtin_privhelper_run_qemu.py +++ b/src/ostbuild/pyostbuild/builtin_privhelper_run_qemu.py @@ -57,6 +57,7 @@ class OstbuildPrivhelperRunQemu(builtins.Builtin): args = [qemu, '-kernel', kernel, '-initrd', initramfs, '-hda', self.qemu_path, '-m', memory, '-append', extra_args] + log("Running: %s" % (subprocess.list2cmdline(args), )) os.execvp(qemu, args) builtins.register(OstbuildPrivhelperRunQemu) diff --git a/src/ostbuild/pyostbuild/builtin_resolve.py b/src/ostbuild/pyostbuild/builtin_resolve.py index d5b5fd58..0cff9d1d 100755 --- a/src/ostbuild/pyostbuild/builtin_resolve.py +++ b/src/ostbuild/pyostbuild/builtin_resolve.py @@ -45,7 +45,7 @@ class OstbuildResolve(builtins.Builtin): orig_src = component_meta['src'] did_expand = False - for (vcsprefix, expansion) in self.manifest['vcsconfig'].iteritems(): + for (vcsprefix, expansion) in self.snapshot['vcsconfig'].iteritems(): prefix = vcsprefix + ':' if orig_src.startswith(prefix): result['src'] = expansion + orig_src[len(prefix):] @@ -75,7 +75,6 @@ class OstbuildResolve(builtins.Builtin): def execute(self, argv): parser = argparse.ArgumentParser(description=self.short_description) parser.add_argument('--manifest', required=True) - parser.add_argument('--fetch', action='store_true') parser.add_argument('--fetch-patches', action='store_true') parser.add_argument('components', nargs='*') @@ -84,35 +83,14 @@ class OstbuildResolve(builtins.Builtin): self.parse_config() - self.manifest = json.load(open(args.manifest)) - self.prefix = self.manifest['prefix'] + self.snapshot = json.load(open(args.manifest)) + self.prefix = self.snapshot['prefix'] - snapshot = copy.deepcopy(self.manifest) - components = map(self._resolve_component_meta, self.manifest['components']) - snapshot['components'] = components + components = map(self._resolve_component_meta, self.snapshot['components']) + self.snapshot['components'] = components - if args.fetch: - if len(args.components) == 0: - fetch_components = map(lambda x: x['name'], component_source_list) - else: - fetch_components = args.components - for component_name in fetch_components: - found = False - for component in components: - if component['name'] == component_name: - found = True - break - if not found: - fatal("Unknown component %r" % (component_name, )) - (keytype, uri) = vcs.parse_src_key(component['src']) - mirrordir = vcs.ensure_vcs_mirror(self.mirrordir, keytype, uri, None) - log("Running git fetch for %s" % (component['name'], )) - run_sync(['git', 'fetch'], cwd=mirrordir, log_initiation=False) - else: - fetch_components = [] - - global_patches_meta = self._resolve_component_meta(self.manifest['patches']) - snapshot['patches'] = global_patches_meta + global_patches_meta = self._resolve_component_meta(self.snapshot['patches']) + self.snapshot['patches'] = global_patches_meta (keytype, uri) = vcs.parse_src_key(global_patches_meta['src']) mirrordir = vcs.ensure_vcs_mirror(self.mirrordir, keytype, uri, global_patches_meta['branch']) if args.fetch_patches: @@ -135,7 +113,7 @@ class OstbuildResolve(builtins.Builtin): component['revision'] = revision src_db = self.get_src_snapshot_db() - path = src_db.store(snapshot) + path = src_db.store(self.snapshot) log("Source snapshot: %s" % (path, )) builtins.register(OstbuildResolve) diff --git a/src/ostbuild/pyostbuild/builtin_status.py b/src/ostbuild/pyostbuild/builtin_status.py deleted file mode 100755 index f4585d51..00000000 --- a/src/ostbuild/pyostbuild/builtin_status.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 2011,2012 Colin Walters -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# ostbuild-compile-one-make wraps systems that implement the GNOME build API: -# http://people.gnome.org/~walters/docs/build-api.txt - -import os,sys,stat,subprocess,tempfile,re,shutil -import argparse -from StringIO import StringIO -import json - -from . import builtins -from .ostbuildlog import log, fatal -from .subprocess_helpers import run_sync, run_sync_get_output -from . import buildutil - -class OstbuildStatus(builtins.Builtin): - name = "status" - short_description = "Show build status" - - def __init__(self): - builtins.Builtin.__init__(self) - - def execute(self, argv): - parser = argparse.ArgumentParser(description=self.short_description) - parser.add_argument('--manifest', required=True) - - args = parser.parse_args(argv) - - self.parse_config() - self.parse_components_and_targets() - - for name,component in self.components.iteritems(): - buildname = 'components/%s' % (name, ) - build_revision = run_sync_get_output(['ostree', '--repo=' + self.repo, - 'show', - '--print-metadata-key=ostbuild-artifact-version', - buildname], - none_on_error=True) - if build_revision is None: - build_revision = '(not built)' - if build_revision != component['revision']: - build_status = '(needs build)' - else: - build_status = 'ok' - sys.stdout.write('{:<40} {:<95} {:<10}\n'.format(name, - build_revision, build_status)) - -builtins.register(OstbuildStatus) diff --git a/src/ostbuild/pyostbuild/builtins.py b/src/ostbuild/pyostbuild/builtins.py index 62a20b3d..e97c33cd 100755 --- a/src/ostbuild/pyostbuild/builtins.py +++ b/src/ostbuild/pyostbuild/builtins.py @@ -123,7 +123,6 @@ class Builtin(object): return meta def get_component(self, name): - assert self.repo is not None assert self.snapshot is not None for component in self.snapshot['components']: if component['name'] == name: diff --git a/src/ostbuild/pyostbuild/main.py b/src/ostbuild/pyostbuild/main.py index bf5ec941..58a6b01f 100755 --- a/src/ostbuild/pyostbuild/main.py +++ b/src/ostbuild/pyostbuild/main.py @@ -29,17 +29,15 @@ from . import builtin_chroot_compile_one from . import builtin_compile_one from . import builtin_deploy_root from . import builtin_deploy_qemu -from . import builtin_import_tree -from . import builtin_run_qemu from . import builtin_git_mirror -from . import builtin_pull_components +from . import builtin_import_tree +from . import builtin_init +from . import builtin_run_qemu +from . import builtin_prefix from . import builtin_privhelper_deploy_qemu from . import builtin_privhelper_run_qemu -from . import builtin_prefix +from . import builtin_pull_components from . import builtin_resolve -from . import builtin_modify_snapshot -from . import builtin_init -from . import builtin_status def usage(ecode): print "Builtins:"