summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-07 16:46:03 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-07 16:46:03 +0000
commitf624dc956fcb059273edcffdde2d942be2124914 (patch)
tree33a5cc5eae9e8775cbd3f7bdd383493c578f2cef /morphlib
parentab90f3561ce43dba089686c743ecf0c4d6f33d31 (diff)
parent48af89acfd6ae207ecb8e4548f9f0ded8b0cabde (diff)
downloadmorph-f624dc956fcb059273edcffdde2d942be2124914.tar.gz
Merge branch 'liw/pre-commands' into staging
Conflicts: morphlib/morph2.py
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/builder2.py18
-rw-r--r--morphlib/buildsystem.py14
-rw-r--r--morphlib/morph2.py8
-rw-r--r--morphlib/morph2_tests.py16
4 files changed, 51 insertions, 5 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index 82a95820..73745d66 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -377,10 +377,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..a6645eb2 100644
--- a/morphlib/buildsystem.py
+++ b/morphlib/buildsystem.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Codethink Limited
+# Copyright (C) 2012-2013 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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 ee58ecdc..3cdf49a9 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),
('devices', None),
('chunks', []),
('max-jobs', None),
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py
index d2973d5c..49be9c8c 100644
--- a/morphlib/morph2_tests.py
+++ b/morphlib/morph2_tests.py
@@ -37,10 +37,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'], [])
@@ -55,10 +63,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'], [])