[ostree: 19/19] ostbuild: Drop dead branch-prefix and pull-components



commit 790d2757f6f884f7b17ea3f0681319296fb21edc
Author: Colin Walters <walters verbum org>
Date:   Wed May 16 09:23:24 2012 -0400

    ostbuild: Drop dead branch-prefix and pull-components
    
    And other various tweaks.

 Makefile-ostbuild.am                               |    2 -
 src/ostbuild/pyostbuild/builtin_branch_prefix.py   |   73 --------------------
 src/ostbuild/pyostbuild/builtin_build.py           |   12 ++-
 src/ostbuild/pyostbuild/builtin_checkout.py        |    6 ++-
 src/ostbuild/pyostbuild/builtin_import_tree.py     |   25 +++----
 src/ostbuild/pyostbuild/builtin_pull_components.py |   58 ----------------
 src/ostbuild/pyostbuild/main.py                    |    2 -
 7 files changed, 24 insertions(+), 154 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index 4b6e04d..a3b855c 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_build.py b/src/ostbuild/pyostbuild/builtin_build.py
index b4b932b..bd89754 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 9341548..153ea8a 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 e83d59a..9fed209 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/main.py b/src/ostbuild/pyostbuild/main.py
index 58a6b01..4f6b27e 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):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]