diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am index 4b6e04db..a3b855cb 100644 --- a/Makefile-ostbuild.am +++ b/Makefile-ostbuild.am @@ -23,7 +23,6 @@ EXTRA_DIST += src/ostbuild/ostbuild.in pyostbuilddir=$(libdir)/ostbuild/pyostbuild pyostbuild_PYTHON = \ src/ostbuild/pyostbuild/buildutil.py \ - src/ostbuild/pyostbuild/builtin_branch_prefix.py \ src/ostbuild/pyostbuild/builtin_build.py \ src/ostbuild/pyostbuild/builtin_checkout.py \ src/ostbuild/pyostbuild/builtin_chroot_compile_one.py \ @@ -32,7 +31,6 @@ pyostbuild_PYTHON = \ src/ostbuild/pyostbuild/builtin_deploy_root.py \ src/ostbuild/pyostbuild/builtin_run_qemu.py \ src/ostbuild/pyostbuild/builtin_import_tree.py \ - src/ostbuild/pyostbuild/builtin_pull_components.py \ src/ostbuild/pyostbuild/builtin_privhelper_deploy_qemu.py \ src/ostbuild/pyostbuild/builtin_privhelper_run_qemu.py \ src/ostbuild/pyostbuild/builtin_git_mirror.py \ diff --git a/src/ostbuild/pyostbuild/builtin_branch_prefix.py b/src/ostbuild/pyostbuild/builtin_branch_prefix.py deleted file mode 100755 index 81dcd07a..00000000 --- a/src/ostbuild/pyostbuild/builtin_branch_prefix.py +++ /dev/null @@ -1,73 +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 OstbuildBranchPrefix(builtins.Builtin): - name = "prefix-branch" - short_description = "Copy current source snapshot to new prefix" - - def __init__(self): - builtins.Builtin.__init__(self) - - def execute(self, argv): - parser = argparse.ArgumentParser(description=self.short_description) - parser.add_argument('--prefix') - parser.add_argument('--src-snapshot') - parser.add_argument('newprefix') - - args = parser.parse_args(argv) - self.parse_config() - self.parse_snapshot(args.prefix, args.src_snapshot) - - if args.newprefix == self.prefix: - fatal("Specified prefix %r matches active prefix" % (args.newprefix, )) - - db = self.create_db('src-snapshot', prefix=args.newprefix) - - log("Branching from source snapshot %r" % (self.snapshot_path, )) - - orig_prefix = self.prefix - - forked_snapshot = dict(self.snapshot) - forked_snapshot['prefix'] = args.newprefix - - for target in forked_snapshot['targets']: - name = target['name'] - if not name.startswith(orig_prefix): - fatal("Mismatched name %r in snapshot" % (name, )) - target['name'] = name.replace(orig_prefix, args.newprefix) - - path = db.store(forked_snapshot) - - log("Saved %r" % (path, )) - - run_sync(['ostbuild', 'prefix', args.newprefix], - log_initiation=False, log_success=False) - -builtins.register(OstbuildBranchPrefix) diff --git a/src/ostbuild/pyostbuild/builtin_build.py b/src/ostbuild/pyostbuild/builtin_build.py index b4b932b0..bd897544 100755 --- a/src/ostbuild/pyostbuild/builtin_build.py +++ b/src/ostbuild/pyostbuild/builtin_build.py @@ -106,7 +106,7 @@ class OstbuildBuild(builtins.Builtin): return previous_build_version else: previous_metadata = json.loads(previous_metadata_text) - previous_vcs_version = previous_metadata['revision'] + previous_vcs_version = previous_metadata.get('revision') if current_vcs_version == previous_vcs_version: log("Metadata differs; VCS version unchanged") if self.buildopts.skip_vcs_matches: @@ -123,9 +123,12 @@ class OstbuildBuild(builtins.Builtin): checkoutdir = os.path.join(self.workdir, 'checkouts') component_src = os.path.join(checkoutdir, buildname) fileutil.ensure_parent_dir(component_src) - run_sync(['ostbuild', 'checkout', '--snapshot=' + self.snapshot_path, - '--checkoutdir=' + component_src, - '--clean', '--overwrite', basename]) + child_args = ['ostbuild', 'checkout', '--snapshot=' + self.snapshot_path, + '--checkoutdir=' + component_src, + '--clean', '--overwrite', basename] + if self.args.patches_path: + child_args.append('--patches-path=' + self.args.patches_path) + run_sync(child_args) artifact_meta = dict(component) @@ -262,6 +265,7 @@ class OstbuildBuild(builtins.Builtin): parser = argparse.ArgumentParser(description=self.short_description) parser.add_argument('--prefix') parser.add_argument('--src-snapshot') + parser.add_argument('--patches-path') parser.add_argument('--force-rebuild', action='store_true') parser.add_argument('--skip-vcs-matches', action='store_true') parser.add_argument('--no-compose', action='store_true') diff --git a/src/ostbuild/pyostbuild/builtin_checkout.py b/src/ostbuild/pyostbuild/builtin_checkout.py index 93415488..153ea8a9 100755 --- a/src/ostbuild/pyostbuild/builtin_checkout.py +++ b/src/ostbuild/pyostbuild/builtin_checkout.py @@ -41,6 +41,7 @@ class OstbuildCheckout(builtins.Builtin): parser = argparse.ArgumentParser(description=self.short_description) parser.add_argument('--overwrite', action='store_true') parser.add_argument('--prefix') + parser.add_argument('--patches-path') parser.add_argument('--snapshot') parser.add_argument('--checkoutdir') parser.add_argument('-a', '--active-tree', action='store_true') @@ -94,7 +95,10 @@ class OstbuildCheckout(builtins.Builtin): patches = component.get('patches') if patches is not None: - (patches_keytype, patches_uri) = buildutil.parse_src_key(patches['src']) + if self.args.patches_path: + (patches_keytype, patches_uri) = ('local', self.args.patches_path) + else: + (patches_keytype, patches_uri) = buildutil.parse_src_key(patches['src']) if patches_keytype == 'git': patches_mirror = buildutil.get_mirrordir(self.mirrordir, patches_keytype, patches_uri) vcs.get_vcs_checkout(self.mirrordir, patches_keytype, patches_uri, diff --git a/src/ostbuild/pyostbuild/builtin_import_tree.py b/src/ostbuild/pyostbuild/builtin_import_tree.py index e83d59af..9fed209a 100755 --- a/src/ostbuild/pyostbuild/builtin_import_tree.py +++ b/src/ostbuild/pyostbuild/builtin_import_tree.py @@ -35,18 +35,10 @@ class OstbuildImportTree(builtins.Builtin): def __init__(self): builtins.Builtin.__init__(self) - def bin_snapshot_to_src(self, bin_snapshot): - del bin_snapshot['00ostree-bin-snapshot-version'] - - src_snapshot = dict(bin_snapshot) - src_snapshot['00ostree-src-snapshot-version'] = 0 - - return src_snapshot - def execute(self, argv): parser = argparse.ArgumentParser(description=self.short_description) parser.add_argument('--tree') - parser.add_argument('new_prefix') + parser.add_argument('--prefix') args = parser.parse_args(argv) self.parse_config() @@ -63,17 +55,22 @@ class OstbuildImportTree(builtins.Builtin): (ref, revision) = line.split(' ', 1) ref_to_revision[ref] = revision + if args.prefix: + target_prefix = args.prefix + else: + target_prefix = self.snapshot['prefix'] + (fd, tmppath) = tempfile.mkstemp(suffix='.txt', prefix='ostbuild-import-tree-') f = os.fdopen(fd, 'w') for (ref, rev) in ref_to_revision.iteritems(): if ref.startswith('components/'): ref = ref[len('components/'):] (prefix, subref) = ref.split('/', 1) - newref = 'components/%s/%s' % (args.new_prefix, subref) + newref = 'components/%s/%s' % (target_prefix, subref) elif ref.startswith('bases/'): # hack base_key = '/' + self.snapshot['prefix'] + '-' - replace_key = '/' + args.new_prefix + '-' + replace_key = '/' + target_prefix + '-' newref = ref.replace(base_key, replace_key) else: fatal("Unhandled ref %r; expected components/ or bases/" % (ref, )) @@ -84,10 +81,10 @@ class OstbuildImportTree(builtins.Builtin): run_sync(['ostree', '--repo=' + self.repo, 'write-refs'], stdin=open(tmppath)) - self.snapshot['prefix'] = args.new_prefix + self.snapshot['prefix'] = target_prefix - run_sync(['ostbuild', 'prefix', args.new_prefix]) - self.prefix = args.new_prefix + run_sync(['ostbuild', 'prefix', target_prefix]) + self.prefix = target_prefix db = self.get_src_snapshot_db() path = db.store(self.snapshot) diff --git a/src/ostbuild/pyostbuild/builtin_pull_components.py b/src/ostbuild/pyostbuild/builtin_pull_components.py deleted file mode 100755 index 8716351f..00000000 --- a/src/ostbuild/pyostbuild/builtin_pull_components.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2011 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. - -import os,sys,subprocess,tempfile,re,shutil -import copy -import argparse -import json -import time -import urlparse -from StringIO import StringIO - -from . import builtins -from .ostbuildlog import log, fatal -from . import ostbuildrc -from . import buildutil -from .subprocess_helpers import run_sync, run_sync_get_output -from . import kvfile -from . import odict - -class OstbuildPullComponents(builtins.Builtin): - name = "pull-components" - short_description = "Download the component data for active branch" - - def __init__(self): - builtins.Builtin.__init__(self) - - def execute(self, argv): - parser = argparse.ArgumentParser(description=self.short_description) - parser.add_argument('origin') - parser.add_argument('targets', nargs='*') - parser.add_argument('--prefix') - parser.add_argument('--bin-snapshot') - - args = parser.parse_args(argv) - self.parse_config() - self.parse_bin_snapshot(args.prefix, args.bin_snapshot) - - child_args = ['ostree-pull', '--repo=' + self.repo, '--prefer-loose', - args.origin] - for component,revision in self.bin_snapshot['components'].iteritems(): - child_args.append(revision) - run_sync(child_args) - -builtins.register(OstbuildPullComponents) diff --git a/src/ostbuild/pyostbuild/main.py b/src/ostbuild/pyostbuild/main.py index 58a6b01f..4f6b27ec 100755 --- a/src/ostbuild/pyostbuild/main.py +++ b/src/ostbuild/pyostbuild/main.py @@ -23,7 +23,6 @@ import argparse from . import builtins from . import builtin_build -from . import builtin_branch_prefix from . import builtin_checkout from . import builtin_chroot_compile_one from . import builtin_compile_one @@ -36,7 +35,6 @@ from . import builtin_run_qemu from . import builtin_prefix from . import builtin_privhelper_deploy_qemu from . import builtin_privhelper_run_qemu -from . import builtin_pull_components from . import builtin_resolve def usage(ecode):