[ostree] ostbuild: Rename shadow-repo-init -> init



commit 8785fefda8ce005715ebb5ed8f0c8d1a07d83bd9
Author: Colin Walters <walters verbum org>
Date:   Wed May 2 07:55:11 2012 -0400

    ostbuild: Rename shadow-repo-init -> init

 Makefile-ostbuild.am                               |    2 +-
 ...builtin_shadow_repo_init.py => builtin_init.py} |   16 +++++++++++-----
 src/ostbuild/pyostbuild/main.py                    |    2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index 4069558..b561a28 100644
--- a/Makefile-ostbuild.am
+++ b/Makefile-ostbuild.am
@@ -35,7 +35,7 @@ pyostbuild_PYTHON =					\
 	src/ostbuild/pyostbuild/builtin_resolve.py	\
 	src/ostbuild/pyostbuild/builtin_modify_snapshot.py	\
 	src/ostbuild/pyostbuild/builtin_tree_to_bin.py	\
-	src/ostbuild/pyostbuild/builtin_shadow_repo_init.py	\
+	src/ostbuild/pyostbuild/builtin_init.py	\
 	src/ostbuild/pyostbuild/builtin_status.py	\
 	src/ostbuild/pyostbuild/builtins.py		\
 	src/ostbuild/pyostbuild/filemonitor.py		\
diff --git a/src/ostbuild/pyostbuild/builtin_shadow_repo_init.py b/src/ostbuild/pyostbuild/builtin_init.py
similarity index 78%
rename from src/ostbuild/pyostbuild/builtin_shadow_repo_init.py
rename to src/ostbuild/pyostbuild/builtin_init.py
index 03211d2..de45eb4 100755
--- a/src/ostbuild/pyostbuild/builtin_shadow_repo_init.py
+++ b/src/ostbuild/pyostbuild/builtin_init.py
@@ -22,13 +22,14 @@ import select,time
 import argparse
 
 from . import builtins
+from . import ostbuildrc
 from .ostbuildlog import log, fatal
 from . import fileutil
 from .subprocess_helpers import run_sync, run_sync_get_output
 
-class OstbuildShadowRepoInit(builtins.Builtin):
-    name = "shadow-repo-init"
-    short_description = "Initialize a user-mode shadow repository for /ostree/repo"
+class OstbuildInit(builtins.Builtin):
+    name = "init"
+    short_description = "Initialize working state"
 
     def __init__(self):
         builtins.Builtin.__init__(self)
@@ -38,15 +39,20 @@ class OstbuildShadowRepoInit(builtins.Builtin):
 
         args = parser.parse_args(argv)
         
+        mirrordir = os.path.expanduser(ostbuildrc.get_key('mirrordir'))
+        fileutil.ensure_dir(mirrordir)
+        workdir = os.path.expanduser(ostbuildrc.get_key('workdir'))
+        fileutil.ensure_dir(workdir)
+
         self.parse_config()
 
         path = os.path.join(self.workdir, 'shadow-repo')
         fileutil.ensure_dir(path)
         if os.path.isdir(os.path.join(path, 'objects')):
-            log("Shadow repository '%s' appears to already exist" % (path, ))
+            log("note: shadow repository '%s' already exists" % (path, ))
         else:
             run_sync(['ostree', '--repo=' + path, 'init', '--archive'])
             run_sync(['ostree', '--repo=' + path, 'config', 'set', 'core.parent', '/ostree/repo'])
             log("Created shadow repository: %s" % (path, ))
     
-builtins.register(OstbuildShadowRepoInit)
+builtins.register(OstbuildInit)
diff --git a/src/ostbuild/pyostbuild/main.py b/src/ostbuild/pyostbuild/main.py
index 8437769..488a563 100755
--- a/src/ostbuild/pyostbuild/main.py
+++ b/src/ostbuild/pyostbuild/main.py
@@ -35,7 +35,7 @@ from . import builtin_prefix
 from . import builtin_resolve
 from . import builtin_modify_snapshot
 from . import builtin_tree_to_bin
-from . import builtin_shadow_repo_init
+from . import builtin_init
 from . import builtin_status
 
 def usage(ecode):



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