build: Fix possible race condition in 'test-env'.

Reported by Mark H Weaver <mhw@netris.org>.

* build-aux/test-env.in: Add 'guile' invocation before 'guix download'
invocation to make sure 'guix-daemon' is listening.
This commit is contained in:
Ludovic Courtès 2018-04-22 23:14:42 +02:00
parent b8a251d76e
commit 479c0e3f60
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 13 additions and 1 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# GNU Guix --- Functional package management for GNU # GNU Guix --- Functional package management for GNU
# Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
# #
# This file is part of GNU Guix. # This file is part of GNU Guix.
# #
@ -118,6 +118,18 @@ then
bootstrap_directory="@abs_top_builddir@/gnu/packages/bootstrap/@guix_system@" bootstrap_directory="@abs_top_builddir@/gnu/packages/bootstrap/@guix_system@"
if [ -d "$bootstrap_directory" ] if [ -d "$bootstrap_directory" ]
then then
# Make sure 'guix-daemon' is listening before invoking 'guix
# download'.
"@abs_top_builddir@/pre-inst-env" "@GUILE@" -c \
'(use-modules (guix))
(let loop ((i 10))
(catch #t
(lambda () (open-connection))
(lambda (key . args)
(if (zero? i)
(apply throw key args)
(begin (usleep 500000) (loop (- i 1)))))))'
for file in "$bootstrap_directory"/guile-* for file in "$bootstrap_directory"/guile-*
do do
"@abs_top_builddir@/pre-inst-env" \ "@abs_top_builddir@/pre-inst-env" \