Message ID | bb8fa8defba6b656280a2f59f5291789965fbd0f.1705127855.git.hako@ultrarare.space |
---|---|
State | New |
Headers | show |
Series | scripts: size: Add ‘system’ argument to ‘ensure-store-item’. | expand |
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
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
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