From 7edd991e5d00a1ba19f3607fe8a66bbdc3ab3181 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 16 May 2022 16:45:17 +0200 Subject: Test DESTDIR in test_hadrian() --- .gitlab/ci.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index 48c34ec4fc..3e3549e2f1 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -539,6 +539,27 @@ function build_hadrian() { } +# run's `make DESTDIR=$1 install` and then +# merges the file tree to the actual destination $2, +# ensuring that `DESTDIR` is properly honoured by the +# build system +function make_install_destdir() { + local destdir=$1 + local instdir=$2 + + mkdir -p "$destdir" + mkdir -p "$instdir" + run "$MAKE" DESTDIR="$destdir" install + # check for empty dir portably + # https://superuser.com/a/667100 + if find "$instdir" -mindepth 1 -maxdepth 1 | read; then + fail "$instdir is not empty!" + fi + info "merging file tree from $destdir to $instdir" + cp -a "$destdir/$instdir"/* "$instdir"/ + "$instdir"/bin/ghc-pkg recache +} + function test_hadrian() { if [ -n "${CROSS_TARGET:-}" ]; then info "Can't test cross-compiled build." @@ -582,8 +603,8 @@ function test_hadrian() { ;; *) read -r -a args <<< "${INSTALL_CONFIGURE_ARGS:-}" - run ./configure --prefix="$TOP"/_build/install "${args[@]+"${args[@]}"}" - run "$MAKE" install + run ./configure --prefix="$TOP"/_build/install "${args[@]+"${args[@]}"}" + make_install_destdir "$TOP"/destdir "$TOP"/_build/install ;; esac cd ../../../ -- cgit v1.2.1