[jhbuild/wip/packaging: 1/5] Add a "top_builddir" (defaults to $prefix/_jhbuild), change PackageDB to use it
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/wip/packaging: 1/5] Add a "top_builddir" (defaults to $prefix/_jhbuild), change PackageDB to use it
- Date: Tue, 24 May 2011 18:47:24 +0000 (UTC)
commit 798418911ccbd4dc24a869fca0e31727ee3e0ae7
Author: Colin Walters <walters verbum org>
Date: Mon Apr 25 19:02:42 2011 -0400
Add a "top_builddir" (defaults to $prefix/_jhbuild), change PackageDB to use it
For a future change to use "make install DESTDIR=", which in turn will
enable things like "jhbuild uninstall".
This patch adds an explicit concept in jhbuild of a directory for
build state called "top_builddir", distinct from the installation
tree.
We previously had something like this in the $prefix/share/jhbuild
directory, which is where it put the packagedb.xml file.
Move packagedb.xml in there, and migrate an old DB file.
https://bugzilla.gnome.org/show_bug.cgi?id=647231
jhbuild/config.py | 3 ++-
jhbuild/defaults.jhbuildrc | 1 +
jhbuild/frontends/buildscript.py | 23 +++++++++++++++--------
3 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/jhbuild/config.py b/jhbuild/config.py
index 315eda2..f127515 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -40,7 +40,8 @@ _defaults_file = os.path.join(os.path.dirname(__file__), 'defaults.jhbuildrc')
_default_jhbuildrc = os.path.join(os.environ['HOME'], '.jhbuildrc')
_known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
- 'checkoutroot', 'buildroot', 'autogenargs', 'makeargs',
+ 'checkoutroot', 'buildroot', 'top_buildroot',
+ 'autogenargs', 'makeargs',
'installprog', 'repos', 'branches', 'noxvfb', 'xvfbargs',
'builddir_pattern', 'module_autogenargs', 'module_makeargs',
'interact', 'buildscript', 'nonetwork',
diff --git a/jhbuild/defaults.jhbuildrc b/jhbuild/defaults.jhbuildrc
index 3da35c2..cebd624 100644
--- a/jhbuild/defaults.jhbuildrc
+++ b/jhbuild/defaults.jhbuildrc
@@ -33,6 +33,7 @@ tags = []
# directories
prefix = '/opt/gnome'
+top_builddir = '_jhbuild' # If a relative path, prefix will be prepended
checkoutroot = os.path.expanduser('~/checkout/gnome')
tarballdir = None # will default to checkoutroot
buildroot = None # if set, packages will be built with srcdir!=builddir
diff --git a/jhbuild/frontends/buildscript.py b/jhbuild/frontends/buildscript.py
index a97b28c..0141fcd 100644
--- a/jhbuild/frontends/buildscript.py
+++ b/jhbuild/frontends/buildscript.py
@@ -37,6 +37,15 @@ class BuildScript:
if not os.access(self.config.prefix, os.R_OK|os.W_OK|os.X_OK):
raise FatalError(_('install prefix (%s) must be writable') % self.config.prefix)
+ if not os.path.isabs(self.config.top_builddir):
+ self.config.top_builddir = os.path.join(self.config.prefix, self.config.top_builddir)
+ if not os.path.exists(self.config.top_builddir):
+ try:
+ os.makedirs(self.config.top_builddir)
+ except OSError:
+ raise FatalError(
+ _('working directory (%s) can not be created') % self.config.top_builddir)
+
if not os.path.exists(self.config.checkoutroot):
try:
os.makedirs(self.config.checkoutroot)
@@ -55,14 +64,12 @@ class BuildScript:
if not os.access(self.config.copy_dir, os.R_OK|os.W_OK|os.X_OK):
raise FatalError(_('checkout copy dir (%s) must be writable') % self.config.copy_dir)
- packagedbdir = os.path.join(self.config.prefix, 'share', 'jhbuild')
- try:
- if not os.path.isdir(packagedbdir):
- os.makedirs(packagedbdir)
- except OSError:
- raise FatalError(_('could not create directory %s') % packagedbdir)
- self.packagedb = packagedb.PackageDB(os.path.join(packagedbdir,
- 'packagedb.xml'))
+ legacy_pkgdb_path = os.path.join(self.config.prefix, 'share', 'jhbuild', 'packagedb.xml')
+ new_pkgdb_path = os.path.join(self.config.top_builddir, 'packagedb.xml')
+ if os.path.isfile(legacy_pkgdb_path):
+ os.rename(legacy_pkgdb_path, new_pkgdb_path)
+
+ self.packagedb = packagedb.PackageDB(new_pkgdb_path)
def execute(self, command, hint=None, cwd=None, extra_env=None):
'''Executes the given command.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]