From b9a95420abdf4ae7fe9a347031278a44ad6a1cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 22 Jun 2021 16:42:06 +0200 Subject: profiles: Build union of inputs in the right order. Fixes . Reported by Mathieu Othacehe and Tobias Geerinckx-Rice . Fixes a regression introduced in 8cef92d0633850d97c1a1d4521812268f56672be, whereby in case of file collisions, the "wrong" one would take precedence. * guix/build/profiles.scm (manifest-sexp->inputs+search-paths): Perform a breadth-first traversal. Reverse INPUTS and SEARCH-PATHS in the base case. * tests/profiles.scm ("profile-derivation, ordering & collisions"): New test. --- tests/profiles.scm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/profiles.scm') diff --git a/tests/profiles.scm b/tests/profiles.scm index 1a06ff88f3..06a0387221 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -279,6 +279,36 @@ (string=? (dirname (readlink bindir)) (derivation->output-path guile)))))) +(test-assertm "profile-derivation, ordering & collisions" + ;; ENTRY1 and ENTRY2 both provide 'bin/guile'--a collision. Make sure + ;; ENTRY1 "wins" over ENTRY2. See . + (mlet* %store-monad + ((entry1 -> (package->manifest-entry %bootstrap-guile)) + (entry2 -> (manifest-entry + (name "fake-guile") + (version "0") + (item (computed-file + "fake-guile" + #~(begin + (mkdir #$output) + (mkdir (string-append #$output "/bin")) + (call-with-output-file + (string-append #$output "/bin/guile") + (lambda (port) + (display "Fake!\n" port)))))))) + (guile (package->derivation %bootstrap-guile)) + (drv (profile-derivation (manifest (list entry1 entry2)) + #:hooks '() + #:locales? #f)) + (profile -> (derivation->output-path drv)) + (bindir -> (string-append profile "/bin")) + (file -> (string-append bindir "/guile")) + (_ (built-derivations (list drv)))) + (return (string=? (readlink file) + (string-append + (derivation->output-path guile) + "/bin/guile"))))) + (test-assertm "load-profile" (mlet* %store-monad ((entry -> (package->manifest-entry %bootstrap-guile)) -- cgit v1.2.3