summaryrefslogtreecommitdiff
path: root/tests.build
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2013-02-25 10:13:34 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-13 15:20:02 +0000
commit0cc3de60d6282d22108ea59f169a0749be5e59ea (patch)
tree2bef9ed79c0b4d9e128b3095e72ccce4a525a532 /tests.build
parent84807d4d7c23f45d4f0a0f87e6c7ba7ba7470936 (diff)
downloadmorph-0cc3de60d6282d22108ea59f169a0749be5e59ea.tar.gz
Add 'prefix' property for chunks within strata
Morph no longer supports setting the prefix using the --prefix argument / setting. This was only used in tests and during bootstrap. If a chunk build-depends on a chunk within a stratum which has a custom prefix, that prefix is appended to the PATH in the build environment.
Diffstat (limited to 'tests.build')
-rwxr-xr-xtests.build/build-system-cpan.script24
-rwxr-xr-xtests.build/build-system-python-distutils.script25
-rwxr-xr-xtests.build/prefix.script87
-rw-r--r--tests.build/prefix.stdout8
4 files changed, 142 insertions, 2 deletions
diff --git a/tests.build/build-system-cpan.script b/tests.build/build-system-cpan.script
index 19e45e42..b1823eb5 100755
--- a/tests.build/build-system-cpan.script
+++ b/tests.build/build-system-cpan.script
@@ -54,7 +54,29 @@ git add hello.morph
git commit --quiet -m 'convert hello into a perl cpan project'
-"$SRCDIR/scripts/test-morph" build-morphology --prefix=/ \
+# Set 'prefix' of hello to something custom
+cd "$DATADIR/morphs-repo"
+cat <<EOF > hello-stratum.morph
+{
+ "name": "hello-stratum",
+ "kind": "stratum",
+ "chunks": [
+ {
+ "name": "hello",
+ "repo": "test:chunk-repo",
+ "ref": "farrokh",
+ "build-depends": [],
+ "build-mode": "test",
+ "prefix": "/"
+ }
+ ]
+}
+EOF
+git add hello-stratum.morph
+git commit -q -m "Set custom install prefix for hello"
+
+
+"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
diff --git a/tests.build/build-system-python-distutils.script b/tests.build/build-system-python-distutils.script
index cebb9f84..a0469528 100755
--- a/tests.build/build-system-python-distutils.script
+++ b/tests.build/build-system-python-distutils.script
@@ -51,7 +51,30 @@ git add hello.morph
git commit --quiet -m 'convert hello into a python project'
-"$SRCDIR/scripts/test-morph" build-morphology --prefix= \
+
+# Set 'prefix' of hello to something custom
+cd "$DATADIR/morphs-repo"
+cat <<EOF > hello-stratum.morph
+{
+ "name": "hello-stratum",
+ "kind": "stratum",
+ "chunks": [
+ {
+ "name": "hello",
+ "repo": "test:chunk-repo",
+ "ref": "farrokh",
+ "build-depends": [],
+ "build-mode": "test",
+ "prefix": ""
+ }
+ ]
+}
+EOF
+git add hello-stratum.morph
+git commit -q -m "Set custom install prefix for hello"
+
+
+"$SRCDIR/scripts/test-morph" build-morphology \
test:morphs-repo master hello-system
for chunk in "$DATADIR/cache/artifacts/"*.chunk.*
diff --git a/tests.build/prefix.script b/tests.build/prefix.script
new file mode 100755
index 00000000..e9b8ecd2
--- /dev/null
+++ b/tests.build/prefix.script
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+# Copyright (C) 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+## Honour 'prefix' attribute for chunks within stratum morphs
+
+set -eu
+
+# Create two chunks which print out PATH and PREFIX from their environment.
+cd "$DATADIR/chunk-repo"
+git checkout -q master
+cat <<\EOF > xyzzy.morph
+{
+ "name": "xyzzy",
+ "kind": "chunk",
+ "configure-commands": [
+ "echo First chunk: prefix $PREFIX"
+ ]
+}
+EOF
+
+cat <<\EOF > plugh.morph
+{
+ "name": "plugh",
+ "kind": "chunk",
+ "configure-commands": [
+ "echo Second chunk: prefix $PREFIX",
+ "echo Path: $(echo $PATH | grep -o '/plover')"
+ ]
+}
+EOF
+
+git add xyzzy.morph
+git add plugh.morph
+git commit -q -m "Add chunks"
+
+# Change stratum to include those two chunks, and use a custom install prefix
+cd "$DATADIR/morphs-repo"
+cat <<EOF > hello-stratum.morph
+{
+ "name": "hello-stratum",
+ "kind": "stratum",
+ "chunks": [
+ {
+ "name": "xyzzy",
+ "repo": "test:chunk-repo",
+ "ref": "master",
+ "build-depends": [],
+ "build-mode": "test",
+ "prefix": "/plover"
+ },
+ {
+ "name": "plugh",
+ "repo": "test:chunk-repo",
+ "ref": "master",
+ "build-mode": "test",
+ "build-depends": [
+ "xyzzy"
+ ]
+ }
+ ]
+}
+EOF
+git add hello-stratum.morph
+git commit -q -m "Update stratum"
+
+"$SRCDIR/scripts/test-morph" build-morphology \
+ test:morphs-repo master hello-system
+
+cd "$DATADIR/cache/artifacts"
+first_chunk=$(ls -1 *.chunk.xyzzy | cut -c -64)
+second_chunk=$(ls -1 *.chunk.plugh | cut -c -64)
+cat $first_chunk.build-log $second_chunk.build-log
diff --git a/tests.build/prefix.stdout b/tests.build/prefix.stdout
new file mode 100644
index 00000000..80c18fae
--- /dev/null
+++ b/tests.build/prefix.stdout
@@ -0,0 +1,8 @@
+# configure
+# # echo First chunk: prefix $PREFIX
+First chunk: prefix /plover
+# configure
+# # echo Second chunk: prefix $PREFIX
+Second chunk: prefix /usr
+# # echo Path: $(echo $PATH | grep -o '/plover')
+Path: /plover