[gnome-ostree] build: Various fixes to ensure we're using the right repo



commit 35189fdefe927525bf16f8f044923866da910633
Author: Colin Walters <walters verbum org>
Date:   Fri Oct 12 09:15:50 2012 -0400

    build: Various fixes to ensure we're using the right repo

 Makefile-ostbuild.am                     |    1 -
 src/ostbuild/ostree-build-yocto          |   10 +++--
 src/ostbuild/pyostbuild/builtin_build.py |    6 +---
 src/ostbuild/pyostbuild/builtin_init.py  |   58 ------------------------------
 src/ostbuild/pyostbuild/builtins.py      |   11 +++---
 src/ostbuild/pyostbuild/main.py          |    1 -
 6 files changed, 13 insertions(+), 74 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index b8035c4..3169220 100644
--- a/Makefile-ostbuild.am
+++ b/Makefile-ostbuild.am
@@ -47,7 +47,6 @@ pyostbuild_PYTHON =					\
 	src/ostbuild/pyostbuild/builtin_prefix.py	\
 	src/ostbuild/pyostbuild/builtin_repoweb_json.py	\
 	src/ostbuild/pyostbuild/builtin_resolve.py	\
-	src/ostbuild/pyostbuild/builtin_init.py	\
 	src/ostbuild/pyostbuild/builtin_source_diff.py	\
 	src/ostbuild/pyostbuild/builtins.py		\
 	src/ostbuild/pyostbuild/filemonitor.py		\
diff --git a/src/ostbuild/ostree-build-yocto b/src/ostbuild/ostree-build-yocto
index 73ff288..a0c84f0 100644
--- a/src/ostbuild/ostree-build-yocto
+++ b/src/ostbuild/ostree-build-yocto
@@ -26,13 +26,15 @@ die () {
 }
 
 usage () {
-    echo "$0: SRCDIR BUILDDIR"
+    echo "$0: SRCDIR BUILDDIR REPO"
 }
 
 srcdir=$1
 test -n "${srcdir}" || (usage; exit 1)
 builddir=$2
 test -n "${builddir}" || (usage; exit 1)
+repo_path=$3
+test -n "${repo_path}" || (usage; exit 1)
 
 src_gitrev=$(cd ${srcdir} && git rev-parse HEAD)
 built_gitrev_path=${builddir}/built-revision
@@ -66,9 +68,9 @@ DISTRO = "gnomeosdistro"
 EOF
 fi
 
-if ! test -L ${builddir}/repo; then
-    ln -s tmp-eglibc/deploy/images/repo ${builddir}/repo
-fi
+IMAGEDIR=${builddir}/tmp-eglibc/deploy/images
+mkdir -p "${IMAGEDIR}"
+ln -sf ${repo_path} ${IMAGEDIR}/repo
 
 echo "Building ${src_gitrev}"
 bitbake gnomeos-contents-{runtime,devel}
diff --git a/src/ostbuild/pyostbuild/builtin_build.py b/src/ostbuild/pyostbuild/builtin_build.py
index cb5ac60..4bd9b17 100755
--- a/src/ostbuild/pyostbuild/builtin_build.py
+++ b/src/ostbuild/pyostbuild/builtin_build.py
@@ -508,14 +508,10 @@ and the manifest input."""
                              overwrite=False)
 
         builddir = os.path.join(self.workdir, 'build-' + basemeta['name'])
-        image_deploy_dir = os.path.join(builddir, 'tmp-eglibc', 'deploy', 'images')
-        repo_link = os.path.join(image_deploy_dir, 'repo')
-        if not os.path.islink(repo_link):
-            os.symlink(self.repo, repo_link)
 
         cmd = ['linux-user-chroot', '--unshare-pid', '/',
                os.path.join(LIBDIR, 'ostbuild', 'ostree-build-yocto'),
-               checkoutdir, builddir]
+               checkoutdir, builddir, self.repo]
         # We specifically want to kill off any environment variables jhbuild
         # may have set.
         run_sync(cmd, env=buildutil.BUILD_ENV)
diff --git a/src/ostbuild/pyostbuild/builtins.py b/src/ostbuild/pyostbuild/builtins.py
index a4d5cd4..52e3202 100755
--- a/src/ostbuild/pyostbuild/builtins.py
+++ b/src/ostbuild/pyostbuild/builtins.py
@@ -73,13 +73,11 @@ class Builtin(object):
         self.ostbuildrc = ostbuildrc
 
         self.mirrordir = os.path.expanduser(ostbuildrc.get_key('mirrordir'))
-        if not os.path.isdir(self.mirrordir):
-            fatal("Specified mirrordir '%s' is not a directory" % (self.mirrordir, ))
+        fileutil.ensure_dir(self.mirrordir)
         self.workdir = os.path.expanduser(ostbuildrc.get_key('workdir'))
-        if not os.path.isdir(self.workdir):
-            fatal("Specified workdir '%s' is not a directory" % (self.workdir, ))
-
+        fileutil.ensure_dir(self.workdir)
         self.snapshot_dir = os.path.join(self.workdir, 'snapshots')
+        fileutil.ensure_dir(self.snapshot_dir)
         self.patchdir = os.path.join(self.workdir, 'patches')
 
     def get_component_snapshot(self, name):
@@ -173,6 +171,9 @@ class Builtin(object):
             self.repo = os.path.expanduser(repo)
         else:
             self.repo = os.path.join(self.workdir, 'repo')
+            if not os.path.isdir(os.path.join(self.repo, 'objects')):
+                fileutil.ensure_dir(self.repo)
+                run_sync(['ostree', '--repo=' + self.repo, 'init', '--mode=archive-z'])
 
     def parse_prefix(self, prefix):
         if prefix is not None:
diff --git a/src/ostbuild/pyostbuild/main.py b/src/ostbuild/pyostbuild/main.py
index 8a0bf27..7676f26 100755
--- a/src/ostbuild/pyostbuild/main.py
+++ b/src/ostbuild/pyostbuild/main.py
@@ -28,7 +28,6 @@ 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_prefix
 from . import builtin_privhelper_deploy_qemu



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