summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.com>2017-06-23 15:48:00 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-06-28 14:40:04 +0900
commit042390bd85a6fae2f38c26166ecf23730c4e4156 (patch)
treea4ca44de80f407f1007db0fa2de398428479a757
parentfcbd0dfb50e83b6d4346656228a15ffeee4b0c78 (diff)
downloadbuildstream-042390bd85a6fae2f38c26166ecf23730c4e4156.tar.gz
Add script templates
-rwxr-xr-x[-rw-r--r--]buildstream/_site.py6
-rwxr-xr-xbuildstream/data/build-all.sh.in40
-rwxr-xr-xbuildstream/data/build-module.sh.in41
-rwxr-xr-xbuildstream/element.py1
-rwxr-xr-xsetup.py3
5 files changed, 90 insertions, 1 deletions
diff --git a/buildstream/_site.py b/buildstream/_site.py
index d7b34203c..f11e05062 100644..100755
--- a/buildstream/_site.py
+++ b/buildstream/_site.py
@@ -45,3 +45,9 @@ ostree_push = os.path.join(root, 'data', 'ostree-push')
# ostree-pull-ssh shell script
ostree_pull_ssh = os.path.join(root, 'data', 'ostree-pull-ssh')
+
+# Script template to call module building scripts
+build_all_template = os.path.join(root, 'data', 'build-all.sh.in')
+
+# Module building script template
+build_module_template = os.path.join(root, 'data', 'build-module.sh.in')
diff --git a/buildstream/data/build-all.sh.in b/buildstream/data/build-all.sh.in
new file mode 100755
index 000000000..2d343ca0e
--- /dev/null
+++ b/buildstream/data/build-all.sh.in
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# DO NOT EDIT THIS FILE
+#
+# This is a build script generated by
+# [BuildStream](https://wiki.gnome.org/Projects/BuildStream/).
+#
+# Builds all given modules using their respective scripts.
+
+set -eu
+
+echo "Buildstream native bootstrap script"
+
+export PATH='/usr/bin:/usr/sbin/:/sbin:/bin:/tools/bin:/tools/sbin'
+export SRCDIR='./source'
+
+SUCCESS=false
+CURRENT_MODULE='None'
+
+echo 'Setting up build environment...'
+
+except() {{
+ if [ "$SUCCESS" = true ]; then
+ echo "Done!"
+ else
+ echo "Error building module ${{CURRENT_MODULE}}."
+ fi
+}}
+trap "except" EXIT
+
+for module in {modules}; do
+ CURRENT_MODULE="$module"
+ "$SRCDIR/build-$module"
+
+ if [ -e /sbin/ldconfig ]; then
+ /sbin/ldcondig || true;
+ fi
+done
+
+SUCCESS=true
diff --git a/buildstream/data/build-module.sh.in b/buildstream/data/build-module.sh.in
new file mode 100755
index 000000000..033a84654
--- /dev/null
+++ b/buildstream/data/build-module.sh.in
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# DO NOT EDIT THIS FILE
+#
+# This is a build script generated by
+# [BuildStream](https://wiki.gnome.org/Projects/BuildStream/).
+#
+# Builds the module {name}.
+
+set -e
+
+# Prepare the build environment
+echo 'Building {name}'
+
+if [ -d '{build_root}' ]; then
+ rm -rf '{build_root}'
+fi
+
+if [ -d '{install_root}' ]; then
+ rm -rf '{install_root}'
+fi
+
+mkdir -p '{build_root}'
+mkdir -p '{install_root}'
+
+cp -a "$SRCDIR/{name}" '{build_root}/{name}'
+cd '{build_root}/{name}'
+
+export PREFIX='{install_root}'
+
+export {variables}
+
+# Build the module
+{commands}
+
+rm -rf '{build_root}/{name}'
+
+# Install the module
+echo 'Installing {name}'
+
+(cd '{install_root}'; find . | cpio -umdp /)
diff --git a/buildstream/element.py b/buildstream/element.py
index 8600bbf98..f992129c2 100755
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -42,6 +42,7 @@ from . import utils
from . import _signals
from . import _site
+
class Scope(Enum):
"""Types of scope for a given element"""
diff --git a/setup.py b/setup.py
index dfb9336fd..6877aa7ce 100755
--- a/setup.py
+++ b/setup.py
@@ -105,7 +105,8 @@ setup(name='BuildStream',
license='LGPL',
use_scm_version=True,
packages=find_packages(),
- package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml', 'data/*.yaml',
+ package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
+ 'data/*.yaml', 'data/*.sh.in',
'data/ostree-push', 'data/ostree-pull-ssh']},
data_files=[('share/man/man1', list_man_pages())],
install_requires=[