Commit 41b4defa authored by Kai Lautaportti's avatar Kai Lautaportti

Removed the is_build_dir() heuristic and clarified the --prefix injection.

parent c4ce889c
Change History Change History
************** **************
1.4.0 (xxxx-xx-xx)
==================
- The ``--prefix`` parameter will be automatically given to the configure
command if and only if a) the ``configure-command`` is not used to specify
a custom configure command and b) ``--prefix`` is not given explicitly in
the ``configure-options`` option. [dokai]
- Removed the ``is_build_dir()`` heuristic.
Previously the recipe inspected the contents of the downloaded package to
determine if it contained the necessary files for building the package (it
checked if files named ``configure`` or ``Makefile.PL`` existed) and gave
an error message if they were missing. However, the recipe is useful for
building many different kinds of software packages and checking for
particular files limited its use severely.
Now the recipe omits any checks for particular files in the downloaded
package. It is recommended that you use the ``md5sum`` option in your part
configuration to assert that you are downloading the package you expect
to. [dokai]
1.3.1 (2010-08-23) 1.3.1 (2010-08-23)
================== ==================
......
...@@ -16,7 +16,12 @@ Supported options ...@@ -16,7 +16,12 @@ Supported options
``prefix`` ``prefix``
Custom installation prefix passed to the ``--prefix`` option of the Custom installation prefix passed to the ``--prefix`` option of the
``configure`` script. Defaults to the location of the part. ``configure`` script. Defaults to the location of the part. Note that this
is a convenience shortcut which assumes that the default ``configure``
command is used to configure the package. If the ``configure-command``
option is used to define a custom configure command no automatic
``--prefix`` injection takes place. You can also set the ``--prefix``
parameter explicitly in ``configure-options``.
``md5sum`` ``md5sum``
MD5 checksum for the package file. If available the MD5 MD5 checksum for the package file. If available the MD5
......
...@@ -14,8 +14,6 @@ class Recipe(object): ...@@ -14,8 +14,6 @@ class Recipe(object):
self.buildout = buildout self.buildout = buildout
self.name = name self.name = name
log = logging.getLogger(self.name)
options['location'] = os.path.join( options['location'] = os.path.join(
buildout['buildout']['parts-directory'], buildout['buildout']['parts-directory'],
self.name) self.name)
...@@ -90,11 +88,14 @@ class Recipe(object): ...@@ -90,11 +88,14 @@ class Recipe(object):
make_cmd = self.options.get('make-binary', 'make').strip() make_cmd = self.options.get('make-binary', 'make').strip()
make_targets = ' '.join(self.options.get('make-targets', 'install').split()) make_targets = ' '.join(self.options.get('make-targets', 'install').split())
configure_cmd = self.options.get('configure-command', './configure')
configure_options = self.options.get('configure-options','').split() configure_options = self.options.get('configure-options','').split()
configure_cmd = self.options.get('configure-command', '').strip()
# Add the prefix only if we're using a configure script if not configure_cmd:
if 'configure' in configure_cmd: # Default to using basic configure script.
configure_cmd = './configure'
# Inject the --prefix parameter if not already present
if '--prefix' not in ' '.join(configure_options):
configure_options.insert(0, '--prefix=%s' % self.options['prefix']) configure_options.insert(0, '--prefix=%s' % self.options['prefix'])
patch_cmd = self.options.get('patch-binary', 'patch').strip() patch_cmd = self.options.get('patch-binary', 'patch').strip()
...@@ -139,16 +140,12 @@ class Recipe(object): ...@@ -139,16 +140,12 @@ class Recipe(object):
try: try:
try: try:
if not self.is_build_dir(): # We support packages that either extract contents to the $PWD
# or alternatively have a single directory.
contents = os.listdir(compile_dir) contents = os.listdir(compile_dir)
if len(contents) == 1: if len(contents) == 1 and os.path.isdir(contents[0]):
# Single container
os.chdir(contents[0]) os.chdir(contents[0])
if not self.is_build_dir():
log.error('Unable to find the configure script')
raise zc.buildout.UserError('Invalid package contents')
else:
log.error('Unable to find the configure script')
raise zc.buildout.UserError('Invalid package contents')
if patches: if patches:
log.info('Applying patches') log.info('Applying patches')
......
...@@ -55,24 +55,6 @@ class NonInformativeTests(unittest.TestCase): ...@@ -55,24 +55,6 @@ class NonInformativeTests(unittest.TestCase):
bo.update(buildout) bo.update(buildout)
return Recipe(bo, name, options) return Recipe(bo, name, options)
def test_is_build_dir__with_configure(self):
recipe = self.make_recipe({}, 'test', {'url' : 'http://no.where.com/'})
os.chdir(self.dir)
self.failIf(recipe.is_build_dir())
configure = self.write_file('configure', 'Dummy configure script')
self.failUnless(os.path.exists(configure))
self.failUnless(recipe.is_build_dir())
def test_is_build_dir__with_makefile_pl(self):
recipe = self.make_recipe({}, 'test', {'url' : 'http://no.where.com/'})
os.chdir(self.dir)
self.failIf(recipe.is_build_dir())
makefile = self.write_file('Makefile.PL', 'Dummy Makefile.PL script')
self.failUnless(os.path.exists(makefile))
self.failUnless(recipe.is_build_dir())
def test_working_directory_restored_after_failure(self): def test_working_directory_restored_after_failure(self):
compile_directory = os.path.join(self.dir, 'compile_directory') compile_directory = os.path.join(self.dir, 'compile_directory')
os.makedirs(compile_directory) os.makedirs(compile_directory)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment