gnu: guix: Ensure the bootstrap binary tarballs aren't GC'd.

Previously, they could be GC'd by 'tests/guix-gc.sh' for instance, and
thus lacking by the time 'tests/guix-daemon.sh' runs, thereby leading to
a test failure.

Reported by Gábor Boskovits.

* gnu/packages/package-management.scm (guix)[arguments]: In
'copy-bootstrap-guile' phase, change 'intern' to register a GC root.
This commit is contained in:
Ludovic Courtès 2020-01-06 15:09:31 +01:00
parent 3a695c01d7
commit 9961cde383
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Muriithi Frederick Muriuki <fredmanglis@gmail.com> ;;; Copyright © 2017 Muriithi Frederick Muriuki <fredmanglis@gmail.com>
;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com>
@ -176,16 +176,27 @@ (define-public guix
;; Copy the bootstrap guile tarball in the store used ;; Copy the bootstrap guile tarball in the store used
;; by the test suite. ;; by the test suite.
(define (intern file recursive?) (define (intern file recursive?)
(let ((base (strip-store-file-name file))) ;; Note: don't use 'guix download' here because we
;; Note: don't use 'guix download' here because we ;; need to set the 'recursive?' argument.
;; need to set the 'recursive?' argument. (define base
(invoke "./test-env" "guile" "-c" (strip-store-file-name file))
(object->string
`(begin (define code
(use-modules (guix)) `(begin
(with-store store (use-modules (guix))
(add-to-store store ,base ,recursive? (with-store store
"sha256" ,file))))))) (let* ((item (add-to-store store ,base
,recursive?
"sha256" ,file))
(root (string-append "/tmp/gc-root-"
(basename item))))
;; Register a root so that the GC tests
;; don't delete those.
(symlink item root)
(add-indirect-root store root)))))
(invoke "./test-env" "guile" "-c"
(object->string code)))
(intern (assoc-ref inputs "boot-guile") #f) (intern (assoc-ref inputs "boot-guile") #f)