diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-02-19 15:29:48 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-02-19 15:33:14 +0000 |
commit | c7ad7b41011f4cfab14a21d0363a511b86969e86 (patch) | |
tree | 84bb2c13905fe8d3017ee1dc0eefef4d891f8a15 /morphlib | |
parent | 24866984ce4c1e2e444ea4aaf2d4860c60ac617f (diff) | |
download | morph-c7ad7b41011f4cfab14a21d0363a511b86969e86.tar.gz |
Add pre- and post-commands for chunks
We already have configure-commands. Add pre-configure-commands and
post-configure-commands. Likewise for build-command, test-commands,
and install-commands.
Added-to-pacify: Rob Kendrick
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/builder2.py | 18 | ||||
-rw-r--r-- | morphlib/buildsystem.py | 12 | ||||
-rw-r--r-- | morphlib/morph2.py | 8 | ||||
-rw-r--r-- | morphlib/morph2_tests.py | 16 |
4 files changed, 50 insertions, 4 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py index 68768699..e2b5d020 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -411,10 +411,20 @@ class ChunkBuilder(BuilderBase): relative_destdir = self.staging_area.relative(destdir) self.build_env.env['DESTDIR'] = relative_destdir - steps = [('configure', False), - ('build', True), - ('test', False), - ('install', False)] + steps = [ + ('pre-configure', False), + ('configure', False), + ('post-configure', False), + ('pre-build', True), + ('build', True), + ('post-build', True), + ('pre-test', False), + ('test', False), + ('post-test', False), + ('pre-install', False), + ('install', False), + ('post-install', False), + ] for step, in_parallel in steps: with self.build_watch(step): key = '%s-commands' % step diff --git a/morphlib/buildsystem.py b/morphlib/buildsystem.py index 6287063a..4d3f94c4 100644 --- a/morphlib/buildsystem.py +++ b/morphlib/buildsystem.py @@ -32,10 +32,18 @@ class BuildSystem(object): ''' def __init__(self): + self.pre_configure_commands = [] self.configure_commands = [] + self.post_configure_commands = [] + self.pre_build_commands = [] self.build_commands = [] + self.post_build_commands = [] + self.pre_test_commands = [] self.test_commands = [] + self.post_test_commands = [] + self.pre_install_commands = [] self.install_commands = [] + self.post_install_commands = [] def __getitem__(self, key): key = '_'.join(key.split('-')) @@ -82,6 +90,7 @@ class DummyBuildSystem(BuildSystem): name = 'dummy' def __init__(self): + BuildSystem.__init__(self) self.configure_commands = ['echo dummy configure'] self.build_commands = ['echo dummy build'] self.test_commands = ['echo dummy test'] @@ -98,6 +107,7 @@ class AutotoolsBuildSystem(BuildSystem): name = 'autotools' def __init__(self): + BuildSystem.__init__(self) self.configure_commands = [ 'export NOCONFIGURE=1; ' + 'if [ -e autogen ]; then ./autogen; ' + @@ -134,6 +144,7 @@ class PythonDistutilsBuildSystem(BuildSystem): name = 'python-distutils' def __init__(self): + BuildSystem.__init__(self) self.configure_commands = [ ] self.build_commands = [ @@ -160,6 +171,7 @@ class CPANBuildSystem(BuildSystem): name = 'cpan' def __init__(self): + BuildSystem.__init__(self) self.configure_commands = [ 'perl Makefile.PL INSTALLDIRS=perl ' 'INSTALLARCHLIB="$PREFIX/lib/perl" ' diff --git a/morphlib/morph2.py b/morphlib/morph2.py index 6e24765e..efcc0cae 100644 --- a/morphlib/morph2.py +++ b/morphlib/morph2.py @@ -32,10 +32,18 @@ class Morphology(object): static_defaults = { 'chunk': [ ('description', ''), + ('pre-configure-commands', None), ('configure-commands', None), + ('post-configure-commands', None), + ('pre-build-commands', None), ('build-commands', None), + ('post-build-commands', None), + ('pre-test-commands', None), ('test-commands', None), + ('post-test-commands', None), + ('pre-install-commands', None), ('install-commands', None), + ('post-install-commands', None), ('chunks', []), ('max-jobs', None), ('build-system', 'manual') diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py index 7a819556..c1449f5e 100644 --- a/morphlib/morph2_tests.py +++ b/morphlib/morph2_tests.py @@ -35,10 +35,18 @@ class MorphologyTests(unittest.TestCase): self.assertEqual(m['name'], 'foo') self.assertEqual(m['kind'], 'chunk') self.assertEqual(m['build-system'], 'manual') + self.assertEqual(m['pre-configure-commands'], None) self.assertEqual(m['configure-commands'], None) + self.assertEqual(m['post-configure-commands'], None) + self.assertEqual(m['pre-build-commands'], None) self.assertEqual(m['build-commands'], None) + self.assertEqual(m['post-build-commands'], None) + self.assertEqual(m['pre-test-commands'], None) self.assertEqual(m['test-commands'], None) + self.assertEqual(m['post-test-commands'], None) + self.assertEqual(m['pre-install-commands'], None) self.assertEqual(m['install-commands'], None) + self.assertEqual(m['post-install-commands'], None) self.assertEqual(m['max-jobs'], None) self.assertEqual(m['chunks'], []) @@ -53,10 +61,18 @@ class MorphologyTests(unittest.TestCase): self.assertEqual(m['name'], 'foo') self.assertEqual(m['kind'], 'chunk') self.assertEqual(m['build-system'], 'manual') + self.assertEqual(m['pre-configure-commands'], None) self.assertEqual(m['configure-commands'], None) + self.assertEqual(m['post-configure-commands'], None) + self.assertEqual(m['pre-build-commands'], None) self.assertEqual(m['build-commands'], None) + self.assertEqual(m['post-build-commands'], None) + self.assertEqual(m['pre-test-commands'], None) self.assertEqual(m['test-commands'], None) + self.assertEqual(m['post-test-commands'], None) + self.assertEqual(m['pre-install-commands'], None) self.assertEqual(m['install-commands'], None) + self.assertEqual(m['post-install-commands'], None) self.assertEqual(m['max-jobs'], None) self.assertEqual(m['chunks'], []) |