GNU bug report logs - #64763
[PATCH] gnu: commencement: Use system in %final-inputs.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Fri, 21 Jul 2023 10:13:02 UTC

Severity: important

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64763 in the body.
You can then email your comments to 64763 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#64763; Package guix-patches. (Fri, 21 Jul 2023 10:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 21 Jul 2023 10:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: commencement: Use system in %final-inputs.
Date: Fri, 21 Jul 2023 11:11:45 +0100
Otherwise this causes odd issues, I presume arising from when %current-system
differs from the system argument passed to %final-inputs.

* gnu/packages/commencement.scm (%final-inputs): Set %current-system to
system.
---
 gnu/packages/commencement.scm | 51 ++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index fe6f025257..e522e70444 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3459,31 +3459,32 @@ (define-public %final-inputs
     ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
     ;; used for origins that have patches, thereby avoiding circular
     ;; dependencies.
-    (let ((finalize (compose with-boot6
-                             package-with-bootstrap-guile)))
-      `(,@(map (match-lambda
-                 ((name package)
-                  (list name (finalize package))))
-               `(("tar" ,tar)
-                 ("gzip" ,gzip)
-                 ("bzip2" ,bzip2)
-                 ("file" ,file)
-                 ("diffutils" ,diffutils)
-                 ("patch" ,patch)
-                 ("findutils" ,findutils)
-                 ("gawk" ,gawk)))
-        ("sed" ,sed-final)
-        ("grep" ,grep-final)
-        ("xz" ,xz-final)
-        ("coreutils" ,coreutils-final)
-        ("make" ,gnu-make-final)
-        ("bash" ,bash-final)
-        ("ld-wrapper" ,ld-wrapper)
-        ("binutils" ,binutils-final)
-        ("gcc" ,gcc-final)
-        ("libc" ,glibc-final)
-        ("libc:static" ,glibc-final "static")
-        ("locales" ,glibc-utf8-locales-final)))))
+    (parameterize ((%current-system system))
+      (let ((finalize (compose with-boot6
+                               package-with-bootstrap-guile)))
+        `(,@(map (match-lambda
+                   ((name package)
+                    (list name (finalize package))))
+                 `(("tar" ,tar)
+                   ("gzip" ,gzip)
+                   ("bzip2" ,bzip2)
+                   ("file" ,file)
+                   ("diffutils" ,diffutils)
+                   ("patch" ,patch)
+                   ("findutils" ,findutils)
+                   ("gawk" ,gawk)))
+          ("sed" ,sed-final)
+          ("grep" ,grep-final)
+          ("xz" ,xz-final)
+          ("coreutils" ,coreutils-final)
+          ("make" ,gnu-make-final)
+          ("bash" ,bash-final)
+          ("ld-wrapper" ,ld-wrapper)
+          ("binutils" ,binutils-final)
+          ("gcc" ,gcc-final)
+          ("libc" ,glibc-final)
+          ("libc:static" ,glibc-final "static")
+          ("locales" ,glibc-utf8-locales-final))))))
 
 (define-public canonical-package
   (let ((name->package (mlambda (system)

base-commit: 120f1721b2b66e5c9507556267bbfd83945958ce
prerequisite-patch-id: 9576d8ce545492d52fbe016d30103a51a9ddf94f
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64763; Package guix-patches. (Mon, 07 Aug 2023 15:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 64763 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 64763 <at> debbugs.gnu.org
Subject: Re: bug#64763: [PATCH] gnu: commencement: Use system in %final-inputs.
Date: Mon, 07 Aug 2023 17:02:24 +0200
Hi!

Christopher Baines <mail <at> cbaines.net> skribis:

> Otherwise this causes odd issues, I presume arising from when %current-system
> differs from the system argument passed to %final-inputs.
>
> * gnu/packages/commencement.scm (%final-inputs): Set %current-system to
> system.

Please add a “Fixes …” line in the log.

>  gnu/packages/commencement.scm | 51 ++++++++++++++++++-----------------
>  1 file changed, 26 insertions(+), 25 deletions(-)
>
> diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
> index fe6f025257..e522e70444 100644
> --- a/gnu/packages/commencement.scm
> +++ b/gnu/packages/commencement.scm
> @@ -3459,31 +3459,32 @@ (define-public %final-inputs

[...]

> +    (parameterize ((%current-system system))

LGTM!  I think that was definitely the intent of
0dd293b4d9095137c9952e16ca951f887b7e7018 (Cc’ing Josselin just in
case).

Thanks,
Ludo’.

PS: I believe the reason we cannot just write:

      (define/system-dependent %final-inputs …)

    is because we have two places where we do:

      (module-ref m '%final-inputs)

    which wouldn’t work if ‘%final-inputs’ were a macro, as is the case
    with ‘define/system-dependent’.




Information forwarded to guix-patches <at> gnu.org:
bug#64763; Package guix-patches. (Wed, 09 Aug 2023 07:40:01 GMT) Full text and rfc822 format available.

Message #11 received at 64763 <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: Ludovic Courtès <ludo <at> gnu.org>,
 Christopher Baines <mail <at> cbaines.net>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 64763 <at> debbugs.gnu.org
Subject: [PATCH] gnu: commencement: Use system in %final-inputs.
Date: Wed,  9 Aug 2023 09:38:31 +0200
From: Christopher Baines <mail <at> cbaines.net>

Otherwise this causes odd issues, I presume arising from when %current-system
differs from the system argument passed to %final-inputs.

* gnu/packages/commencement.scm (%final-inputs): Set %current-system to
system.
* gnu/packages/base.scm (%final-inputs): Add optional system parameter.
* gnu/ci.scm (base-packages): New procedure to memoize the base packages
depending on system.
(package->job): Pass system to base-packages.

Co-authored-by: Josselin Poiret <dev <at> jpoiret.xyz>
Signed-off-by: Josselin Poiret <dev <at> jpoiret.xyz>
---
Hi everyone,

I think the patch itself looks good but it will probably be missing some
additional stuff for CI, see the modified patch here.

Best,

 gnu/ci.scm                    | 46 ++++++++++++++++---------------
 gnu/packages/base.scm         |  7 ++---
 gnu/packages/commencement.scm | 51 ++++++++++++++++++-----------------
 3 files changed, 55 insertions(+), 49 deletions(-)

diff --git a/gnu/ci.scm b/gnu/ci.scm
index 7acd88ed29..df98c8af97 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -24,6 +24,7 @@ (define-module (gnu ci)
   #:use-module (guix build-system channel)
   #:use-module (guix config)
   #:autoload   (guix describe) (package-channels)
+  #:use-module (guix memoization)
   #:use-module (guix store)
   #:use-module (guix profiles)
   #:use-module (guix packages)
@@ -342,29 +343,32 @@ (define job-name
   ;; Return the name of a package's job.
   package-name)
 
+(define base-packages
+  (mlambda (system)
+    "Return the set of packages considered to be part of the base for SYSTEM."
+    (delete-duplicates
+     (append-map (match-lambda
+                   ((_ package _ ...)
+                    (match (package-transitive-inputs package)
+                      (((_ inputs _ ...) ...)
+                       inputs))))
+                 (%final-inputs system)))))
+
 (define package->job
-  (let ((base-packages
-         (delete-duplicates
-          (append-map (match-lambda
-                        ((_ package _ ...)
-                         (match (package-transitive-inputs package)
-                           (((_ inputs _ ...) ...)
-                            inputs))))
-                      (%final-inputs)))))
-    (lambda* (store package system #:key (suffix ""))
-      "Return a job for PACKAGE on SYSTEM, or #f if this combination is not
+  (lambda* (store package system #:key (suffix ""))
+    "Return a job for PACKAGE on SYSTEM, or #f if this combination is not
 valid.  Append SUFFIX to the job name."
-      (cond ((member package base-packages)
-             (package-job store (string-append "base." (job-name package))
-                          package system #:suffix suffix))
-            ((supported-package? package system)
-             (let ((drv (package-derivation store package system
-                                            #:graft? #f)))
-               (and (substitutable-derivation? drv)
-                    (package-job store (job-name package)
-                                 package system #:suffix suffix))))
-            (else
-             #f)))))
+    (cond ((member package (base-packages system))
+           (package-job store (string-append "base." (job-name package))
+                        package system #:suffix suffix))
+          ((supported-package? package system)
+           (let ((drv (package-derivation store package system
+                                          #:graft? #f)))
+             (and (substitutable-derivation? drv)
+                  (package-job store (job-name package)
+                               package system #:suffix suffix))))
+          (else
+           #f))))
 
 (define %x86-64-micro-architectures
   ;; Micro-architectures for which we build tuned variants.
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 1fdfaf8a57..32bc69e2c4 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -78,7 +78,8 @@ (define-module (gnu packages base)
   #:export (glibc
             libc-for-target
             make-ld-wrapper
-            libiconv-if-needed))
+            libiconv-if-needed
+            %final-inputs))
 
 ;;; Commentary:
 ;;;
@@ -1648,10 +1649,10 @@ (define-public (canonical-package package)
          (proc  (module-ref iface 'canonical-package)))
     (proc package)))
 
-(define-public (%final-inputs)
+(define* (%final-inputs #:optional (system (%current-system)))
   "Return the list of \"final inputs\"."
   ;; Avoid circular dependency by lazily resolving 'commencement'.
   (let ((iface (resolve-interface '(gnu packages commencement))))
-    ((module-ref iface '%final-inputs) (%current-system))))
+    ((module-ref iface '%final-inputs) system)))
 
 ;;; base.scm ends here
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index fe6f025257..e522e70444 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3459,31 +3459,32 @@ (define-public %final-inputs
     ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
     ;; used for origins that have patches, thereby avoiding circular
     ;; dependencies.
-    (let ((finalize (compose with-boot6
-                             package-with-bootstrap-guile)))
-      `(,@(map (match-lambda
-                 ((name package)
-                  (list name (finalize package))))
-               `(("tar" ,tar)
-                 ("gzip" ,gzip)
-                 ("bzip2" ,bzip2)
-                 ("file" ,file)
-                 ("diffutils" ,diffutils)
-                 ("patch" ,patch)
-                 ("findutils" ,findutils)
-                 ("gawk" ,gawk)))
-        ("sed" ,sed-final)
-        ("grep" ,grep-final)
-        ("xz" ,xz-final)
-        ("coreutils" ,coreutils-final)
-        ("make" ,gnu-make-final)
-        ("bash" ,bash-final)
-        ("ld-wrapper" ,ld-wrapper)
-        ("binutils" ,binutils-final)
-        ("gcc" ,gcc-final)
-        ("libc" ,glibc-final)
-        ("libc:static" ,glibc-final "static")
-        ("locales" ,glibc-utf8-locales-final)))))
+    (parameterize ((%current-system system))
+      (let ((finalize (compose with-boot6
+                               package-with-bootstrap-guile)))
+        `(,@(map (match-lambda
+                   ((name package)
+                    (list name (finalize package))))
+                 `(("tar" ,tar)
+                   ("gzip" ,gzip)
+                   ("bzip2" ,bzip2)
+                   ("file" ,file)
+                   ("diffutils" ,diffutils)
+                   ("patch" ,patch)
+                   ("findutils" ,findutils)
+                   ("gawk" ,gawk)))
+          ("sed" ,sed-final)
+          ("grep" ,grep-final)
+          ("xz" ,xz-final)
+          ("coreutils" ,coreutils-final)
+          ("make" ,gnu-make-final)
+          ("bash" ,bash-final)
+          ("ld-wrapper" ,ld-wrapper)
+          ("binutils" ,binutils-final)
+          ("gcc" ,gcc-final)
+          ("libc" ,glibc-final)
+          ("libc:static" ,glibc-final "static")
+          ("locales" ,glibc-utf8-locales-final))))))
 
 (define-public canonical-package
   (let ((name->package (mlambda (system)
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64763; Package guix-patches. (Wed, 09 Aug 2023 21:32:02 GMT) Full text and rfc822 format available.

Message #14 received at 64763 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: Christopher Baines <mail <at> cbaines.net>, 64763 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: commencement: Use system in %final-inputs.
Date: Wed, 09 Aug 2023 23:31:29 +0200
Hi,

Josselin Poiret <dev <at> jpoiret.xyz> skribis:

> From: Christopher Baines <mail <at> cbaines.net>
>
> Otherwise this causes odd issues, I presume arising from when %current-system
> differs from the system argument passed to %final-inputs.
>
> * gnu/packages/commencement.scm (%final-inputs): Set %current-system to
> system.
> * gnu/packages/base.scm (%final-inputs): Add optional system parameter.
> * gnu/ci.scm (base-packages): New procedure to memoize the base packages
> depending on system.
> (package->job): Pass system to base-packages.
>
> Co-authored-by: Josselin Poiret <dev <at> jpoiret.xyz>
> Signed-off-by: Josselin Poiret <dev <at> jpoiret.xyz>

LGTM!  Great that you found the (gnu ci) issue.

Thanks,
Ludo’.




Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 18 Aug 2023 13:18:01 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Fri, 18 Aug 2023 14:16:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Fri, 18 Aug 2023 14:16:03 GMT) Full text and rfc822 format available.

Message #21 received at 64763-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: 64763-done <at> debbugs.gnu.org, Christopher Baines <mail <at> cbaines.net>
Subject: Re: bug#64763: [PATCH] gnu: commencement: Use system in %final-inputs.
Date: Fri, 18 Aug 2023 16:15:14 +0200
Ludovic Courtès <ludo <at> gnu.org> skribis:

> Josselin Poiret <dev <at> jpoiret.xyz> skribis:
>
>> From: Christopher Baines <mail <at> cbaines.net>
>>
>> Otherwise this causes odd issues, I presume arising from when %current-system
>> differs from the system argument passed to %final-inputs.
>>
>> * gnu/packages/commencement.scm (%final-inputs): Set %current-system to
>> system.
>> * gnu/packages/base.scm (%final-inputs): Add optional system parameter.
>> * gnu/ci.scm (base-packages): New procedure to memoize the base packages
>> depending on system.
>> (package->job): Pass system to base-packages.
>>
>> Co-authored-by: Josselin Poiret <dev <at> jpoiret.xyz>
>> Signed-off-by: Josselin Poiret <dev <at> jpoiret.xyz>
>
> LGTM!  Great that you found the (gnu ci) issue.

Pushed on your behalf as 560cb51e7b37e2c6f6fe4b72a3781185c57fdf83.

Thanks again!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 16 Sep 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.