[ostree] ostbuild: Have resolve use git-mirror rather than duplicating code
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] ostbuild: Have resolve use git-mirror rather than duplicating code
- Date: Sat, 26 May 2012 16:12:16 +0000 (UTC)
commit d3b063cec09ff333d9569f6cc3cdf97cec08c04d
Author: Colin Walters <walters verbum org>
Date: Sat May 26 12:10:51 2012 -0400
ostbuild: Have resolve use git-mirror rather than duplicating code
This also brings us back to a sensible world of:
ostbuild resolve --fetch
Doing both fetch *and* writing out the updated revisions.
src/ostbuild/pyostbuild/builtin_resolve.py | 32 ++++++++++++++++++---------
1 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_resolve.py b/src/ostbuild/pyostbuild/builtin_resolve.py
index a5160f9..d97150c 100755
--- a/src/ostbuild/pyostbuild/builtin_resolve.py
+++ b/src/ostbuild/pyostbuild/builtin_resolve.py
@@ -77,7 +77,7 @@ class OstbuildResolve(builtins.Builtin):
parser = argparse.ArgumentParser(description=self.short_description)
parser.add_argument('--manifest', required=True)
parser.add_argument('--fetch-patches', action='store_true')
- parser.add_argument('components', nargs='*')
+ parser.add_argument('--fetch', action='store_true')
args = parser.parse_args(argv)
self.args = args
@@ -90,25 +90,35 @@ class OstbuildResolve(builtins.Builtin):
components = map(self._resolve_component_meta, self.snapshot['components'])
self.snapshot['components'] = components
+ unique_component_names = set()
+ for component in components:
+ name = component['name']
+
+ if name in unique_component_names:
+ fatal("Duplicate component name '%s'" % (name, ))
+ unique_component_names.add(name)
+
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:
run_sync(['git', 'fetch'], cwd=mirrordir, log_initiation=False)
- revision = buildutil.get_git_version_describe(mirrordir, global_patches_meta['branch'])
- global_patches_meta['revision'] = revision
- unique_component_names = set()
- for component in components:
- (keytype, uri) = vcs.parse_src_key(component['src'])
- name = component['name']
+ git_mirror_args = ['ostbuild', 'git-mirror']
+ if args.fetch:
+ git_mirror_args.append('--fetch')
+ run_sync(git_mirror_args)
- if name in unique_component_names:
- fatal("Duplicate component name '%s'" % (name, ))
- unique_component_names.add(name)
+ patch_revision = buildutil.get_git_version_describe(mirrordir, global_patches_meta['branch'])
+ global_patches_meta['revision'] = patch_revision
- branch_or_tag = component.get('branch') or component.get('tag')
+ for component in components:
+ src = component['src']
+ (keytype, uri) = vcs.parse_src_key(src)
+ branch = component.get('branch')
+ tag = component.get('tag')
+ branch_or_tag = branch or tag
mirrordir = vcs.ensure_vcs_mirror(self.mirrordir, keytype, uri, branch_or_tag)
revision = buildutil.get_git_version_describe(mirrordir, branch_or_tag)
component['revision'] = revision
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]