Subject: bug#46826: [debian] compilation from git fails

From: Maxime Devos <[email-masked]>
Date: Mon, 01 Mar 2021 12:42:08 +0100

On Sun, 2021-02-28 at 09:03 +0100, cage wrote:

> [...]
> A    kind     user    suggested    to    comment     the    form    in
> guix/scripts/environment.scm starting at line 178:
> 
> ------------
> (when (and profile
>   (> (length (manifest-entries manifest-from-opts)) 0))
>    (leave (G_ "'--profile' cannot be used with package options~%")))
> -----------
> 
> After commenting the form above, the compilation works flawless.

The guile2.2-bytestructures dependency of guile2.2-guix is broken currently
(see https://issues.guix.gnu.org/46844), which makes my proposal somewhat annoying
to test ...

Perhaps replace (when COND STUFF) with (define _ (when COND STUFF))? That should
be ok for both guile2.2 and guile3.0.  It's not very aesthetical, but if the
alternative is putting everything below (when COND STUFF) in a let form
(leading to more indentation), perhaps that's ok.

cage, could you verify whether this patch works for you?

Greetings,
Maxime.
-- 
Maxime Devos <[email-masked]>
PGP Key: C1F3 3EE2 0C52 8FDB 7DD7  011F 49E3 EE22 1917 25EE
Freenode handle: mdevos
From 659e191c1e9d64a9cf7734db6e9bb99e47877344 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Mon, 1 Mar 2021 10:57:17 +0100
Subject: [PATCH] scripts: environment: Replace expression with definition.

This fixes the following build error when building guix with
GNU Guile 2.2.7 on Debian (bullseye) (reindented):

guix/scripts/environment.scm:752:12: error:
(define manifest (if profile (profile-manifest profile) manifest-from-opts)):
definition in expression context, where definitions are not allowed,

Fixes: <https://issues.guix.gnu.org/46826>.

* guix/scripts/environment.scm (guix-environment): Fix a syntax error
  on Guile 2.2.7.
---
 guix/scripts/environment.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index a39347743e..a28018e627 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -745,9 +745,10 @@ message if any test fails."
           (with-status-verbosity (assoc-ref opts 'verbosity)
             (define manifest-from-opts
               (options/resolve-packages store opts))
-            (when (and profile
-                       (> (length (manifest-entries manifest-from-opts)) 0))
-              (leave (G_ "'--profile' cannot be used with package options~%")))
+            (define _
+              (when (and profile
+                         (> (length (manifest-entries manifest-from-opts)) 0))
+                (leave (G_ "'--profile' cannot be used with package options~%"))))
 
             (define manifest
               (if profile
-- 
2.30.0