summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
authorKejia Hu (Terry) <kejia.hu@codethink.co.uk>2015-04-01 11:27:49 +0100
committerBaserock Gerrit <gerrit@baserock.org>2015-05-12 10:40:38 +0000
commit1c45305237674b71bfe3c896a9a14238d30ac9aa (patch)
treee77db66ca8c29f8358f657443ff67641c9aff0f8 /morphlib/plugins
parentfdd6aeb8a09334329004fd22fe1c4b7688443078 (diff)
downloadmorph-1c45305237674b71bfe3c896a9a14238d30ac9aa.tar.gz
Enable native-bootstrap to continue build after recovered from fault.
The previous script creates new directory for the chunk it is going to build without checking whether the directory exists or not. It will fail back if the directory it attempted to creat exists. So if build failed, you always need to remove all .inst directories and let the native-bootstrap script build from the beginning. This patch improves this, and you can run the native bootstrap script direct after resumed without loss previous progress. A condition was added to determine whether previous native bootstrap script was terminated when it was building current chunk. As .build directory for certain chunk only exists during building phase of itself, it was created when started build, and cleaned up after building finished. If .inst for certain chunk exists, the .build directory doesn't, the building of the chunk should be succeed in previous build. The second go of native-bootstrap will skip all successful chunks and start where it left off. Change-Id: I91ae213ecc8c98808efdfd969624291e70f7e0fe
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/cross-bootstrap_plugin.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/morphlib/plugins/cross-bootstrap_plugin.py b/morphlib/plugins/cross-bootstrap_plugin.py
index 9bec5646..eb889645 100644
--- a/morphlib/plugins/cross-bootstrap_plugin.py
+++ b/morphlib/plugins/cross-bootstrap_plugin.py
@@ -127,12 +127,19 @@ class BootstrapSystemBuilder(morphlib.builder.BuilderBase):
for s in self.source.native_sources:
name = s.name
f.write('\necho Building %s\n' % name)
- f.write('mkdir /%s.inst\n' % name)
- f.write('env DESTDIR=/%s.inst $SRCDIR/build-%s\n'
+ f.write('if [ -d /%s.inst/%s.build ]; then\n'
% (name, name))
- f.write('echo Installing %s\n' % name)
- f.write('(cd /%s.inst; find . | cpio -umdp /)\n' % name)
- f.write('if [ -e /sbin/ldconfig ]; then /sbin/ldconfig; fi\n')
+ f.write(' rm -rf /%s.inst\n' % name)
+ f.write('fi\n')
+ f.write('if [ ! -d /%s.inst ]; then\n' % name)
+ f.write(' mkdir /%s.inst\n' % name)
+ f.write(' env DESTDIR=/%s.inst $SRCDIR/build-%s\n'
+ % (name, name))
+ f.write(' echo Installing %s\n' % name)
+ f.write(' (cd /%s.inst; find . | cpio -umdp /)\n' % name)
+ f.write(' if [ -e /sbin/ldconfig ]; '
+ 'then /sbin/ldconfig; fi\n')
+ f.write('fi\n')
f.write(driver_footer)
os.chmod(driver_script, 0o777)
@@ -166,7 +173,7 @@ class BootstrapSystemBuilder(morphlib.builder.BuilderBase):
('install', False),
('post-install', False),
]
-
+
for step, in_parallel in steps:
key = '%s-commands' % step
cmds = m[key]