Subject: [bug#48314] [PATCH v4] Install guix system on Raspberry Pi

From: phodina <[email-masked]>
Date: Thu, 14 Apr 2022 09:25:25 +0000

>
> > +        `(modify-phases ,phases
> > +           (replace 'configure
>
>
> To get rid of the #< error, replace this by
>
> #~(modify-phases #$phases [...])
>
> (and replace the , by #$ etc).
>
> Greetings,
> Maxime.

Thanks for the suggestion Maxime. Here's patch with fixes where I attempt to rewrite the section of the code using Gexps.

Still it ends in error as there is some mistake in the Gexps I made.

$ ./pre-inst-env guix system build gnu/system/examples/raspberry-pi-64.tmpl
;;; note: source file /home/cpethod/guix/gnu/packages/linux.scm
;;;       newer than compiled /home/pethod/guix/gnu/packages/linux.go
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
The following derivation will be built:
  /gnu/store/zvy703ldgicckqgnggsnz0a21394hb9f-linux-libre-arm64-generic-5.16.19.drv
building /gnu/store/zvy703ldgicckqgnggsnz0a21394hb9f-linux-libre-arm64-generic-5.16.19.drv...
ice-9/psyntax.scm:2794:12: In procedure syntax-violation:
Syntax error:
/gnu/store/2xjp40qfmrdjg28zqsd919cjg00n9wrv-linux-libre-arm64-generic-5.16.19-builder:1:3387: source expression failed to match any pattern in form (let* ((srcarch #{$#}# (system->linux-srcarch (or (%current-target-system) (%current-system)))) (configs (string-append "arch/" srcarch "/configs/")) (guix_defconfig (string-append configs "guix_defconfig"))) #{$#}# (cond ((not defconfig) $~ (begin (apply (assoc-ref #{$#phases}# (quote configure)) arguments) (invoke "make" "savedefconfig") (rename-file "defconfig" guix_defconfig))) ((string? defconfig) $~ (rename-file (string-append configs #{$#defconfig}#) guix_defconfig)) (else (quote (copy-file (assoc-ref inputs "guix_defconfig") guix_defconfig)))) (modify-defconfig guix_defconfig (quote #{$#configs}#)) #{$#@}# (if extra-version $~ ((setenv "EXTRAVERSION" #{$#}# (string-append "-" extra-version))) (quote ())) (invoke "make" "guix_defconfig"))
builder for `/gnu/store/zvy703ldgicckqgnggsnz0a21394hb9f-linux-libre-arm64-generic-5.16.19.drv' failed with exit code 1
build of /gnu/store/zvy703ldgicckqgnggsnz0a21394hb9f-linux-libre-arm64-generic-5.16.19.drv failed
View build log at '/var/log/guix/drvs/zv/y703ldgicckqgnggsnz0a21394hb9f-linux-libre-arm64-generic-5.16.19.drv.gz'.
guix system: error: build of `/gnu/store/zvy703ldgicckqgnggsnz0a21394hb9f-linux-libre-arm64-generic-5.16.19.drv' failed

----
Petr
From 57643003418f13d49e45582ef2a6d25de6b36595 Mon Sep 17 00:00:00 2001
From: Petr Hodina <[email-masked]>
Date: Thu, 14 Apr 2022 11:18:27 +0200
Subject: [PATCH v4] Attempt to fix modify-linux procedure using Gexp.

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 61dac905f8..e1ad6069f8 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1293,15 +1293,15 @@ (define*-public (modify-linux #:key name
            (replace 'configure
              (lambda* (#:key inputs #:allow-other-keys #:rest arguments)
                (let* ((srcarch
-                       ,(system->linux-srcarch (or (%current-target-system)
+                       $#(system->linux-srcarch (or (%current-target-system)
                                                    (%current-system))))
                       (configs (string-append "arch/" srcarch "/configs/"))
                       (guix_defconfig (string-append configs "guix_defconfig")))
-                 ,(cond
+                 $#(cond
                    ((not defconfig)
-                    `(begin
+                    $~(begin
                        ;; Call the original 'configure phase.
-                       (apply (assoc-ref ,phases 'configure) arguments)
+                       (apply (assoc-ref $#phases 'configure) arguments)
                        ;; Save a defconfig file.
                        (invoke "make" "savedefconfig")
                        ;; Move the saved defconfig to the proper location.
@@ -1309,19 +1309,18 @@ (define*-public (modify-linux #:key name
                                     guix_defconfig)))
                    ((string? defconfig)
                     ;; Use another existing defconfig from the Linux sources.
-                    `(rename-file (string-append configs ,defconfig)
+                    $~(rename-file (string-append configs $#defconfig)
                                   guix_defconfig))
                    (else
                     ;; Copy the defconfig input to the proper location.
                     '(copy-file (assoc-ref inputs "guix_defconfig")
                                 guix_defconfig)))
-                 (modify-defconfig guix_defconfig ',configs)
-                 ,@(if extra-version
-                       `((setenv "EXTRAVERSION"
-                                 ,(string-append "-" extra-version)))
+                 (modify-defconfig guix_defconfig '$#configs)
+                 $#@(if extra-version
+                       $~((setenv "EXTRAVERSION"
+                                 $#(string-append "-" extra-version)))
                        '())
-                 (invoke "make" "guix_defconfig"))
-               #t))))))
+                 (invoke "make" "guix_defconfig"))))))))
     (native-inputs
      (append (if (or (not defconfig)
                      (string? defconfig))
-- 
2.34.0