Merge branch 'master' into staging
[jackhill/guix/guix.git] / tests / guix-package-net.sh
index cedfa32..82c346d 100644 (file)
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012, 2013, 2014, 2015, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
 # Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 #
 # This file is part of GNU Guix.
@@ -37,10 +37,19 @@ shebang_too_long ()
         -ge 128
 }
 
+if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null \
+       || shebang_too_long
+then
+    # Skipping.
+    exit 77
+fi
+
+
 profile="t-profile-$$"
+profile_alt="t-profile-alt-$$"
 rm -f "$profile"
 
-trap 'rm -f "$profile" "$profile-"[0-9]* ; rm -rf t-home-'"$$" EXIT
+trap 'rm -f "$profile" "$profile_alt" "$profile-"[0-9]* "$profile_alt-"[0-9]* ; rm -rf t-home-'"$$" EXIT
 
 
 guix package --bootstrap -p "$profile" -i guile-bootstrap
@@ -139,7 +148,7 @@ test "`readlink_base "$profile"`" = "$profile-2-link"
 
 # Make sure LIBRARY_PATH gets listed by `--search-paths'.
 guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap
-guix package --search-paths -p "$profile" | grep LIBRARY_PATH
+guix package -p "$profile" --search-paths | grep LIBRARY_PATH
 
 # Roll back so we can delete #3 below.
 guix package -p "$profile" --switch-generation=2
@@ -148,6 +157,46 @@ guix package -p "$profile" --switch-generation=2
 guix package -p "$profile" --delete-generations=3
 test -z "`guix package -p "$profile" -l 3`"
 
+# Search path of combined profiles.  'LIBRARY_PATH' should show up only in the
+# combination, not in the individual profiles.
+rm "$profile"
+guix package --bootstrap -p "$profile" -i guile-bootstrap
+guix package --bootstrap -p "$profile_alt" -i gcc-bootstrap
+if guix package -p "$profile" --search-paths | grep LIBRARY_PATH
+then false; fi
+guix package -p "$profile" -p "$profile_alt" --search-paths \
+     | grep "LIBRARY_PATH.*$profile/lib.$profile_alt/lib"
+
+# Simulate an upgrade and make sure the package order is preserved.
+module_dir="t-guix-package-net-$$"
+trap 'rm -rf "$module_dir"' EXIT
+
+mkdir "$module_dir"
+cat > "$module_dir/new.scm" <<EOF
+(define-module (new)
+  #:use-module (guix)
+  #:use-module (gnu packages bootstrap))
+
+(define-public new-guile
+  (package (inherit %bootstrap-guile)
+           (version (string-append "42." (getenv "V_MINOR")))))
+(define-public new-gcc
+  (package (inherit %bootstrap-gcc)
+           (version (string-append "77." (getenv "V_MINOR")))))
+EOF
+
+guix package --bootstrap -p "$profile" -i gcc-bootstrap
+installed="`guix package -p "$profile" -I | cut -f1`"
+
+for i in 1 2
+do
+    V_MINOR="$i"
+    export V_MINOR
+
+    guix package -p "$profile" --bootstrap -L "$module_dir" -u .
+    post_upgrade="`guix package -p "$profile" -I | cut -f1`"
+    test "$post_upgrade" = "$installed"
+done
 
 #
 # Try with the default profile.