Subject: [PATCH 4/5] tests: Factorize ‘%hello-dependencies-manifest’.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 28 Feb 2025 11:04:31 +0100

* gnu/tests/base.scm (%hello-dependencies-manifest): Export.
* gnu/tests/foreign.scm (%installation-tarball-manifest): Use it.

Change-Id: Id92232f479ab5d1f0c48036b0546e3745aa63e52
---
 gnu/tests/base.scm    |  4 +++-
 gnu/tests/foreign.scm | 36 +++---------------------------------
 2 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 38bd1e687fc..f2122d7d0a5 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -60,6 +60,8 @@ (define-module (gnu tests base)
             %test-root-unmount
             %test-cleanup
             %test-activation
+
+            %hello-dependencies-manifest
             %test-guix-daemon))
 
 (define %simple-os
@@ -998,7 +1000,7 @@ (define (manifest-entry-without-grafts entry)
     (item (with-parameters ((%graft? #f))
             (manifest-entry-item entry)))))
 
-(define %hello-dependencies-manifest            ;TODO: Share with (gnu tests foreign).
+(define %hello-dependencies-manifest
   ;; Build dependencies of 'hello' needed to test 'guix build hello'.
   (concatenate-manifests
    (list (map-manifest-entries
diff --git a/gnu/tests/foreign.scm b/gnu/tests/foreign.scm
index a08622424a7..9aba803c4d8 100644
--- a/gnu/tests/foreign.scm
+++ b/gnu/tests/foreign.scm
@@ -26,6 +26,8 @@ (define-module (gnu tests foreign)
   #:autoload   (guix store) (%store-prefix %store-monad %graft?)
   #:use-module (gnu compression)
   #:use-module (gnu tests)
+  #:use-module ((gnu tests base)
+                #:select (%hello-dependencies-manifest))
   #:use-module (gnu packages base)
   #:use-module (gnu packages bootstrap)
   #:use-module (gnu packages guile)
@@ -140,39 +142,7 @@ (define %installation-tarball-manifest
   ;; Manifest of the Guix installation tarball.
   (concatenate-manifests
    (list (packages->manifest (list guix))
-
-         ;; Include the dependencies of 'hello' in addition to 'guix' so that
-         ;; we can test 'guix build hello'.
-         (map-manifest-entries
-          manifest-entry-without-grafts
-          (package->development-manifest hello))
-
-         ;; Add the source of 'hello'.
-         (manifest
-          (list (manifest-entry
-                  (name "hello-source")
-                  (version (package-version hello))
-                  (item (let ((file (origin-actual-file-name
-                                     (package-source hello))))
-                          (computed-file
-                           "hello-source"
-                           #~(begin
-                               ;; Put the tarball in a subdirectory since
-                               ;; profile union crashes otherwise.
-                               (mkdir #$output)
-                               (mkdir (in-vicinity #$output "src"))
-                               (symlink #$(package-source hello)
-                                        (in-vicinity #$output
-                                                     (string-append "src/"
-                                                                    #$file))))))))))
-
-         ;; Include 'guile-final', which is needed when building derivations
-         ;; such as that of 'hello' but missing from the development manifest.
-         ;; Add '%bootstrap-guile', used by 'guix install --bootstrap'.
-         (map-manifest-entries
-          manifest-entry-without-grafts
-          (packages->manifest (list (canonical-package guile-3.0)
-                                    %bootstrap-guile))))))
+         %hello-dependencies-manifest)))
 
 (define %guix-install-script
   ;; The 'guix-install.sh' script.
-- 
2.48.1