[ostree: 18/19] ostbuild: Various fixes, removal of dead code



commit 32020e55c8e8e5e0c74a775f2b00335273c41e3f
Author: Colin Walters <walters verbum org>
Date:   Tue May 15 10:11:50 2012 -0400

    ostbuild: Various fixes, removal of dead code

 Makefile-ostbuild.am                               |    1 -
 src/ostbuild/pyostbuild/builtin_git_mirror.py      |    4 +
 .../pyostbuild/builtin_privhelper_run_qemu.py      |    1 +
 src/ostbuild/pyostbuild/builtin_resolve.py         |   38 +++---------
 src/ostbuild/pyostbuild/builtin_status.py          |   63 --------------------
 src/ostbuild/pyostbuild/builtins.py                |    1 -
 src/ostbuild/pyostbuild/main.py                    |   10 +--
 7 files changed, 17 insertions(+), 101 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index 41fbbe2..4b6e04d 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 687c0ea..34e2394 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 7f069d1..a3e556e 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 d5b5fd5..0cff9d1 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/builtins.py b/src/ostbuild/pyostbuild/builtins.py
index 62a20b3..e97c33c 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 bf5ec94..58a6b01 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_git_mirror
 from . import builtin_import_tree
+from . import builtin_init
 from . import builtin_run_qemu
-from . import builtin_git_mirror
-from . import builtin_pull_components
+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:"



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