From 15ae84bc58c80a2b2407e184fd2b84460ecdd09c Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Wed, 5 Dec 2018 22:21:30 -0500 Subject: [PATCH] Add test for bootstrapping Bash * tests/bash-without-bash.scm: New file. * Makefile.am (check-bootstrap): New target. --- Makefile.am | 4 ++++ tests/bash-without-bash.scm | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/bash-without-bash.scm diff --git a/Makefile.am b/Makefile.am index a9e0a0e..10dd5e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,6 +40,10 @@ test-list: ; @echo $(TESTS) check-spec: $(MAKE) $(AM_MAKEFLAGS) -L -C tests/spec check +.PHONY: check-bootstrap +check-bootstrap: + guix build -f tests/bash-without-bash.scm + dist-hook: echo $(VERSION) > $(distdir)/.tarball-version diff --git a/tests/bash-without-bash.scm b/tests/bash-without-bash.scm new file mode 100644 index 0000000..19b0411 --- /dev/null +++ b/tests/bash-without-bash.scm @@ -0,0 +1,37 @@ +(use-modules ((gnu packages bash) #:select (bash)) + (guix build-system) + (guix packages) + (guix store) + (guix utils) + (ice-9 match)) + +(define geesh + (load (string-append (current-source-directory) "/../guix.scm"))) + +(define geesh-with-links + (package + (inherit geesh) + (arguments + (substitute-keyword-arguments (package-arguments geesh) + ((#:phases phases '%standard-phases) + `(modify-phases ,phases + (add-after 'install 'link-bash + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (symlink (string-append out "/bin/geesh") + (string-append out "/bin/sh")) + (symlink (string-append out "/bin/geesh") + (string-append out "/bin/bash"))))))))))) + +(define bash-without-bash + (let ((bash-bag (package->bag bash))) + (bag + (inherit bash-bag) + (build-inputs + `(("bash" ,geesh-with-links) + ,@(filter (match-lambda + ((name . _) + (not (member name '("bash"))))) + (bag-build-inputs bash-bag))))))) + +(bag->derivation (open-connection) bash-without-bash)