summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Ospald <hasufell@posteo.de>2022-05-16 16:45:17 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-21 12:51:16 -0400
commit7edd991e5d00a1ba19f3607fe8a66bbdc3ab3181 (patch)
tree53815dd4023fa6adf8ca862f17635ac21b9a9935
parentecf5f3634c9971de4ae21870f0d6f3d5a35634a1 (diff)
downloadhaskell-wip/type-data.tar.gz
Test DESTDIR in test_hadrian()wip/type-data
-rwxr-xr-x.gitlab/ci.sh25
1 files 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 ../../../