[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30255: [PATCH 1/3] scripts: environment: Add --link-profile.

From: Ludovic Courtès
Subject: bug#30255: [PATCH 1/3] scripts: environment: Add --link-profile.
Date: Fri, 02 Mar 2018 11:20:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hi Mike,

Mike Gerwitz <address@hidden> skribis:

> This change is motivated by attempts to run programs (like GNU IceCat) within
> containers.  The 'fontconfig' program, for example, is configured explicitly
> to check ~/.guix-profile for additional fonts.
> There were no existing container tests in 'tests/', but I
> added one anyway for this change.
> * doc/guix.texi (Invoking guix environment): Add '--link-profile'.
> * guix/scripts/environment.scm (show-help): Add '--link-profile'.
> (%options): Add 'link-profile' as '#\P', assigned to 'link-profile?'.
> (lnk-environment): New procedure.
> (launch-environment/container): Use it when 'link-profile?'.
> [link-profile?]: New parameter.
> (guix-environment): Leave when '--link-prof' but not '--container'.  Add
> '#:link-profile?' argument to 'launch-environment/container' application.
> * tests/ New '--link-profile' test.

Sorry for forgetting about this patch series.  It’s perfect, and
very useful!

I applied this one with the changes below.  The main change is moving
the test to, which is skipped when user
namespaces are not supported.

Thank you!


diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index d86d30308..5c7d83881 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -513,7 +513,7 @@ symbolic link from ~/.guix-profile to the environment 
         (symlink profile profile-dir))
       (lambda args
         (if (= EEXIST (system-error-errno args))
-            (leave (G_ "cannot link profile: path '~a' already exists within 
+            (leave (G_ "cannot link profile: '~a' already exists within 
             (apply throw args))))))
@@ -625,7 +625,7 @@ message if any test fails."
       (when container? (assert-container-features))
       (when (and (not container?) link-prof?)
-        (leave (G_ "--link-prof cannot be used without --container~%")))
+        (leave (G_ "'--link-profile' cannot be used without '--container'~%")))
       (with-store store
         (set-build-options-from-command-line store opts)
diff --git a/tests/ 
index d7c1b7057..df40ce03e 100644
--- a/tests/
+++ b/tests/
@@ -97,6 +97,20 @@ grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts # bootstrap 
 rm $tmpdir/mounts
+# Make sure 'GUIX_ENVIRONMENT' is linked to '~/.guix-profile' when requested
+# within a container.
+  linktest='(exit (string=? (getenv "GUIX_ENVIRONMENT")
+(readlink (string-append (getenv "HOME") "/.guix-profile"))))'
+  cd "$tmpdir" \
+     && guix environment --bootstrap --container --link-profile \
+             --ad-hoc guile-bootstrap --pure \
+             -- guile -c "$linktest"
+# Check the exit code.
 (use-modules (system foreign))
 ;; Purposely make Guile crash with a segfault. :)
diff --git a/tests/ b/tests/
index ba686816f..b44aca099 100644
--- a/tests/
+++ b/tests/
@@ -71,18 +71,6 @@ echo "(use-modules (guix profiles) (gnu packages bootstrap))
 guix environment --bootstrap --manifest=$tmpdir/manifest.scm --pure \
      -- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile"'
-# Make sure 'GUIX_ENVIRONMENT' is linked to '~/.guix-profile' when requested
-# within a container
-  linktest='(exit (string=? (getenv "GUIX_ENVIRONMENT")
-(readlink (string-append (getenv "HOME") "/.guix-profile"))))'
-  cd "$tmpdir" \
-     && guix environment --bootstrap --container --link-profile \
-             --ad-hoc guile-bootstrap --pure \
-             -- guile -c "$linktest"
 # Make sure '-r' works as expected.
 rm -f "$gcroot"
 expected="`guix environment --bootstrap --ad-hoc guile-bootstrap \

reply via email to

[Prev in Thread] Current Thread [Next in Thread]