summaryrefslogtreecommitdiff
path: root/yarns/implementations.yarn
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2014-09-24 16:36:34 +0000
committerRichard Maw <richard.maw@gmail.com>2014-10-01 09:30:14 +0000
commit5ac9f90a64cdadaf4d9adb243c6be2f0f4d1764a (patch)
tree35b5792371b7abf9f6bc1bc24c41c44d342ed9d7 /yarns/implementations.yarn
parentb228561897aecea8a60908c354cee79938cf4e31 (diff)
downloadmorph-5ac9f90a64cdadaf4d9adb243c6be2f0f4d1764a.tar.gz
Modify yarns to use test-shell instead of build-mode: test
When all the tests that use build-mode: test are gone, the build mode can be removed.
Diffstat (limited to 'yarns/implementations.yarn')
-rw-r--r--yarns/implementations.yarn301
1 files changed, 155 insertions, 146 deletions
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 52eee01d..e99c1817 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -67,72 +67,47 @@ another to hold a chunk.
# Create a directory for all the git repositories.
mkdir "$DATADIR/gits"
- # Create the chunk repository.
- mkdir "$DATADIR/gits/test-chunk"
-
- run_in "$DATADIR/gits/test-chunk" git init .
- cat > "$DATADIR/gits/test-chunk/test-bin" <<'EOF'
- #!/bin/sh
- echo Hello World
- EOF
- cat > "$DATADIR/gits/test-chunk/test.h" <<'EOF'
- int foo(void);
- EOF
- cat > "$DATADIR/gits/test-chunk/test.pc" <<'EOF'
- prefix=/usr
- includedir=${prefix}/include
- Name: test
- Cflags: -I{includedir}
+ # Create the bootstrap chunk repositories
+ mkdir "$DATADIR/gits/bootstrap-chunk"
+ cd "$DATADIR/gits/bootstrap-chunk"
+ git init .
+ git checkout -b bootstrap
+ cp "$SRCDIR/scripts/test-shell.c" sh.c
+ install /dev/stdin <<'EOF' configure
+ #!/bin/true
EOF
- run_in "$DATADIR/gits/test-chunk" git add .
- run_in "$DATADIR/gits/test-chunk" git commit --allow-empty -m Initial.
+ printf >Makefile '
+ CFLAGS = -D_GNU_SOURCE -static
- # Create a repo for the morphologies.
+ all: sh
- mkdir "$DATADIR/gits/morphs"
+ install: sh
+ \tinstall -D -m755 sh $(DESTDIR)/bin/sh'
+ git add .
+ git commit -m "Add bootstrap shell"
- arch=$(run_morph print-architecture)
- install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/systems/test-system.morph"
- name: test-system
- kind: system
- arch: $arch
- strata:
- - name: test-stratum
- morph: strata/test-stratum.morph
- EOF
+ git checkout --orphan master HEAD
+ # Commit a pre-built test-shell, as a compiler is too heavy to bootstrap
+ make sh
+ mkdir bin
+ mv sh bin/sh
+ git rm -f Makefile sh.c configure
+ git add bin/sh
+ git commit -m "Build bootstrap shell with bootstrap shell"
- install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/strata/test-stratum.morph"
- name: test-stratum
- kind: stratum
- chunks:
- - name: test-chunk
- repo: test:test-chunk
- morph: test-chunk.morph
- unpetrify-ref: master
- ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master)
- build-mode: test
- build-depends: []
- EOF
+ # Create the test chunk repository.
+
+ mkdir "$DATADIR/gits/test-chunk"
+ cd "$DATADIR/gits/test-chunk"
+ git init .
# To verify that chunk splitting works, we have a chunk that installs
# dummy files in all the places that different kinds of files are
# usually installed. e.g. executables in `/bin` and `/usr/bin`
- install -m644 -D /dev/stdin << 'EOF' "$DATADIR/gits/morphs/test-chunk.morph"
- name: test-chunk
- kind: chunk
- build-system: manual
-
- # `install-commands` is a list of shell commands to run. Commands
- # may be on multiple lines, and indeed anything programmatic will
- # benefit from doing so. Arguably we could have just one command,
- # but it's split into multiple so that morph can inform us which
- # command failed without us having to include a lot of status
- # information in the command and look at the error message.
-
- install-commands:
-
+ PREFIX=/usr
+ DESTDIR=.
# It's important that we can test whether executables get
# installed, so we install an empty script into `/usr/bin/test` and
# `/usr/sbin/test`.
@@ -144,10 +119,10 @@ another to hold a chunk.
# that the file exists, rather than its contents, we can use /dev/null
# as the source.
- - |
- for bindir in bin sbin; do
- install -D /dev/null "$DESTDIR/$PREFIX/$bindir/test"
- done
+
+ for bindir in bin sbin; do
+ install -D /dev/null "$DESTDIR/$PREFIX/$bindir/test"
+ done
# We need shared libraries too, sometimes they're libraries to support
# the executables that a chunk provides, sometimes for other chunks.
@@ -158,14 +133,13 @@ another to hold a chunk.
# Shared libraries' file names start with lib and end with `.so`
# for shared-object, with version numbers optionally suffixed.
- - |
- for libdir in lib lib32 lib64; do
- dirpath="$DESTDIR/$PREFIX/$libdir"
- install -D /dev/null "$dirpath/libtest.so"
- ln -s libtest.so "$dirpath/libtest.so.0"
- ln -s libtest.so.0 "$dirpath/libtest.so.0.0"
- ln -s libtest.so.0.0 "$dirpath/libtest.so.0.0.0"
- done
+ for libdir in lib lib32 lib64; do
+ dirpath="$DESTDIR/$PREFIX/$libdir"
+ install -D /dev/null "$dirpath/libtest.so"
+ ln -s libtest.so "$dirpath/libtest.so.0"
+ ln -s libtest.so.0 "$dirpath/libtest.so.0.0"
+ ln -s libtest.so.0.0 "$dirpath/libtest.so.0.0.0"
+ done
# Shared objects aren't the only kind of library, some executable
# binaries count as libraries, such as git's plumbing commands.
@@ -173,8 +147,10 @@ another to hold a chunk.
# In some distributions they go into /lib, in others, and the default
# autotools configuration, they go into /libexec.
- - |
- install -D test-bin "$DESTDIR/$PREFIX/libexec/test-bin"
+ install -D /dev/stdin "$DESTDIR/$PREFIX/libexec/test-bin" <<'EOF'
+ #!/bin/sh
+ echo Hello World
+ EOF
# As well as run-time libraries, there's development files. For C
# this is headers, which describe the API of the libraries, which
@@ -185,9 +161,9 @@ another to hold a chunk.
# Header files go into `include` and end with `.h`. They are not
# executable, so the install command changes the permissions with the
# `-m` option.
-
- - |
- install -D -m 644 test.h "$DESTDIR/$PREFIX/include/test.h"
+ install -D -m 644 /dev/stdin <<'EOF' "$DESTDIR/$PREFIX/include/test.h"
+ int foo(void);
+ EOF
# `pkg-config` is a standard way to locate libraries and get the
# compiler flags needed to build with the library. It's also used
@@ -195,68 +171,138 @@ another to hold a chunk.
# so as well as being found in `lib/pkgconfig`, it can be found in
# `share/pkgconfig`, so we install dummy files to both.
- - |
- for pkgdir in lib lib32 lib64 share; do
- install -D -m 644 test.pc \
- "$DESTDIR/$PREFIX/$pkgdir/pkgconfig/test.pc"
- done
+ for pkgdir in lib lib32 lib64 share; do
+ install -D -m 644 /dev/stdin <<EOF \
+ "$DESTDIR/$PREFIX/$pkgdir/pkgconfig/test.pc"
+ prefix=$PREFIX
+ includedir=\${prefix}/include
+ Name: test
+ Cflags: -I{includedir}
+ EOF
+ done
# Static libraries can be used to build static binaries, which don't
# require their dependencies to be installed. They are typically in
# the form of `.a` archive and `.la` libtool archives.
- - |
- for libdir in lib lib32 lib64; do
- for libname in libtest.a libtest.la; do
- install -D -m 644 /dev/null "$DESTDIR/$PREFIX/$libdir/$libname"
- done
- done
+ for libdir in lib lib32 lib64; do
+ for libname in libtest.a libtest.la; do
+ install -D -m 644 /dev/null "$DESTDIR/$PREFIX/$libdir/$libname"
+ done
+ done
# Packages may also install documentation, this comes in a variety
# of formats, but info pages, man pages and html documentation are
# the most common.
- - |
- for docfile in info/test.info.gz man/man3/test.3.gz doc/test/doc.html; do
- install -D -m 644 /dev/null "$DESTDIR/$PREFIX/share/$docfile"
- done
+ for docfile in info/test.info.gz man/man3/test.3.gz doc/test/doc.html; do
+ install -D -m 644 /dev/null "$DESTDIR/$PREFIX/share/$docfile"
+ done
# Locale covers translations, timezones, keyboard layouts etc. in
# all manner of strange file formats and locations.
# Locale provides various translations for specific messages.
- - |
- install -D -m 644 /dev/null \
- "$DESTDIR/$PREFIX/share/locale/en_GB/LC_MESSAGES/test.mo"
+ install -D -m 644 /dev/null \
+ "$DESTDIR/$PREFIX/share/locale/en_GB/LC_MESSAGES/test.mo"
# Internationalisation (i18n) includes character maps and other data
# such as currency.
- - |
- for localefile in i18n/locales/en_GB charmaps/UTF-8.gz; do
- install -D -m 644 /dev/null "$DESTDIR/$PREFIX/share/$localefile"
- done
+ for localefile in i18n/locales/en_GB charmaps/UTF-8.gz; do
+ install -D -m 644 /dev/null "$DESTDIR/$PREFIX/share/$localefile"
+ done
# Timezones are another kind of localisation.
- - |
- install -D -m 644 /dev/null "$DESTDIR/$PREFIX/share/zoneinfo/UTC"
+ install -D -m 644 /dev/null "$DESTDIR/$PREFIX/share/zoneinfo/UTC"
# We also need a catch rule for everything that doesn't fit into
# the above categories, so to test that, we create some files that
# don't belong in one.
- - |
- for cfgfile in test.conf README; do
- install -D -m 644 /dev/null "$DESTDIR/etc/test.d/$cfgfile"
- done
+ for cfgfile in test.conf README; do
+ install -D -m 644 /dev/null "$DESTDIR/etc/test.d/$cfgfile"
+ done
+
+ git add .
+ git commit --allow-empty -m Initial.
+
+ # Create a repo for the morphologies.
+
+ mkdir "$DATADIR/gits/morphs"
+ cd "$DATADIR/gits/morphs"
+ git init .
+ arch=$(run_morph print-architecture)
+ install -m644 -D /dev/stdin << EOF "systems/test-system.morph"
+ name: test-system
+ kind: system
+ arch: $arch
+ strata:
+ - name: build-essential
+ morph: strata/build-essential.morph
+ - name: core
+ morph: strata/core.morph
+ EOF
+
+ install -m644 -D /dev/stdin << EOF "strata/build-essential.morph"
+ name: build-essential
+ kind: stratum
+ chunks:
+ - name: stage1-chunk
+ repo: test:bootstrap-chunk
+ ref: $(run_in "$DATADIR/gits/bootstrap-chunk" git rev-parse bootstrap)
+ unpetrify-ref: nootstrap
+ build-mode: bootstrap
+ build-depends: []
+ - name: stage2-chunk
+ morph: stage2-chunk.morph
+ repo: test:bootstrap-chunk
+ ref: $(run_in "$DATADIR/gits/bootstrap-chunk" git rev-parse master)
+ unpetrify-ref: master
+ build-depends:
+ - stage1-chunk
+ EOF
+ install -m644 -D /dev/stdin << EOF "strata/core.morph"
+ name: core
+ kind: stratum
+ build-depends:
+ - morph: strata/build-essential.morph
+ chunks:
+ - name: test-chunk
+ morph: test-chunk.morph
+ repo: test:test-chunk
+ unpetrify-ref: master
+ ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master)
+ build-depends: []
+ EOF
+
+ install -m644 -D /dev/stdin << 'EOF' "test-chunk.morph"
+ name: test-chunk
+ kind: chunk
+ build-system: manual
+ # `install-commands` is a list of shell commands to run. Commands
+ # may be on multiple lines, and indeed anything programmatic will
+ # benefit from doing so. Arguably we could have just one command,
+ # but it's split into multiple so that morph can inform us which
+ # command failed without us having to include a lot of status
+ # information in the command and look at the error message.
+ install-commands:
+ - copy files
+ EOF
+
+ install -m644 -D /dev/stdin << 'EOF' "stage2-chunk.morph"
+ name: test-chunk
+ kind: chunk
+ build-system: manual
+ install-commands:
+ - copy files
EOF
- run_in "$DATADIR/gits/morphs" git init .
- run_in "$DATADIR/gits/morphs" git add .
- run_in "$DATADIR/gits/morphs" git commit -m Initial.
- run_in "$DATADIR/gits/morphs" git tag -a "test-tag" -m "Tagging test-tag"
+ git add .
+ git commit -m Initial.
+ git tag -a "test-tag" -m "Tagging test-tag"
# Start a git daemon to serve our git repositories
port_file="$DATADIR/git-daemon-port"
@@ -298,45 +344,6 @@ We need a consistent value for the architecture in some tests, so we
have a morphology using the test architecture.
IMPLEMENTS GIVEN a system called (\S+) for the test architecture in the git server
-
- cat << EOF > "$DATADIR/gits/morphs/stage1-chunk.morph"
- name: stage1-chunk
- kind: chunk
- build-system: dummy
- EOF
-
- run_in "$DATADIR/gits/morphs" git add .
- run_in "$DATADIR/gits/morphs" git commit -m "Add chunk for $MATCH_1"
-
-
- install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/strata/build-essential.morph"
- name: build-essential
- kind: stratum
- chunks:
- - name: stage1-chunk
- morph: stage1-chunk.morph
- repo: test:test-chunk
- ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master)
- unpetrify-ref: master
- build-mode: bootstrap
- build-depends: []
- EOF
-
- install -m644 -D /dev/stdin << EOF "$DATADIR/gits/morphs/strata/core.morph"
- name: core
- kind: stratum
- build-depends:
- - morph: strata/build-essential.morph
- chunks:
- - name: test-chunk
- morph: test-chunk.morph
- repo: test:test-chunk
- unpetrify-ref: master
- ref: $(run_in "$DATADIR/gits/test-chunk" git rev-parse master)
- build-mode: test
- build-depends: []
- EOF
-
name="$(basename "${MATCH_1%.*}")"
cat << EOF > "$DATADIR/gits/morphs/$MATCH_1"
arch: testarch
@@ -380,7 +387,7 @@ We also need to verify that a system branch has been checked out.
IMPLEMENTS THEN the system branch (\S+) is checked out
is_dir "$DATADIR/workspace/$MATCH_1/test/morphs"
is_file "$DATADIR/workspace/$MATCH_1/test/morphs/systems/test-system.morph"
- is_file "$DATADIR/workspace/$MATCH_1/test/morphs/strata/test-stratum.morph"
+ is_file "$DATADIR/workspace/$MATCH_1/test/morphs/strata/core.morph"
We can create a new branch, off master.
@@ -487,8 +494,10 @@ print-architecture` to get a value appropriate for morph.
kind: system
name: $name
strata:
- - name: test-stratum
- morph: strata/test-stratum.morph
+ - name: build-essential
+ morph: strata/build-essential.morph
+ - name: core
+ morph: strata/core.morph
EOF
Reporting status of checked out repositories: