From 198fc174037488ecd210c3c8a78fddc74a2acf6f Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Wed, 18 Nov 2015 15:38:36 +0000 Subject: Test definitions Change-Id: Ia5b24ed5d3e1b587b81a6474e552b5feed1cb7ba --- DEFAULTS | 199 +++++++++++++++++++++++++++++++++++++++++ VERSION | 2 +- strata/test-stratum-a.morph | 8 ++ strata/test-stratum-a/bc.morph | 7 ++ strata/test-stratum-b.morph | 23 +++++ strata/test-stratum-b/de.morph | 7 ++ strata/test-stratum-b/zz.morph | 7 ++ systems/test-system.morph | 11 +++ 8 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 DEFAULTS create mode 100644 strata/test-stratum-a.morph create mode 100644 strata/test-stratum-a/bc.morph create mode 100644 strata/test-stratum-b.morph create mode 100644 strata/test-stratum-b/de.morph create mode 100644 strata/test-stratum-b/zz.morph create mode 100644 systems/test-system.morph diff --git a/DEFAULTS b/DEFAULTS new file mode 100644 index 00000000..ab034a0b --- /dev/null +++ b/DEFAULTS @@ -0,0 +1,199 @@ +# Baserock definitions defaults +# ============================= +# +# The DEFAULTS file is treated specially by Baserock build tools. +# +# For more information, see: . + + +# Predefined build commands +# ------------------------- +# +# Common patterns in build instructions can be defined here, which can save +# users from having to write lots of similar-looking chunk .morph files. +# +# There are pre- and post- variants for each set of commands. These exist so +# you can add more commands without having to copy the defaults. For example, +# to create an extra symlink after running `make install`, you can use +# post-install-commands. Since these exist as a way of extending the defaults, +# you cannot set default values for the pre- and post- commands. +# +# The set of environment variables available when these commands are executed +# is not formally specified right now, but you can assume PREFIX, DESTDIR and +# MORPH_ARCH are all set. +# +build-systems: + manual: + # The special, default 'no-op' build system. + configure-commands: [] + build-commands: [] + install-commands: [] + strip-commands: [] + + autotools: + # GNU Autoconf and GNU Automake, or anything which follow the same pattern. + # + # See also: https://github.com/cgwalters/build-api/blob/master/build-api.md + configure-commands: + - >- + export NOCONFIGURE=1; + if [ -e autogen ]; then ./autogen; + elif [ -e autogen.sh ]; then ./autogen.sh; + elif [ -e bootstrap ]; then ./bootstrap; + elif [ -e bootstrap.sh ]; then ./bootstrap.sh; + elif [ ! -e ./configure ]; then autoreconf -ivf; + fi + - ./configure --prefix="$PREFIX" + build-commands: + - make + install-commands: + - make DESTDIR="$DESTDIR" install + strip-commands: + # TODO: Make idempotent when files are hardlinks + # Strip all ELF binary files that are executable or named like a library. + # .so files for C, .cmxs for OCaml and .node for Node. + # + # The file name and permissions checks are done with the `find` command before + # the ELF header is checked with the shell command, because it is a lot cheaper + # to check the mode and file name first, because it is a metadata check, rather + # than a subprocess and a file read. + # + # `file` is not used, to keep the dependency requirements down. + - &generic-strip-command | + find "$DESTDIR" -type f \ + '(' -perm -111 -o -name '*.so*' -o -name '*.cmxs' -o -name '*.node' ')' \ + -exec sh -ec \ + 'read -n4 hdr <"$1" # check for elf header + if [ "$hdr" != "$(printf \\x7fELF)" ]; then + exit 0 + fi + debugfile="$DESTDIR$PREFIX/lib/debug/$(basename "$1")" + mkdir -p "$(dirname "$debugfile")" + objcopy --only-keep-debug "$1" "$debugfile" + chmod 644 "$debugfile" + strip --remove-section=.comment --remove-section=.note --strip-unneeded "$1" + objcopy --add-gnu-debuglink "$debugfile" "$1"' - {} ';' + + python-distutils: + # The Python distutils build systems. + configure-commands: [] + build-commands: + - python setup.py build + install-commands: + - python setup.py install --prefix "$PREFIX" --root "$DESTDIR" + strip-commands: + - *generic-strip-command + + cpan: + # The Perl ExtUtil::MakeMaker build system. This is called the 'cpan' build + # system for historical reasons. + # + # To install perl distributions into the correct location in our chroot + # we need to set PREFIX to / in the configure-commands. + # + # The mapping between PREFIX and the final installation + # directories is complex and depends upon the configuration of perl + # see, + # https://metacpan.org/pod/distribution/perl/INSTALL#Installation-Directories + # and ExtUtil::MakeMaker's documentation for more details. + configure-commands: + - perl Makefile.PL PREFIX=$DESTDIR$PREFIX + build-commands: + - make + install-commands: + - make install + strip-commands: + - *generic-strip-command + + module-build: + # The Module::Build build system + # + # See the comment in ExtUtilsMakeMakerBuildSystem to see why --prefix is + # set to $DESTDIR$PREFIX here (--prefix in Module::Build has the same + # meaning as PREFIX in ExtUtils::MakeMaker). + configure-commands: + - perl Build.PL --prefix "$DESTDIR$PREFIX" + build-commands: + - ./Build + install-commands: + - ./Build install + strip-commands: + - *generic-strip-command + + cmake: + # The CMake build system. + configure-commands: + - cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" + build-commands: + - make + install-commands: + - make DESTDIR="$DESTDIR" install + strip-commands: + - *generic-strip-command + + qmake: + # The Qt build system. + configure-commands: + - qmake -makefile + build-commands: + - make + install-commands: + - make INSTALL_ROOT="$DESTDIR" install + strip-commands: + - *generic-strip-command + + +# Predefined artifact splitting rules +# ----------------------------------- +# +# Once a build has completed, you have some files that have been installed into +# $DESTDIR. The splitting rules control how many 'artifact' tarballs are +# generated as a result of the build, and which files from $DESTDIR end up in +# which 'artifact'. +# +# The default split rules are defined here. These can be overriden in +# individual chunk .morph files and stratum .morph files using the 'products' +# field. +# +split-rules: + chunk: + - artifact: -bins + include: + - (usr/)?s?bin/.* + - artifact: -libs + include: + - (usr/)?lib(32|64)?/lib[^/]*\.so(\.\d+)* + - (usr/)libexec/.* + - artifact: -devel + include: + - (usr/)?include/.* + - (usr/)?lib(32|64)?/lib.*\.a + - (usr/)?lib(32|64)?/lib.*\.la + - (usr/)?(lib(32|64)?|share)/pkgconfig/.*\.pc + - artifact: -doc + include: + - (usr/)?share/doc/.* + - (usr/)?share/man/.* + - (usr/)?share/info/.* + - artifact: -locale + include: + - (usr/)?share/locale/.* + - (usr/)?share/i18n/.* + - (usr/)?share/zoneinfo/.* + - artifact: -misc + include: + - .* + + stratum: + - artifact: -devel + include: + - .*-devel + - .*-debug + - .*-doc + - artifact: -runtime + include: + - .*-bins + - .*-libs + - .*-locale + - .*-misc + - .* diff --git a/VERSION b/VERSION index 0eaf7e67..e8b0c161 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -version: 6 +version: 7 diff --git a/strata/test-stratum-a.morph b/strata/test-stratum-a.morph new file mode 100644 index 00000000..1a0835b4 --- /dev/null +++ b/strata/test-stratum-a.morph @@ -0,0 +1,8 @@ +name: test-stratum-a +kind: stratum +description: Stratum A +chunks: +- repo: upstream:bc-tarball + name: bc1 + morph: strata/test-stratum-a/bc.morph + ref: 0956d119432ff6a2e85bae1fa336df799cad70b0 diff --git a/strata/test-stratum-a/bc.morph b/strata/test-stratum-a/bc.morph new file mode 100644 index 00000000..14b11d35 --- /dev/null +++ b/strata/test-stratum-a/bc.morph @@ -0,0 +1,7 @@ +name: bc-2 +kind: chunk +build-system: manual +build-commands: +#- echo foo +install-commands: +#- echo bar diff --git a/strata/test-stratum-b.morph b/strata/test-stratum-b.morph new file mode 100644 index 00000000..a4763137 --- /dev/null +++ b/strata/test-stratum-b.morph @@ -0,0 +1,23 @@ +name: test-stratum-b +kind: stratum +description: stratum B + for the BSP and Foundation strata, but a step above build-essential +#products: +#- artifact: test-stratum-b-runtime +# include: +# - de-.* +# - zz-.* +#- artifact: test-stratum-b-devel +# include: +# - nothing-.* +build-depends: +- morph: strata/test-stratum-a.morph +chunks: +- repo: upstream:bc-tarball + name: de + morph: strata/test-stratum-b/de.morph + ref: e8b0a65926d5a5ff368f385b8f40e872b3e41537 +#- repo: upstream:bc-tarball +# name: zz +# morph: strata/test-stratum-b/zz.morph +# ref: e8b0a65926d5a5ff368f385b8f40e872b3e41537 diff --git a/strata/test-stratum-b/de.morph b/strata/test-stratum-b/de.morph new file mode 100644 index 00000000..62bca41d --- /dev/null +++ b/strata/test-stratum-b/de.morph @@ -0,0 +1,7 @@ +name: de +kind: chunk +build-system: manual +build-commands: +#- echo foo +install-commands: +#- echo bar diff --git a/strata/test-stratum-b/zz.morph b/strata/test-stratum-b/zz.morph new file mode 100644 index 00000000..15f96fa8 --- /dev/null +++ b/strata/test-stratum-b/zz.morph @@ -0,0 +1,7 @@ +name: zz +kind: chunk +build-system: manual +build-commands: +#- echo foo +install-commands: +#- echo bar diff --git a/systems/test-system.morph b/systems/test-system.morph new file mode 100644 index 00000000..6d2770be --- /dev/null +++ b/systems/test-system.morph @@ -0,0 +1,11 @@ +name: test-system-x86_64 +kind: system +description: Lets play with Baserock +arch: x86_64 +strata: +- name: test-stratum-b + morph: strata/test-stratum-b.morph + #artifacts: + #- test-stratum-b-runtime +configuration-extensions: +- extensions/set-hostname -- cgit v1.2.1