Hi Vagrant,
Vagrant Cascadian <vagrant@debian.org> skribis:
Toggle quote (3 lines)
> If this could be considered for the upcoming 1.2 release, that would be> appreciated, though I can also carry the patches in Debian...
Yay! It should be doable, let’s see.
Toggle quote (16 lines)
> From 36516e767f68dbc2bd3dc186f956c0b0fd7de9f1 Mon Sep 17 00:00:00 2001> From: Vagrant Cascadian <vagrant@debian.org>> Date: Thu, 5 Nov 2020 17:35:52 -0800> Subject: [PATCH] tests: Support disabling network tests.>> This is needed for packaging GNU Guix in Debian, where packaging policies> prohibit network access during builds, but may not technically block network> access during builds.>> * guix/tests.scm (network-reachable): Return #f when> GUIX_DISABLE_NETWORK_TESTS is set.> * tests/common.sh: New file.> * tests/guix-build-branch.sh, tests/guix-environment.sh,> tests/guix-pack.sh, tests/guix-package-net.sh: Use> network_reachable function from common.sh.
[...]
Toggle quote (12 lines)
> --- /dev/null> +++ b/tests/common.sh> @@ -0,0 +1,8 @@> +network_reachable() {> + if [ -n "$GUIX_DISABLE_NETWORK_TESTS" ]; then> + exit 77> + fi> + if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null; then> + exit 77> + fi> +}
Could you add the usual copyright/license header? Also please add thisfile to ‘EXTRA_DIST’ in Makefile.am.
Looking at the tests you modified, we need two things:
• a ‘network_reachable’ function that returns true or false, without exiting;
• a ‘skip_if_network_is_unreachable’ function that does “exit 77” when network is “unreachable”.
Toggle quote (14 lines)
> --- a/tests/guix-environment.sh> +++ b/tests/guix-environment.sh> @@ -174,9 +174,9 @@ case "$transformed_drv" in> *) false;;> esac> > +. $(dirname $0)/common.sh> +network_reachable> > -if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null> -then> # Compute the build environment for the initial GNU Make.> guix environment --bootstrap --no-substitutes --search-paths --pure \
I think this is the only place where you’d write “if network_reachable”instead of “skip_if_network_is_unreachable”.
WDYT?
Thanks!
Ludo’.