[Checkins] SVN: zc.recipe.cmmi/trunk/ Support packages that need to be built slightly differently.
Shane Hathaway
shane at hathawaymix.org
Tue Aug 11 04:05:33 EDT 2009
Log message for revision 102643:
Support packages that need to be built slightly differently.
- Added options for changing the name of the configure script and
overriding the ``--prefix`` parameter.
- Moved the core "configure; make; make install" command sequence to a
method that can be overridden in other recipes, to support packages
whose installation process is slightly different.
Changed:
U zc.recipe.cmmi/trunk/CHANGES.txt
U zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/README.txt
U zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py
U zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/downloadcache.txt
U zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/tests.py
-=-
Modified: zc.recipe.cmmi/trunk/CHANGES.txt
===================================================================
--- zc.recipe.cmmi/trunk/CHANGES.txt 2009-08-11 08:05:12 UTC (rev 102642)
+++ zc.recipe.cmmi/trunk/CHANGES.txt 2009-08-11 08:05:33 UTC (rev 102643)
@@ -7,7 +7,13 @@
- Use zc.buildout's download API. As this allows MD5 checking, added the
md5sum and patch-md5sum options.
+- Added options for changing the name of the configure script and
+ overriding the ``--prefix`` parameter.
+- Moved the core "configure; make; make install" command sequence to a
+ method that can be overridden in other recipes, to support packages
+ whose installation process is slightly different.
+
1.2.0 (2009-05-18)
==================
Modified: zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/README.txt
===================================================================
--- zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/README.txt 2009-08-11 08:05:12 UTC (rev 102642)
+++ zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/README.txt 2009-08-11 08:05:33 UTC (rev 102643)
@@ -3,6 +3,7 @@
>>> ls(distros)
- bar.tgz
+ - baz.tgz
- foo.tgz
>>> distros_url = start_server(distros)
@@ -195,6 +196,33 @@
echo installing foo
installing foo
+It is also possible to support configure commands other than "./configure":
+
+ >>> write('buildout.cfg',
+ ... """
+ ... [buildout]
+ ... parts = foo
+ ...
+ ... [foo]
+ ... recipe = zc.recipe.cmmi
+ ... url = %s/baz.tgz
+ ... source-directory-contains = configure.py
+ ... configure-command = ./configure.py
+ ... configure-options =
+ ... --bindir=bin
+ ... """ % distros_url)
+
+ >>> print system('bin/buildout'),
+ Uninstalling foo.
+ Installing foo.
+ foo: Downloading http://localhost//baz.tgz
+ foo: Unpacking and configuring
+ configuring foo --bindir=bin
+ echo building foo
+ building foo
+ echo installing foo
+ installing foo
+
When downloading a source archive or a patch, we can optionally make sure of
its authenticity by supplying an MD5 checksum that must be matched. If it
matches, we'll not be bothered with the check by buildout's output:
Modified: zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py
===================================================================
--- zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py 2009-08-11 08:05:12 UTC (rev 102642)
+++ zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py 2009-08-11 08:05:33 UTC (rev 102643)
@@ -60,6 +60,14 @@
else:
self.environ = {}
+ self.source_directory_contains = self.options.get(
+ 'source-directory-contains', 'configure')
+ self.configure_cmd = self.options.get(
+ 'configure-command', './configure')
+ self.configure_options = self.options.get('configure-options', None)
+ if self.configure_options:
+ self.configure_options = ' '.join(self.configure_options.split())
+
self.shared = options.get('shared', None)
if self.shared:
if os.path.isdir(self.shared):
@@ -119,8 +127,8 @@
try:
os.chdir(tmp)
try:
- if not (os.path.exists('configure') or
- os.path.exists(self.autogen)):
+ if not (os.path.exists(self.source_directory_contains) or
+ (self.autogen and os.path.exists(self.autogen))):
entries = os.listdir(tmp)
if len(entries) == 1:
os.chdir(entries[0])
@@ -133,16 +141,13 @@
if self.autogen is not '':
logger.info('auto generating configure files')
system("./%s" % self.autogen)
- if not os.path.exists('configure'):
+ if not os.path.exists(self.source_directory_contains):
entries = os.listdir(tmp)
if len(entries) == 1:
os.chdir(entries[0])
else:
raise ValueError("Couldn't find configure")
- system("./configure --prefix=%s %s" %
- (dest, self.extra_options))
- system("make")
- system("make install")
+ self.cmmi(dest)
finally:
os.chdir(here)
except:
@@ -153,3 +158,22 @@
def update(self):
pass
+
+ def cmmi(self, dest):
+ """Do the 'configure; make; make install' command sequence.
+
+ When this is called, the current working directory is the
+ source directory. The 'dest' parameter specifies the
+ installation prefix.
+
+ This can be overridden by subclasses to support packages whose
+ command sequence is different.
+ """
+ options = self.configure_options
+ if options is None:
+ options = '--prefix=%s' % dest
+ if self.extra_options:
+ options += ' %s' % self.extra_options
+ system("%s %s" % (self.configure_cmd, options))
+ system("make")
+ system("make install")
Modified: zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/downloadcache.txt
===================================================================
--- zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/downloadcache.txt 2009-08-11 08:05:12 UTC (rev 102642)
+++ zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/downloadcache.txt 2009-08-11 08:05:33 UTC (rev 102643)
@@ -19,6 +19,7 @@
>>> ls(distros)
- bar.tgz
+ - baz.tgz
- foo.tgz
>>> distros = start_server(distros)
Modified: zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/tests.py
===================================================================
--- zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/tests.py 2009-08-11 08:05:12 UTC (rev 102642)
+++ zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/tests.py 2009-08-11 08:05:33 UTC (rev 102643)
@@ -26,6 +26,7 @@
zc.buildout.testing.buildoutSetUp(test)
zc.buildout.testing.install_develop('zc.recipe.cmmi', test)
distros = test.globs['distros'] = test.globs['tmpdir']('distros')
+
tarpath = os.path.join(distros, 'foo.tgz')
tar = tarfile.open(tarpath, 'w:gz')
configure = configure_template % sys.executable
@@ -47,6 +48,14 @@
info.mode = 0755
tar.addfile(info, StringIO.StringIO(autogen))
+ tarpath = os.path.join(distros, 'baz.tgz')
+ tar = tarfile.open(tarpath, 'w:gz')
+ configure = configure_template % sys.executable
+ info = tarfile.TarInfo('configure.py')
+ info.size = len(configure)
+ info.mode = 0755
+ tar.addfile(info, StringIO.StringIO(configure))
+
def add(tar, name, src, mode=None):
info.size = len(src)
if mode is not None:
More information about the Checkins
mailing list