GNU bug report logs - #68420
[PATCH 0/1] scripts: size: Add ‘system’ argument to ‘ensure-store-item’.

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Sat, 13 Jan 2024 07:26:02 UTC

Severity: normal

Tags: patch

Done: Hilton Chain <hako <at> ultrarare.space>

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 68420 in the body.
You can then email your comments to 68420 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 <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, zhengjunjie <at> iscas.ac.cn, guix-patches <at> gnu.org:
bug#68420; Package guix-patches. (Sat, 13 Jan 2024 07:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hilton Chain <hako <at> ultrarare.space>:
New bug report received and forwarded. Copy sent to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, zhengjunjie <at> iscas.ac.cn, guix-patches <at> gnu.org. (Sat, 13 Jan 2024 07:26:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: guix-patches <at> gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 0/1] scripts: size: Add ‘system’ argument to ‘ensure-store-item’.
Date: Sat, 13 Jan 2024 15:25:17 +0800
This patch is a follow-up to <https://issues.guix.gnu.org/68363>.

Since the issue hasn't been found for a long time, I think it's better to pass
the system explicitly.

Thanks

Hilton Chain (1):
  scripts: size: Add ‘system’ argument to ‘ensure-store-item’.

 guix/scripts/size.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


base-commit: c0b303aaa3d6154acbe054120d11467eb98e6d33
--
2.41.0




Information forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, zhengjunjie <at> iscas.ac.cn, guix-patches <at> gnu.org:
bug#68420; Package guix-patches. (Sat, 13 Jan 2024 07:30:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 68420 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 1/1] scripts: size: Add ‘system’ argument to ‘ensure-store-item’.
Date: Sat, 13 Jan 2024 15:29:33 +0800
This is a follow-up to c245a54aab348642178129a9aad501b81a3089b4.

‘%current-system’ is already parameterized within ‘run-with-store’, the root
cause is that ‘mlet*’ bindings are evaluated before the parameterization.

* guix/scripts/size.scm (ensure-store-item): Add ‘system’ argument and pass it
to ‘package->derivation’.
(guix-size): Adjust accordingly.

Change-Id: I910af7c137737bcd0ee079e57a81c4114ab5ae32
---
 guix/scripts/size.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index 8a8676a16f..0603c0498a 100644
--- a/guix/scripts/size.scm
+++ b/guix/scripts/size.scm
@@ -168,7 +168,7 @@ (define (store-profile items)
                (return (profile item size dependencies)))))
           sizes)))

-(define* (ensure-store-item spec-or-item)
+(define* (ensure-store-item spec-or-item #:optional (system (%current-system)))
   "Return a store file name.  If SPEC-OR-ITEM is a store file name, return it
 as is.  Otherwise, assume SPEC-OR-ITEM is a package output specification such
 as \"guile:debug\" or \"gcc-4.8\" and return its store file name."
@@ -177,7 +177,7 @@ (define* (ensure-store-item spec-or-item)
         (return spec-or-item)
         (let-values (((package output)
                       (specification->package+output spec-or-item)))
-          (mlet %store-monad ((drv (package->derivation package)))
+          (mlet %store-monad ((drv (package->derivation package system)))
             ;; Note: we don't try building DRV like 'guix archive' does
             ;; because we don't have to since we can instead rely on
             ;; substitute meta-data.
@@ -317,8 +317,7 @@ (define-command (guix-size . args)
           ;; Turn off grafts because (1) substitute servers do not serve grafted
           ;; packages, and (2) they do not make any difference on the
           ;; resulting size.
-          (parameterize ((%graft? #f)
-                         (%current-system system))
+          (parameterize ((%graft? #f))
             (with-store store
               (set-build-options store
                                  #:use-substitutes? #t
@@ -326,7 +325,9 @@ (define-command (guix-size . args)

               (run-with-store store
                 (mlet* %store-monad ((items   (mapm %store-monad
-                                                    ensure-store-item files))
+                                                    (cut ensure-store-item <>
+                                                         system)
+                                                  files))
                                      (profile (store-profile items)))
                   (if map-file
                       (begin
--
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#68420; Package guix-patches. (Sat, 13 Jan 2024 09:37:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Simon Tournier <zimon.toutoune <at> gmail.com>,
 Ludovic Courtès <ludo <at> gnu.org>, 68420 <at> debbugs.gnu.org,
 Zheng Junjie <zhengjunjie <at> iscas.ac.cn>, Ricardo Wurmus <rekado <at> elephly.net>,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#68420] [PATCH 1/1] scripts: size: Add ‘system’ argument to
 ‘ensure-store-item’.
Date: Sat, 13 Jan 2024 10:36:37 +0100
Hey,

> -(define* (ensure-store-item spec-or-item)

When I have a look to the derivation that is computed in that procedure,
it looks like it has the expected system (the one passed as a cli
argument). Do you have any evidence of `guix size` doing the wrong thing
after c245a54aab?

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#68420; Package guix-patches. (Thu, 01 Feb 2024 06:03:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Simon Tournier <zimon.toutoune <at> gmail.com>,
 Ludovic Courtès <ludo <at> gnu.org>, 68420 <at> debbugs.gnu.org,
 Zheng Junjie <zhengjunjie <at> iscas.ac.cn>, Ricardo Wurmus <rekado <at> elephly.net>,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#68420] [PATCH 1/1] scripts: size: Add ‘system’ argument to ‘ensure-store-item’.
Date: Thu, 01 Feb 2024 14:02:14 +0800
Hi Mathieu,

On Sat, 13 Jan 2024 17:36:37 +0800,
Mathieu Othacehe wrote:
>
>
> Hey,
>
> > -(define* (ensure-store-item spec-or-item)
>
> When I have a look to the derivation that is computed in that procedure,
> it looks like it has the expected system (the one passed as a cli
> argument). Do you have any evidence of `guix size` doing the wrong thing
> after c245a54aab?

Sorry for the confusion, c245a54aab did fix the issue, I should remove the
"follow-up" line in the commit message.

This patch is more of a style change:

Since system has been passed to ‘run-with-store’ and parameterized within it, we
only have to deal with the ‘mlet*’ bindings which are evaluated earlier.

For this specefic case, only ‘ensure-store-item’ used in ‘mlet*’ bindings needs
the system, so we can simply handle it there.  And I think parameterizing system
around ‘run-with-store’ again made the procedure less clear.

Thanks




bug closed, send any further explanations to 68420 <at> debbugs.gnu.org and Hilton Chain <hako <at> ultrarare.space> Request was from Hilton Chain <hako <at> ultrarare.space> to control <at> debbugs.gnu.org. (Tue, 12 Nov 2024 12:51:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 11 Dec 2024 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 92 days ago.

Previous Next


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