* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs @ 2023-08-31 20:14 Ulf Herrman 2023-09-01 18:08 ` Csepp ` (4 more replies) 0 siblings, 5 replies; 23+ messages in thread From: Ulf Herrman @ 2023-08-31 20:14 UTC (permalink / raw) To: 65665 [-- Attachment #1: Type: text/plain, Size: 2115 bytes --] #:deep? #t currently works by interposing a dummy build system that lowers the package to a bag using the original build system, then applies the supplied transformation to all of the bag's inputs, then returns a new bag with the new inputs. The problem with this approach is that it doesn't affect the bag arguments. This means that packages passed in as arguments may still end up being used without being transformed. Worse still, packages *not* passed in as arguments may end up being used *unless one is explicitly passed in as an argument*, as is the case with qt-build-system's #:qtbase argument. In short, the current approach of having the build-system lower procedure leave the arguments mostly unchanged and letting the bag->derivation procedure (the "bag builder") fill in lots of defaults means that there are implicit inputs that cannot be touched at the package level without adding special logic for every single build system that does something like this. I propose that we have the build system lower procedure (that is, the one that converts from package to bag) completely fill in the argument list with all defaults, and we modify build-system-with-package-mapping to transform all arguments that look like a package or a list of packages (or maybe even a tree containing packages). Many large-scale package transformations have their purpose defeated if even a single package slips through and has to be built or downloaded separately (e.g. "I wanted to use a more minimal version of P, and now I have both the original version of P *and* a more minimal version of P *and* a duplicate copy of a large portion of the package graph..."). In fact, in some situations, this could cause exponential growth of the number of packages, e.g. a transformation is applied to qtbase and its dependencies, but not to the implicit version and its dependencies, so now all the dependencies of qtbase are duplicated, and if this happens again at a higher level with something that depends on a package with qt-build-system, now there are four duplicate subgraphs, and so on. What do you think? - Ulf [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-08-31 20:14 bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs Ulf Herrman @ 2023-09-01 18:08 ` Csepp 2023-09-03 13:02 ` Maxim Cournoyer ` (3 subsequent siblings) 4 siblings, 0 replies; 23+ messages in thread From: Csepp @ 2023-09-01 18:08 UTC (permalink / raw) To: Ulf Herrman; +Cc: 65665 Ulf Herrman <striness@tilde.club> writes: > [[PGP Signed Part:Undecided]] > #:deep? #t currently works by interposing a dummy build system that > lowers the package to a bag using the original build system, then > applies the supplied transformation to all of the bag's inputs, then > returns a new bag with the new inputs. > > The problem with this approach is that it doesn't affect the bag > arguments. This means that packages passed in as arguments may still > end up being used without being transformed. Worse still, packages > *not* passed in as arguments may end up being used *unless one is > explicitly passed in as an argument*, as is the case with > qt-build-system's #:qtbase argument. > > In short, the current approach of having the build-system lower > procedure leave the arguments mostly unchanged and letting the > bag->derivation procedure (the "bag builder") fill in lots of defaults > means that there are implicit inputs that cannot be touched at the > package level without adding special logic for every single build system > that does something like this. > > I propose that we have the build system lower procedure (that is, the > one that converts from package to bag) completely fill in the argument > list with all defaults, and we modify build-system-with-package-mapping > to transform all arguments that look like a package or a list of > packages (or maybe even a tree containing packages). > > Many large-scale package transformations have their purpose defeated if > even a single package slips through and has to be built or downloaded > separately (e.g. "I wanted to use a more minimal version of P, and now I > have both the original version of P *and* a more minimal version of P > *and* a duplicate copy of a large portion of the package graph..."). In > fact, in some situations, this could cause exponential growth of the > number of packages, e.g. a transformation is applied to qtbase and its > dependencies, but not to the implicit version and its dependencies, so > now all the dependencies of qtbase are duplicated, and if this happens > again at a higher level with something that depends on a package with > qt-build-system, now there are four duplicate subgraphs, and so on. > > What do you think? > > - Ulf > > [[End of PGP Signed Part]] Sounds like a good idea to me. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-08-31 20:14 bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs Ulf Herrman 2023-09-01 18:08 ` Csepp @ 2023-09-03 13:02 ` Maxim Cournoyer 2023-09-05 14:57 ` Simon Tournier ` (2 subsequent siblings) 4 siblings, 0 replies; 23+ messages in thread From: Maxim Cournoyer @ 2023-09-03 13:02 UTC (permalink / raw) To: Ulf Herrman; +Cc: dev, zimon.toutoune, othacehe, ludo, me, 65665, rekado, guix Hello Ulf, Ulf Herrman <striness@tilde.club> writes: > #:deep? #t currently works by interposing a dummy build system that > lowers the package to a bag using the original build system, then > applies the supplied transformation to all of the bag's inputs, then > returns a new bag with the new inputs. > > The problem with this approach is that it doesn't affect the bag > arguments. This means that packages passed in as arguments may still > end up being used without being transformed. Worse still, packages > *not* passed in as arguments may end up being used *unless one is > explicitly passed in as an argument*, as is the case with > qt-build-system's #:qtbase argument. > > In short, the current approach of having the build-system lower > procedure leave the arguments mostly unchanged and letting the > bag->derivation procedure (the "bag builder") fill in lots of defaults > means that there are implicit inputs that cannot be touched at the > package level without adding special logic for every single build system > that does something like this. This is indeed sub-optimal! > I propose that we have the build system lower procedure (that is, the > one that converts from package to bag) completely fill in the argument > list with all defaults, and we modify build-system-with-package-mapping > to transform all arguments that look like a package or a list of > packages (or maybe even a tree containing packages). [...] > What do you think? Like Csepp, I like your proposition! I'm CC'ing the core team, in case they have something to add to it, but otherwise, we only need a volunteer to turn it into code :-). -- Thanks, Maxim ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-08-31 20:14 bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs Ulf Herrman 2023-09-01 18:08 ` Csepp 2023-09-03 13:02 ` Maxim Cournoyer @ 2023-09-05 14:57 ` Simon Tournier 2023-09-16 9:45 ` bug#65665: [PATCH] Really " Ulf Herrman 2023-10-12 13:53 ` Ludovic Courtès 4 siblings, 0 replies; 23+ messages in thread From: Simon Tournier @ 2023-09-05 14:57 UTC (permalink / raw) To: Ulf Herrman, 65665 Hi, On Thu, 31 Aug 2023 at 15:14, Ulf Herrman <striness@tilde.club> wrote: > I propose that we have the build system lower procedure (that is, the > one that converts from package to bag) completely fill in the argument > list with all defaults, and we modify build-system-with-package-mapping > to transform all arguments that look like a package or a list of > packages (or maybe even a tree containing packages). On principle, this looks a good idea. Do you already have an implementation? Because transformations lead to headache and sometimes the implementation is hard, well evil, details and all that. :-) Cheers, simon ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: [PATCH] Really get all the implicit inputs. 2023-08-31 20:14 bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs Ulf Herrman ` (2 preceding siblings ...) 2023-09-05 14:57 ` Simon Tournier @ 2023-09-16 9:45 ` Ulf Herrman 2023-10-06 2:36 ` Maxim Cournoyer 2023-10-12 14:06 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès 2023-10-12 13:53 ` Ludovic Courtès 4 siblings, 2 replies; 23+ messages in thread From: Ulf Herrman @ 2023-09-16 9:45 UTC (permalink / raw) To: 65665 [-- Attachment #1.1: Type: text/plain, Size: 480 bytes --] This patch series causes package-mapping to recurse into package and bag arguments when #:deep? #t is given. It also recurses into gexps and gexp inputs in search of packages to devour. It also ensures that build systems leave all of their implicit package arguments in the bag arguments, ready to be found by package-mapping. It also fixes a couple build system errors I came across while modifying 40+ build systems and testing a deep package transformation. - ulfvonbelow [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-guix-packages-rewrite-arguments-with-package-mapping.patch --] [-- Type: text/x-patch, Size: 17200 bytes --] From 73b2dfe98591073104fd069622ede2acab0c7655 Mon Sep 17 00:00:00 2001 Message-Id: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> From: Ulf Herrman <striness@tilde.club> Date: Fri, 15 Sep 2023 07:38:24 -0500 Subject: [PATCH 1/5] guix: packages: rewrite arguments with `package-mapping'. * guix/gexp.scm (make-gexp, gexp-references, gexp-self-modules, gexp-self-extensions, gexp-proc, %gexp-location): export. * guix/packages.scm (build-system-with-package-mapping): replace `rewrite' argument with `rewrite-input' and `rewrite-argument' arguments. Use `rewrite-argument' to rewrite bag arguments. (package-mapping): rewrite package arguments when `deep?' is true. --- guix/gexp.scm | 7 ++++++ guix/packages.scm | 56 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/guix/gexp.scm b/guix/gexp.scm index 0fe4f1c98a..6acd3116d4 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -39,6 +39,13 @@ (define-module (guix gexp) #:use-module (ice-9 match) #:export (gexp gexp? + make-gexp + gexp-references + gexp-self-modules + gexp-self-extensions + gexp-proc + %gexp-location + sexp->gexp with-imported-modules with-extensions diff --git a/guix/packages.scm b/guix/packages.scm index ba98bb0fb4..1334def142 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -1431,7 +1431,7 @@ (define* (package-closure packages #:key (system (%current-system))) (vhash-consq package #t visited) (fold set-insert closure dependencies)))))))) -(define (build-system-with-package-mapping bs rewrite) +(define (build-system-with-package-mapping bs rewrite-input rewrite-argument) "Return a variant of BS, a build system, that rewrites a bag's inputs by passing them through REWRITE, a procedure that takes an input tuplet and returns a \"rewritten\" input tuplet." @@ -1442,9 +1442,10 @@ (define (build-system-with-package-mapping bs rewrite) (let ((lowered (apply lower args))) (bag (inherit lowered) - (build-inputs (map rewrite (bag-build-inputs lowered))) - (host-inputs (map rewrite (bag-host-inputs lowered))) - (target-inputs (map rewrite (bag-target-inputs lowered)))))) + (build-inputs (map rewrite-input (bag-build-inputs lowered))) + (host-inputs (map rewrite-input (bag-host-inputs lowered))) + (target-inputs (map rewrite-input (bag-target-inputs lowered))) + (arguments (map rewrite-argument (bag-arguments lowered)))))) (build-system (inherit bs) @@ -1456,13 +1457,32 @@ (define* (package-mapping proc #:optional (cut? (const #f)) depended on and returns the resulting package. The procedure stops recursion when CUT? returns true for a given package. When DEEP? is true, PROC is applied to implicit inputs as well." - (define (rewrite input) + (define (rewrite-input input) (match input ((label (? package? package) outputs ...) (cons* label (replace package) outputs)) (_ input))) + (define (rewrite-argument arg) + (match arg + ((? package? p) + (replace p)) + ((? gexp-input? gi) + (gexp-input (rewrite-argument (gexp-input-thing gi)) + (gexp-input-output gi) + #:native? (gexp-input-native? gi))) + ((? gexp? gxp) + (make-gexp (map rewrite-argument (gexp-references gxp)) + (gexp-self-modules gxp) + (gexp-self-extensions gxp) + (gexp-proc gxp) + (%gexp-location gxp))) + ((lst ...) + (map rewrite-argument lst)) + (_ + arg))) + (define mapping-property ;; Property indicating whether the package has already been processed. (gensym " package-mapping-done")) @@ -1484,7 +1504,8 @@ (define* (package-mapping proc #:optional (cut? (const #f)) (inherit p) (location (package-location p)) (replacement (package-replacement p)) - (propagated-inputs (map rewrite (package-propagated-inputs p))) + (propagated-inputs (map rewrite-input + (package-propagated-inputs p))) (properties `((,mapping-property . #t) ,@(package-properties p))))))) @@ -1500,11 +1521,26 @@ (define* (package-mapping proc #:optional (cut? (const #f)) (location (package-location p)) (build-system (if deep? (build-system-with-package-mapping - (package-build-system p) rewrite) + (package-build-system p) + rewrite-input + rewrite-argument) (package-build-system p))) - (inputs (map rewrite (package-inputs p))) - (native-inputs (map rewrite (package-native-inputs p))) - (propagated-inputs (map rewrite (package-propagated-inputs p))) + (inputs (map rewrite-input (package-inputs p))) + (native-inputs (map rewrite-input (package-native-inputs p))) + (propagated-inputs + (map rewrite-input (package-propagated-inputs p))) + (arguments + (match p + (($ <package> _ _ _ _ args-proc) + ;; If we let ARGS-PROC be passed its original package, + ;; we somehow end up in an infinite (or maybe just + ;; exponential? Never seen it end...) loop. Should + ;; probably figure out what's causing that at some + ;; point. + (let ((args (args-proc this-package))) + (if deep? + (map rewrite-argument args) + args))))) (replacement (and=> (package-replacement p) replace)) (properties `((,mapping-property . #t) ,@(package-properties p))))))))) base-commit: bfb480e76f7968f8e39e37e64681b0fd062edb1e prerequisite-patch-id: b512735cd31c9f7564894ed3a5c1c3b921eeaed3 prerequisite-patch-id: d782bad3845786f3ef367822aeb146a1e5e994d7 prerequisite-patch-id: c277154bb5fbcb1e6a2af576d6f7eebde308b010 prerequisite-patch-id: 088174854de84cd796d4fe7f39386b1539a3df51 prerequisite-patch-id: 083848588d3bae9d392fb1270b64990f13209dbe prerequisite-patch-id: 36801b82c0a0365ab18a3a6ad3814e8fbe1b0630 prerequisite-patch-id: de0adff180c2ea6e9d1c34f8f0b1d62ec7863ccf prerequisite-patch-id: 7054626c27a5208550912b11e92bb16dab15fb34 prerequisite-patch-id: 5736a5673877a8185a80d0c9767f288bddc239d3 prerequisite-patch-id: 4e23b3ba151bebb40d56816915f9d0503fe1566b prerequisite-patch-id: 4edcd21bef307dbe07a9605314aaa446f45a943f prerequisite-patch-id: 0a98f8e01ac1df033a86b5f42d01dd9baece0807 prerequisite-patch-id: e55e0c751b9772a31656decb1aec8bcc193685b0 prerequisite-patch-id: 837b6cf8db48bdb22c7573ce0fb63a1a6255640b prerequisite-patch-id: 0c07d4138fc33f6d976b7c7ff2d25b93145dc417 prerequisite-patch-id: 1875c8e646ce329f8a72da90367c3725c953b5c2 prerequisite-patch-id: 8c429132b33f94d9f910413f56e9b3ca18d0db43 prerequisite-patch-id: 121cf7bd1b560e8db138132990840a20c20c6636 prerequisite-patch-id: e9662377bc432936ffbfffaa10dff3a285eacd26 prerequisite-patch-id: cfd757e3df23f22fbd88441ecabfe21f37b4d140 prerequisite-patch-id: a563c6b6f53532a7a6fb7fe8ebbb11d237947b7f prerequisite-patch-id: da271d8023063a789328959f5dc6389675d5d46a prerequisite-patch-id: 271b2952dc050715c90848953e3586b35e21d184 prerequisite-patch-id: 92caaf95030c644dec30fc139a63e25b1dc8d48c prerequisite-patch-id: e03d9290c61f083c96b084403e6dc69394ee2faa prerequisite-patch-id: 3ca7c6fd53e9cd1c07bfb2e16763ecaf6d0cc4eb prerequisite-patch-id: 018b82c741ee4e1370df059b22cc86aa4735644b prerequisite-patch-id: a26834894fcd1380dfd5a979088114d50d0df392 prerequisite-patch-id: 8916b1ce832d695ecb86e4f36b3fe1a5529552dc prerequisite-patch-id: 2230d379e61787c3327f89ef02c8de3ab879090d prerequisite-patch-id: fb4536c142e85bb0a6610203ae25a74f7342351d prerequisite-patch-id: dc0a3e2e36977cf203ad0c74650844758446c115 prerequisite-patch-id: f9e2903e96a7e6e08f9a9ce10e8f35650a2bc9d0 prerequisite-patch-id: 52609b8f7999fe1bfd2ad90aba421042b1e39a50 prerequisite-patch-id: 4b6138782ae74502be87966344f7bb5d88e8734c prerequisite-patch-id: 411c9c605a4e89efe01841517486a3d6015be917 prerequisite-patch-id: e07e206a39a0b173786207d335740f08d0baecb2 prerequisite-patch-id: 424af6d825a003e67545f8f23fc292407a029a4e prerequisite-patch-id: cd9480f3fbb837834ef9294aec9d25e797927456 prerequisite-patch-id: 2f401351ac266c92a77cbcf54549ce5bee78e93e prerequisite-patch-id: aff161c12c59578d3d1e4569ad3bea0ab7fa231d prerequisite-patch-id: 156e04e25c5f214fd5e9ba3a4548b960bf8d5142 prerequisite-patch-id: 61869ccfd561784d16df3d62dae522790b182ea0 prerequisite-patch-id: a19bb63b9c373c4f153545de121024c2f0008e03 prerequisite-patch-id: 92eb3cfcdb4791daed167477aa19d34400455f2b prerequisite-patch-id: 7e00825d11982a64a671116fc30ebe34ff562974 prerequisite-patch-id: a920acf76ea0ed8484888c28f5803def46b496e8 prerequisite-patch-id: a2f4feda897c80d54fefac2979b34dc8755d2562 prerequisite-patch-id: 66bd73e2012a407a0ae8c07ead463bb87ac7ceb1 prerequisite-patch-id: c7703e99c566323d908bfdd31896401c61d9c6e9 prerequisite-patch-id: b05dec5daf49254938536568b1f0e259f85a5f27 prerequisite-patch-id: 2ec62060c8d777a316cb35a5956fca2d6340c238 prerequisite-patch-id: 5e47032571af5476c2a4d9bbbe9c98ac62736acf prerequisite-patch-id: f3f2d80dc4d970ec7e27221b1713303a752602db prerequisite-patch-id: cf272874f837a1089867a3c578ba773b9722e4bc prerequisite-patch-id: 26b133febfaa8e56cacf9695fec9e47ac7752437 prerequisite-patch-id: 2370164c61289dc27dacd1a3fce404b42a5cd306 prerequisite-patch-id: 8e151f495e68d05d7ae3a58b75965ed6ad402cb3 prerequisite-patch-id: 1e1d8a1a5c3d2e7c012c3800b2f162bbfb11830e prerequisite-patch-id: 20b2ba87fb4a1d22b2e5d189868953deb1b8432d prerequisite-patch-id: 4b7a45d0216169dddf32b0556847edcf1fe83c77 prerequisite-patch-id: a7caa886acb871c8fae58942ea33c4830c1bf50a prerequisite-patch-id: 4cb809d1af72bfb4160541432f84e7f7a2ec377c prerequisite-patch-id: b8bba3077b9e27a14b7a4500145a546e2551920b prerequisite-patch-id: 42371e75be346f69a66f1af370f10e19118d3666 prerequisite-patch-id: fbcbda683c60fc49fb0acb35e8fcba3632e33c1d prerequisite-patch-id: 5a7497e62af0532f2262e825ecfffdc87b46a4cd prerequisite-patch-id: 39515c3e9d305eca348d158422e1db32d02a2f6f prerequisite-patch-id: cb139244b5614b18feeb19793713a1836e637e23 prerequisite-patch-id: 095b7088b6d2e2738d07a2c5409f9116640f1e8c prerequisite-patch-id: 36e9e48ae432da7f9e0438ff3bd2476fb4ee17ef prerequisite-patch-id: a0be866c6a75021f6d9ae024a5ebeb94f14ef039 prerequisite-patch-id: 0d424f7822bad63211e0f5f2e8432053fcc2280d prerequisite-patch-id: a59b7626f41bf5570f2119e4b148c7da4370c604 prerequisite-patch-id: 3d4f86e81bda469eb2cac04b6781847f32ba2d4b prerequisite-patch-id: d364cccdb604ed9d3d9b98d821ef1bcba2f93dd4 prerequisite-patch-id: ad4bbb2ffa1a81c85e6f7a3da474648c57abeb08 prerequisite-patch-id: b2ccfb33f49dcee45d0eae151d63c20619eba269 prerequisite-patch-id: 370503f330a01247f61b6f8da90cc1874addca9d prerequisite-patch-id: bf97596682da5aa565d63e58806e64c57501bfbf prerequisite-patch-id: ff1ce6c53974f6458a24f5d68d656514a49b496a prerequisite-patch-id: abec97caff0781ddf8bac457259e336956d31f56 prerequisite-patch-id: 10b5231fdd5214c7ce994d13e9bc4accd9c3e98b prerequisite-patch-id: 6c3ff15435a372b3c176d0ec839507093e7f75d5 prerequisite-patch-id: d874c3ae8cc9643fe65c0def0ab9f62a30ef265e prerequisite-patch-id: 301b58dab98c976159b086b6d9b215f6cfc32560 prerequisite-patch-id: d946ee345019733d07c28073643c11d6a0265887 prerequisite-patch-id: eb86ebc23516ee5a1c69fad149fbf5a82fbf44e2 prerequisite-patch-id: f3aae14f0dc6bd6c07b5405db4efb8677eb109db prerequisite-patch-id: a596041f0af7a7fb2ff8fc39e61c75d1add0b21a prerequisite-patch-id: 6dc272118cfeb1aea0819a796beace8fa8305be7 prerequisite-patch-id: 8dea513488503b59c1971a20b6e5af36fab30f16 prerequisite-patch-id: 489930e028059725a437833f8144cba5b5f88275 prerequisite-patch-id: 101a681e226bba3d782559f9966ed75f6cfac4d0 prerequisite-patch-id: 02d84b8de56dcf379619cb73975e08541258a744 prerequisite-patch-id: 22eb2f65315c0eec851686f01a43772184be67c2 prerequisite-patch-id: f4013eaef497b4e39d5680ae87c388f5e90d962c prerequisite-patch-id: e774f3f01024e9b0522c62d7f0e2e745d1eec9d6 prerequisite-patch-id: 6fea198a4035448351e7ab3c859f5ba7a9974e3e prerequisite-patch-id: 9f9ee707bc7da130f29d23398775b7648345fddd prerequisite-patch-id: fef59953278e9b5c86db36ff047117203aac756c prerequisite-patch-id: 076981cbfd6fdf83498b0abbfab4aa41b17bf32f prerequisite-patch-id: 63746b98da1e924ec78b707e0cab29e1913793e6 prerequisite-patch-id: 4c8b859607b829c54ea2bc94d8fd1807054e347f prerequisite-patch-id: ca54f1fae5954706f3f4b46427b39f3096193e20 prerequisite-patch-id: 8d1176310f67c10d84f7d409152c45584637a5e1 prerequisite-patch-id: d973cfefc6c2621052370ef917c5a30b4b4c6153 prerequisite-patch-id: a16615ac67d4cfb2d7f991d41d7b88e536b8d1e6 prerequisite-patch-id: c99f1ac1c8f31966ab5eace82966b38d7683c7b6 prerequisite-patch-id: ea8cbbe7d266c8e01f92cf47c67a2b77ba2e2f2a prerequisite-patch-id: 87f853bef8078737d6ee37152f9540dc318577b8 prerequisite-patch-id: 624ebedc4b5efd852396af22dfee278e81e18607 prerequisite-patch-id: b0386c11c46382a027d6feb7f8cee077fd1ce7f0 prerequisite-patch-id: f30932e3c494a7e2e758c71a15600f7d02e5fe3c prerequisite-patch-id: c6e5542e49b9e990abfd941b82e6c8f47cce82eb prerequisite-patch-id: 8ed51ac5bb592e2b9a3726d009b390eaf3d02a22 prerequisite-patch-id: 3eb38c477f4039d6dad8ea7657461d5b69582cea prerequisite-patch-id: 604ec349a2100c97da1a9e86443e5fe670fc9aff prerequisite-patch-id: 0ec9b5ad92a820364e736176265cbf38a6aa9865 prerequisite-patch-id: 9f9f6f4f5e6f3f38d57c8fc51dd6d1d1b13614aa prerequisite-patch-id: 3084be13b8e6449d0739a66199d78fd83b273dc9 prerequisite-patch-id: 38129e693708c4068b779fe561befa0789da4e68 prerequisite-patch-id: e599d0af678fca48957ba931713ba46acf57cd26 prerequisite-patch-id: 82676aa787f2d5896dbcc966014c85933ee203bd prerequisite-patch-id: 4e1a39929ca7eb97be4a265ab2961ebb00ac2494 prerequisite-patch-id: 928b20a27997c43597c625e6e431e9963b8a6cdc prerequisite-patch-id: eea41f1a51b1062b9f7fe17ba9b0827bce4f7f8d prerequisite-patch-id: 94d48d21b6e420f0d9bf99d9488136b667d047b4 prerequisite-patch-id: c06f0d333b33836de8800323e814d6dcf214fd78 prerequisite-patch-id: 44515b47a0e5f194b1e782bbbdf4597418c46f77 prerequisite-patch-id: 94eeb31189a81ccbf18dda42a72db715bec3a279 prerequisite-patch-id: d02e7863404940800b63dca3f328547df5cac24f prerequisite-patch-id: c47b08cb4e7ab0a024a2be4b250c4b60ab0bab65 prerequisite-patch-id: fb2396bde2637b96c4412df6ef6a09e9c38e3365 prerequisite-patch-id: 7068eef2aa4f77ef304869b3661c25238f7497e5 prerequisite-patch-id: a2f06d63b11dce495cddad29f5f507a380ff23c2 prerequisite-patch-id: b21a55b8bf2bd23485e0d7d6433ec1f29acd6226 prerequisite-patch-id: 7fd6c9378b4c96bbc7e109f759fd4e7ff6bacba2 prerequisite-patch-id: b109590bb6082361a59547bf252f576a574b75e8 prerequisite-patch-id: f5aa2b7352ffec54c23277d9d4715bbd95c1eb79 prerequisite-patch-id: 2a9907079587beb938680221ededa8f5e0e7d4b2 prerequisite-patch-id: 90f4e54d0b451db6166dbd1d2067e07696e092bf prerequisite-patch-id: 999ec11aaddd785d065911dcb1fc7385ccf053d6 prerequisite-patch-id: cc250a0b2267760feea1427573482db1bb8328e6 prerequisite-patch-id: b593f9fd55bbd9e855baba4b1037d844d5773916 prerequisite-patch-id: 74e3c356cee5e56d4dc3f5bc4f5705cd2ce75a1d prerequisite-patch-id: 7443872a7242e134d8f95398c53f47d4ae21a23b prerequisite-patch-id: da89093d1a5bb1dd8bb6436f4daf70eb4025eae9 prerequisite-patch-id: 3be9735669c6510ef29e75588bbf907d57733834 prerequisite-patch-id: 976e476ba476fe3cd730ac29c825fad81c6331d1 prerequisite-patch-id: 889a29b57cea9cb18f4f4a9c22b04d151b216e1d prerequisite-patch-id: 6b6690e68606f4359e22656a7c6aeae5c58ea017 prerequisite-patch-id: c46954eddc80453f6d7c045fa22ec99a694d9693 prerequisite-patch-id: bdccc141b570181273512c2089d95e4ebcdae453 prerequisite-patch-id: ee3338d64821748f9a7d8ed9cf5e9181c2027252 prerequisite-patch-id: 7f7da1ba32e01163b013d5c4ac96aa468f6e908e prerequisite-patch-id: 83a09cce225aaaa626b3f5d2f3a092055f61a909 prerequisite-patch-id: 7f31991b2e91782e9dd1c1a6fda5f055fdff3234 prerequisite-patch-id: 831310b4d4842a08ad12fdf5c07ce55b57db049d prerequisite-patch-id: 9588d67009d034f36ceef115b158556b8cacb680 prerequisite-patch-id: e0807504b7c5f14f0af8bdbbdd800754888dd8f8 prerequisite-patch-id: 6e3d6e24505bd188d776720913c18c4b874c896c prerequisite-patch-id: e20a2cd4b5a85889b97a5733863175fb56420d01 -- 2.40.1 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.3: 0002-build-system-asdf-use-substitute-keyword-arguments-w.patch --] [-- Type: text/x-patch, Size: 1696 bytes --] From dcd9b6505fa46d139d40141cf29d7eef15c46481 Mon Sep 17 00:00:00 2001 Message-Id: <dcd9b6505fa46d139d40141cf29d7eef15c46481.1694806866.git.striness@tilde.club> In-Reply-To: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> References: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> From: Ulf Herrman <striness@tilde.club> Date: Fri, 15 Sep 2023 07:48:48 -0500 Subject: [PATCH 2/5] build-system: asdf: use substitute-keyword-arguments with default. A two-argument substitute-keyword-arguments clause won't be evaluated when there isn't already a keyword in the argument list. Using a three-argument clause allows the phases-transformer to be run in all cases. * guix/build-system/asdf.scm (package-with-build-system): use %standard-phases as default value of `phases', use gexps. --- guix/build-system/asdf.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm index 2b17cee37b..cd041eed4f 100644 --- a/guix/build-system/asdf.scm +++ b/guix/build-system/asdf.scm @@ -218,7 +218,8 @@ (define* (package-with-build-system from-build-system to-build-system (build-system to-build-system) (arguments (substitute-keyword-arguments base-arguments - ((#:phases phases) (list phases-transformer phases)))) + ((#:phases phases #~%standard-phases) + #~(#$phases-transformer #$phases)))) (inputs (new-inputs package-inputs)) (propagated-inputs (new-propagated-inputs)) (native-inputs (append (if target-is-source? -- 2.40.1 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.4: 0003-build-system-include-all-argument-packages-in-bag-ar.patch --] [-- Type: text/x-patch, Size: 45107 bytes --] From 4b42f9501284ad66d4de04f5b94bdaf412008d5d Mon Sep 17 00:00:00 2001 Message-Id: <4b42f9501284ad66d4de04f5b94bdaf412008d5d.1694806866.git.striness@tilde.club> In-Reply-To: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> References: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> From: Ulf Herrman <striness@tilde.club> Date: Fri, 15 Sep 2023 08:31:58 -0500 Subject: [PATCH 3/5] build-system: include all argument packages in bag args explicitly. Deep package transformations currently miss several implicit input packages because they are introduced via the bag->derivation builder procedure. This is the case with, for example, qtbase in qt-build-system. This can be avoided by ensuring that those arguments are always explicitly specified in the bag arguments list. Notably, this is also the case for the guile used by the generated build script, so every single build system that uses gexp->derivation needs to be modified. * guix/build-system/agda.scm (lower): include guile in bag arguments. * guix/build-system/android-ndk.scm (lower): include guile in bag arguments. * guix/build-system/ant.scm (lower): include guile in bag arguments. * guix/build-system/asdf.scm (lower, lower/source): include guile in bag arguments. * guix/build-system/cargo.scm (lower): include guile in bag arguments. * guix/build-system/chicken.scm (lower): include guile in bag arguments. * guix/build-system/clojure.scm (lower): include guile in bag arguments. * guix/build-system/cmake.scm (lower): include guile in bag arguments. * guix/build-system/copy.scm (lower): include guile in bag arguments. * guix/build-system/dub.scm (lower): include guile in bag arguments. * guix/build-system/dune.scm (lower): include guile in bag arguments. * guix/build-system/elm.scm (lower): include guile in bag arguments. * guix/build-system/emacs.scm (lower): include guile in bag arguments. * guix/build-system/font.scm (lower): include guile in bag arguments. * guix/build-system/glib-or-gtk.scm (lower): include guile in bag arguments. * guix/build-system/gnu.scm (lower): include guile in bag arguments. * guix/build-system/go.scm (lower): include guile in bag arguments. * guix/build-system/guile.scm (lower): include guile in bag arguments. * guix/build-system/haskell.scm (lower): include guile in bag arguments. * guix/build-system/julia.scm (lower): include guile in bag arguments. * guix/build-system/linux-module.scm (lower): include guile in bag arguments. * guix/build-system/maven.scm (lower): include guile in bag arguments. * guix/build-system/meson.scm (lower): include guile in bag arguments. * guix/build-system/minify.scm (lower): include guile in bag arguments. * guix/build-system/node.scm (lower): include guile in bag arguments. * guix/build-system/ocaml.scm (lower): include guile in bag arguments. * guix/build-system/perl.scm (lower): include guile in bag arguments. * guix/build-system/pyproject.scm (lower): include guile in bag arguments. * guix/build-system/python.scm (lower): include guile in bag arguments. * guix/build-system/qt.scm (lower): include guile and qtbase in bag arguments. * guix/build-system/r.scm (lower): include guile in bag arguments. * guix/build-system/rakudo.scm (lower): include guile in bag arguments. * guix/build-system/rebar.scm (lower): include guile in bag arguments. * guix/build-system/renpy.scm (lower): include guile in bag arguments. * guix/build-system/ruby.scm (lower): include guile in bag arguments. * guix/build-system/scons.scm (lower): include guile in bag arguments. * guix/build-system/texlive.scm (lower): include guile in bag arguments. * guix/build-system/tree-sitter.scm (lower): include guile in bag arguments. * guix/build-system/trivial.scm (lower): include guile in bag arguments. --- guix/build-system/agda.scm | 6 +++++- guix/build-system/android-ndk.scm | 6 +++++- guix/build-system/ant.scm | 6 +++++- guix/build-system/asdf.scm | 12 ++++++++++-- guix/build-system/cargo.scm | 6 +++++- guix/build-system/chicken.scm | 6 +++++- guix/build-system/clojure.scm | 7 +++++-- guix/build-system/cmake.scm | 6 +++++- guix/build-system/copy.scm | 6 +++++- guix/build-system/dub.scm | 6 +++++- guix/build-system/dune.scm | 5 ++++- guix/build-system/elm.scm | 6 +++++- guix/build-system/emacs.scm | 6 +++++- guix/build-system/font.scm | 6 +++++- guix/build-system/glib-or-gtk.scm | 6 +++++- guix/build-system/gnu.scm | 6 +++++- guix/build-system/go.scm | 6 +++++- guix/build-system/guile.scm | 5 ++++- guix/build-system/haskell.scm | 4 +++- guix/build-system/julia.scm | 6 +++++- guix/build-system/linux-module.scm | 6 +++++- guix/build-system/maven.scm | 6 +++++- guix/build-system/meson.scm | 6 +++++- guix/build-system/minify.scm | 6 +++++- guix/build-system/node.scm | 6 +++++- guix/build-system/ocaml.scm | 6 +++++- guix/build-system/perl.scm | 6 +++++- guix/build-system/pyproject.scm | 6 +++++- guix/build-system/python.scm | 6 +++++- guix/build-system/qt.scm | 7 ++++++- guix/build-system/r.scm | 6 +++++- guix/build-system/rakudo.scm | 6 +++++- guix/build-system/rebar.scm | 6 +++++- guix/build-system/renpy.scm | 6 +++++- guix/build-system/ruby.scm | 6 +++++- guix/build-system/scons.scm | 6 +++++- guix/build-system/texlive.scm | 6 +++++- guix/build-system/tree-sitter.scm | 6 +++++- guix/build-system/trivial.scm | 3 ++- guix/build-system/waf.scm | 6 +++++- 40 files changed, 199 insertions(+), 42 deletions(-) diff --git a/guix/build-system/agda.scm b/guix/build-system/agda.scm index 64983dff60..511f1f11b5 100644 --- a/guix/build-system/agda.scm +++ b/guix/build-system/agda.scm @@ -47,6 +47,7 @@ (define %default-modules (define* (lower name #:key source inputs native-inputs outputs system target (agda (default-agda)) + (guile (default-guile)) gnu-and-haskell? #:allow-other-keys #:rest arguments) @@ -73,7 +74,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build agda-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (agda-build name inputs #:key diff --git a/guix/build-system/android-ndk.scm b/guix/build-system/android-ndk.scm index 047f884b19..064aacceaa 100644 --- a/guix/build-system/android-ndk.scm +++ b/guix/build-system/android-ndk.scm @@ -82,6 +82,7 @@ (define* (android-ndk-build name inputs (define* (lower name #:key source inputs native-inputs outputs system target + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -106,7 +107,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build android-ndk-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define android-ndk-build-system (build-system diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm index cfb033f6a5..d4998b26e1 100644 --- a/guix/build-system/ant.scm +++ b/guix/build-system/ant.scm @@ -69,6 +69,7 @@ (define* (lower name (jdk (default-jdk)) (ant (default-ant)) (zip (default-zip)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -92,7 +93,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build ant-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (ant-build name inputs #:key diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm index cd041eed4f..1adbe7d996 100644 --- a/guix/build-system/asdf.scm +++ b/guix/build-system/asdf.scm @@ -73,6 +73,7 @@ (define (default-lisp implementation) (define* (lower/source name #:key source inputs outputs native-inputs system target + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME" @@ -91,7 +92,10 @@ (define* (lower/source name (build-inputs native-inputs) (outputs outputs) (build asdf-build/source) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (asdf-build/source name inputs #:key source outputs @@ -245,6 +249,7 @@ (define (lower lisp-type) (lambda* (name #:key source inputs outputs native-inputs system target (lisp (default-lisp (string->symbol lisp-type))) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME" @@ -264,7 +269,10 @@ (define (lower lisp-type) ,@native-inputs)) (outputs outputs) (build (asdf-build lisp-type)) - (arguments (strip-keyword-arguments private-keywords arguments)))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))))) (define (asdf-build lisp-type) (lambda* (name inputs diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 912400a191..84efea019e 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -238,6 +238,7 @@ (define* (lower name (rust (default-rust)) (cargo-inputs '()) (cargo-development-inputs '()) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -264,7 +265,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build cargo-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define cargo-build-system (build-system diff --git a/guix/build-system/chicken.scm b/guix/build-system/chicken.scm index 9f518e66e6..ac1c5804ac 100644 --- a/guix/build-system/chicken.scm +++ b/guix/build-system/chicken.scm @@ -53,6 +53,7 @@ (define (default-chicken) (define* (lower name #:key source inputs native-inputs outputs system target (chicken (default-chicken)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -77,7 +78,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build chicken-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (chicken-build name inputs #:key diff --git a/guix/build-system/clojure.scm b/guix/build-system/clojure.scm index fb897356bc..921edab912 100644 --- a/guix/build-system/clojure.scm +++ b/guix/build-system/clojure.scm @@ -75,6 +75,7 @@ (define* (lower name (clojure (force %default-clojure)) (jdk (force %default-jdk)) (zip (force %default-zip)) + (guile (default-guile)) outputs system #:allow-other-keys #:rest arguments) @@ -98,8 +99,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build clojure-build) - (arguments (strip-keyword-arguments private-keywords - arguments)))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))))) (define* (clojure-build name inputs #:key diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm index aa187c9844..8db841992c 100644 --- a/guix/build-system/cmake.scm +++ b/guix/build-system/cmake.scm @@ -57,6 +57,7 @@ (define (default-cmake target) (define* (lower name #:key source inputs native-inputs outputs system target (cmake (default-cmake target)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -93,7 +94,10 @@ (define* (lower name '())) (outputs outputs) (build (if target cmake-cross-build cmake-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (cmake-build name inputs #:key guile source diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm index d58931b33c..2507d77bcc 100644 --- a/guix/build-system/copy.scm +++ b/guix/build-system/copy.scm @@ -57,6 +57,7 @@ (define (default-glibc) (define* (lower name #:key source inputs native-inputs outputs system target (glibc (default-glibc)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME from the given arguments." @@ -75,7 +76,10 @@ (define* (lower name (build-inputs native-inputs) (outputs outputs) (build copy-build) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (copy-build name inputs #:key diff --git a/guix/build-system/dub.scm b/guix/build-system/dub.scm index b4011cdb83..1b9f21b052 100644 --- a/guix/build-system/dub.scm +++ b/guix/build-system/dub.scm @@ -106,6 +106,7 @@ (define* (lower name (dub (default-dub)) (pkg-config (default-pkg-config)) (ld-gold-wrapper (default-ld-gold-wrapper)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -131,7 +132,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build dub-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define dub-build-system (build-system diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm index c45f308349..bad523b9eb 100644 --- a/guix/build-system/dune.scm +++ b/guix/build-system/dune.scm @@ -57,6 +57,7 @@ (define* (lower name (dune (default-dune)) (ocaml (ocaml:default-ocaml)) (findlib (ocaml:default-findlib)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -92,7 +93,9 @@ (define* (lower name (build dune-build) (arguments (append `(#:dune-release-flags ,dune-release-flags) - (strip-keyword-arguments private-keywords arguments))))))) + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))))) (define* (dune-build name inputs #:key diff --git a/guix/build-system/elm.scm b/guix/build-system/elm.scm index f5321f811b..1c2b4a003e 100644 --- a/guix/build-system/elm.scm +++ b/guix/build-system/elm.scm @@ -119,6 +119,7 @@ (define* (lower name #:key source inputs native-inputs outputs system target (implicit-elm-package-inputs? #t) (elm (default-elm)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -165,7 +166,10 @@ (define* (lower name ,@(standard-packages))) (outputs outputs) (build elm-build) - (arguments (strip-keyword-arguments private-keywords arguments)))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))))) (define* (elm-build name inputs #:key diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index ebf97a5344..4ab2883769 100644 --- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -57,6 +57,7 @@ (define (default-emacs) (define* (lower name #:key source inputs native-inputs outputs system target (emacs (default-emacs)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -78,7 +79,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build emacs-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (emacs-build name inputs #:key source diff --git a/guix/build-system/font.scm b/guix/build-system/font.scm index c57c304f52..018b5c69dd 100644 --- a/guix/build-system/font.scm +++ b/guix/build-system/font.scm @@ -44,6 +44,7 @@ (define %font-build-system-modules (define* (lower name #:key source inputs native-inputs outputs system target + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -69,7 +70,10 @@ (define* (lower name ("xz" xz)))))) (outputs outputs) (build font-build) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (font-build name inputs #:key source diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm index 726d19efad..f8d5a0fa24 100644 --- a/guix/build-system/glib-or-gtk.scm +++ b/guix/build-system/glib-or-gtk.scm @@ -87,6 +87,7 @@ (define* (lower name (implicit-inputs? #t) (implicit-cross-inputs? #t) (strip-binaries? #t) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -120,7 +121,10 @@ (define* (lower name '())) (outputs outputs) (build (if target glib-or-gtk-cross-build glib-or-gtk-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (glib-or-gtk-build name inputs #:key guile source diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index c1aa187c42..7945efa1c3 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -278,6 +278,7 @@ (define* (lower name #:key source inputs native-inputs outputs target (implicit-inputs? #t) (implicit-cross-inputs? #t) (strip-binaries? #t) system + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME from the given arguments." @@ -319,7 +320,10 @@ (define* (lower name outputs (delete "debug" outputs))) (build (if target gnu-cross-build gnu-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define %license-file-regexp ;; Regexp matching license files. diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm index 0a9761aac7..e27633b624 100644 --- a/guix/build-system/go.scm +++ b/guix/build-system/go.scm @@ -120,6 +120,7 @@ (define (make-go-std) (define* (lower name #:key source inputs native-inputs outputs system target (go (default-go)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -164,7 +165,10 @@ (define* (lower name (outputs outputs) (build (if target go-cross-build go-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (go-build name inputs #:key diff --git a/guix/build-system/guile.scm b/guix/build-system/guile.scm index 1bd292e267..49d8cc77a7 100644 --- a/guix/build-system/guile.scm +++ b/guix/build-system/guile.scm @@ -68,7 +68,10 @@ (define* (lower name '()))) (outputs outputs) (build (if target guile-cross-build guile-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) (default-guile)))))) (define %compile-flags ;; Flags passed to 'guild compile' by default. We choose a common diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm index f8568e33db..b860550998 100644 --- a/guix/build-system/haskell.scm +++ b/guix/build-system/haskell.scm @@ -77,6 +77,7 @@ (define* (lower name #:key source inputs native-inputs outputs system target (haskell (default-haskell)) cabal-revision + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -122,7 +123,8 @@ (define* (lower name (match (package-transitive-propagated-inputs pkg) (((propagated-names . _) ...) (cons name propagated-names)))))) - extra-directories)))))))) + extra-directories))) + ((#:guile _ #t) guile)))))) (define* (haskell-build name inputs #:key source diff --git a/guix/build-system/julia.scm b/guix/build-system/julia.scm index b5521e38e4..b4fc7f6576 100644 --- a/guix/build-system/julia.scm +++ b/guix/build-system/julia.scm @@ -53,6 +53,7 @@ (define (default-julia) (define* (lower name #:key source inputs native-inputs outputs system target (julia (default-julia)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -74,7 +75,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build julia-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (julia-build name inputs #:key source diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm index e46195b53c..d286ea9cee 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm @@ -112,6 +112,7 @@ (define* (lower name #:key source inputs native-inputs outputs system target (linux (default-linux)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -148,7 +149,10 @@ (define* (lower name '())) (outputs outputs) (build (if target linux-module-build-cross linux-module-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (linux-module-build name inputs #:key diff --git a/guix/build-system/maven.scm b/guix/build-system/maven.scm index 4bbeaed6a4..b7734a1a07 100644 --- a/guix/build-system/maven.scm +++ b/guix/build-system/maven.scm @@ -116,6 +116,7 @@ (define* (lower name (maven-plugins (default-maven-plugins)) (local-packages '()) (exclude %default-exclude) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -139,7 +140,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build maven-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (maven-build name inputs #:key diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index 7c617bffb0..13e2e87b58 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -125,6 +125,7 @@ (define* (lower name (meson (default-meson)) (ninja (default-ninja)) (glib-or-gtk? #f) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -156,7 +157,10 @@ (define* (lower name '())) (outputs outputs) (build (if target meson-cross-build meson-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (meson-build name inputs #:key diff --git a/guix/build-system/minify.scm b/guix/build-system/minify.scm index 787235deeb..384748908c 100644 --- a/guix/build-system/minify.scm +++ b/guix/build-system/minify.scm @@ -50,6 +50,7 @@ (define (default-uglify-js) (define* (lower name #:key source inputs native-inputs outputs system (uglify-js (default-uglify-js)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -68,7 +69,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build minify-build) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (minify-build name inputs #:key diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 3f73390809..0b1c1f1ddd 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -48,6 +48,7 @@ (define (default-node) (define* (lower name #:key source inputs native-inputs outputs system target (node (default-node)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -74,7 +75,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build node-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (node-build name inputs #:key diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm index 582d00b4cd..91dda0c391 100644 --- a/guix/build-system/ocaml.scm +++ b/guix/build-system/ocaml.scm @@ -229,6 +229,7 @@ (define* (lower name #:key source inputs native-inputs outputs system target (ocaml (default-ocaml)) (findlib (default-findlib)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -251,7 +252,10 @@ (define* (lower name ,@(standard-packages))) (outputs outputs) (build ocaml-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (ocaml-build name inputs #:key diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm index 7c6deb34bf..99e952a531 100644 --- a/guix/build-system/perl.scm +++ b/guix/build-system/perl.scm @@ -58,6 +58,7 @@ (define* (lower name #:key source inputs native-inputs outputs system target (perl (default-perl)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -99,7 +100,10 @@ (define* (lower name (build (if target perl-cross-build perl-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (perl-build name inputs #:key source diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm index 2a2c3af3f3..41b4d2c23f 100644 --- a/guix/build-system/pyproject.scm +++ b/guix/build-system/pyproject.scm @@ -60,6 +60,7 @@ (define sanity-check.py (define* (lower name #:key source inputs native-inputs outputs system target (python (default-python)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -82,7 +83,10 @@ (define* (lower name ,@native-inputs)) (outputs (append outputs '(wheel))) (build pyproject-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (pyproject-build name inputs #:key source diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm index cca009fb28..f8657662af 100644 --- a/guix/build-system/python.scm +++ b/guix/build-system/python.scm @@ -142,6 +142,7 @@ (define (strip-python2-variant p) (define* (lower name #:key source inputs native-inputs outputs system target (python (default-python)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -164,7 +165,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build python-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (python-build name inputs #:key source diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm index 978aed0fc1..97f870a698 100644 --- a/guix/build-system/qt.scm +++ b/guix/build-system/qt.scm @@ -80,6 +80,7 @@ (define* (lower name #:key source inputs native-inputs outputs system target (cmake (default-cmake)) (qtbase (default-qtbase)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -116,7 +117,11 @@ (define* (lower name '())) (outputs outputs) (build (if target qt-cross-build qt-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:qtbase _ #t) qtbase) + ((#:guile _ #t) guile))))) (define* (qt-build name inputs diff --git a/guix/build-system/r.scm b/guix/build-system/r.scm index 657346bea3..ed70d7b758 100644 --- a/guix/build-system/r.scm +++ b/guix/build-system/r.scm @@ -79,6 +79,7 @@ (define (default-r) (define* (lower name #:key source inputs native-inputs outputs system target (r (default-r)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -100,7 +101,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build r-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (r-build name inputs #:key diff --git a/guix/build-system/rakudo.scm b/guix/build-system/rakudo.scm index 3b30fdfd0e..654b0c362b 100644 --- a/guix/build-system/rakudo.scm +++ b/guix/build-system/rakudo.scm @@ -68,6 +68,7 @@ (define* (lower name (zef (default-zef)) (with-prove6? #t) (with-zef? #t) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -95,7 +96,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build rakudo-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (rakudo-build name inputs #:key diff --git a/guix/build-system/rebar.scm b/guix/build-system/rebar.scm index de1294ec3f..e89f82b768 100644 --- a/guix/build-system/rebar.scm +++ b/guix/build-system/rebar.scm @@ -74,6 +74,7 @@ (define* (lower name #:key source inputs native-inputs outputs system target (rebar (default-rebar3)) (erlang (default-erlang)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME from the given arguments." @@ -95,7 +96,10 @@ (define* (lower name ,@(standard-packages))) (outputs outputs) (build rebar-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (rebar-build name inputs #:key diff --git a/guix/build-system/renpy.scm b/guix/build-system/renpy.scm index 3039e3c63b..75d546fedc 100644 --- a/guix/build-system/renpy.scm +++ b/guix/build-system/renpy.scm @@ -49,6 +49,7 @@ (define %renpy-build-system-modules (define* (lower name #:key source inputs native-inputs outputs system target (renpy (default-renpy)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -70,7 +71,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build renpy-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (renpy-build name inputs #:key diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm index a3793a9381..be8df2a93c 100644 --- a/guix/build-system/ruby.scm +++ b/guix/build-system/ruby.scm @@ -50,6 +50,7 @@ (define (default-ruby) (define* (lower name #:key source inputs native-inputs outputs system target (ruby (default-ruby)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -71,7 +72,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build ruby-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (ruby-build name inputs #:key source diff --git a/guix/build-system/scons.scm b/guix/build-system/scons.scm index 046ddef740..95c75c817f 100644 --- a/guix/build-system/scons.scm +++ b/guix/build-system/scons.scm @@ -50,6 +50,7 @@ (define (default-scons) (define* (lower name #:key source inputs native-inputs outputs system target (scons (default-scons)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -71,7 +72,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build scons-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (scons-build name inputs #:key diff --git a/guix/build-system/texlive.scm b/guix/build-system/texlive.scm index 88372faa58..941fa37b5f 100644 --- a/guix/build-system/texlive.scm +++ b/guix/build-system/texlive.scm @@ -98,6 +98,7 @@ (define* (lower name system target (texlive-latex-bin? #true) (texlive-bin (default-texlive-bin)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -122,7 +123,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build texlive-build) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (texlive-build name inputs #:key diff --git a/guix/build-system/tree-sitter.scm b/guix/build-system/tree-sitter.scm index 21c4eb35b2..1ea0c58817 100644 --- a/guix/build-system/tree-sitter.scm +++ b/guix/build-system/tree-sitter.scm @@ -38,6 +38,7 @@ (define %tree-sitter-build-system-modules (define* (lower name #:key source inputs native-inputs outputs system target + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME from the given arguments." @@ -87,7 +88,10 @@ (define* (lower name (("out") (cons "js" outputs)) (_ outputs))) (build (if target tree-sitter-cross-build tree-sitter-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile))))) (define* (tree-sitter-build name inputs #:key diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm index e08884baf1..37798cbf7a 100644 --- a/guix/build-system/trivial.scm +++ b/guix/build-system/trivial.scm @@ -26,7 +26,8 @@ (define-module (guix build-system trivial) (define* (lower name #:key source inputs native-inputs outputs system target - guile builder (modules '()) allowed-references) + (guile (default-guile)) builder (modules '()) + allowed-references) "Return a bag for NAME." (bag (name name) diff --git a/guix/build-system/waf.scm b/guix/build-system/waf.scm index 91b3d0d100..abb87156c7 100644 --- a/guix/build-system/waf.scm +++ b/guix/build-system/waf.scm @@ -47,6 +47,7 @@ (define %waf-build-system-modules (define* (lower name #:key source inputs native-inputs outputs system target (python (default-python)) + (guile (default-guile)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -68,7 +69,10 @@ (define* (lower name ,@native-inputs)) (outputs outputs) (build waf-build) ; only change compared to 'lower' in python.scm - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) (define* (waf-build name inputs #:key source -- 2.40.1 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.5: 0004-build-system-cargo-dune-ocaml-scons-use-drv-guile-fo.patch --] [-- Type: text/x-patch, Size: 5872 bytes --] From 9ec825fd06f32757f45f31880e7b238bba769884 Mon Sep 17 00:00:00 2001 Message-Id: <9ec825fd06f32757f45f31880e7b238bba769884.1694806866.git.striness@tilde.club> In-Reply-To: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> References: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> From: Ulf Herrman <striness@tilde.club> Date: Fri, 15 Sep 2023 08:45:39 -0500 Subject: [PATCH 4/5] build-system: {cargo,dune,ocaml,scons}: use drv guile-for-build. These all pass a guile *package* to gexp->derivation in their bag->derivation builders, but it wants a derivation. * guix/build-system/cargo.scm (cargo-build): use package->derivation to get guile for build. * guix/build-system/dune.scm (dune-build): same. * guix/build-system/ocaml.scm (ocaml-build): same. * guix/build-system/scons.scm (scons-build): same. --- guix/build-system/cargo.scm | 12 +++++++----- guix/build-system/dune.scm | 14 ++++++++------ guix/build-system/ocaml.scm | 13 ++++++++----- guix/build-system/scons.scm | 13 ++++++++----- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 84efea019e..30d6d2ead9 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -120,11 +120,13 @@ (define* (cargo-build name inputs (map search-path-specification->sexp search-paths)))))) - (gexp->derivation name builder - #:system system - #:target #f - #:graft? #f - #:guile-for-build guile)) + (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) + system #:graft? #f))) + (gexp->derivation name builder + #:system system + #:target #f + #:graft? #f + #:guile-for-build guile))) (define (package-cargo-inputs p) (apply diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm index bad523b9eb..1bf93361aa 100644 --- a/guix/build-system/dune.scm +++ b/guix/build-system/dune.scm @@ -21,6 +21,7 @@ (define-module (guix build-system dune) #:use-module (guix store) + #:use-module (guix monads) #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix search-paths) @@ -154,12 +155,13 @@ (define* (dune-build name inputs #:strip-binaries? #$strip-binaries? #:strip-flags #$strip-flags #:strip-directories #$strip-directories)))) - - (gexp->derivation name builder - #:system system - #:target #f - #:graft? #f - #:guile-for-build guile)) + (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) + system #:graft? #f))) + (gexp->derivation name builder + #:system system + #:target #f + #:graft? #f + #:guile-for-build guile))) (define dune-build-system (build-system diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm index 91dda0c391..20327295f9 100644 --- a/guix/build-system/ocaml.scm +++ b/guix/build-system/ocaml.scm @@ -21,6 +21,7 @@ (define-module (guix build-system ocaml) #:use-module (guix store) #:use-module (guix utils) #:use-module (guix gexp) + #:use-module (guix monads) #:use-module (guix search-paths) #:use-module (guix build-system) #:use-module (guix build-system gnu) @@ -309,11 +310,13 @@ (define* (ocaml-build name inputs #:strip-flags #$strip-flags #:strip-directories #$strip-directories)))) - (gexp->derivation name builder - #:system system - #:target #f - #:graft? #f - #:guile-for-build guile)) + (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) + system #:graft? #f))) + (gexp->derivation name builder + #:system system + #:target #f + #:graft? #f + #:guile-for-build guile))) (define ocaml-build-system (build-system diff --git a/guix/build-system/scons.scm b/guix/build-system/scons.scm index 95c75c817f..e504db90c2 100644 --- a/guix/build-system/scons.scm +++ b/guix/build-system/scons.scm @@ -22,6 +22,7 @@ (define-module (guix build-system scons) #:use-module (guix packages) #:use-module (guix monads) #:use-module (guix gexp) + #:use-module (guix store) #:use-module (guix search-paths) #:use-module (guix build-system) #:use-module (guix build-system gnu) @@ -121,11 +122,13 @@ (define* (scons-build name inputs (map search-path-specification->sexp search-paths))))))) - (gexp->derivation name builder - #:system system - #:target #f - #:graft? #f - #:guile-for-build guile)) + (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) + system #:graft? #f))) + (gexp->derivation name builder + #:system system + #:target #f + #:graft? #f + #:guile-for-build guile))) (define scons-build-system (build-system -- 2.40.1 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.6: 0005-build-system-dub-add-ld-gold-wrapper-to-private-keyw.patch --] [-- Type: text/x-patch, Size: 1497 bytes --] From 32a455ab2852c6ff015a2126953075c67a3371b9 Mon Sep 17 00:00:00 2001 Message-Id: <32a455ab2852c6ff015a2126953075c67a3371b9.1694806866.git.striness@tilde.club> In-Reply-To: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> References: <73b2dfe98591073104fd069622ede2acab0c7655.1694806866.git.striness@tilde.club> From: Ulf Herrman <striness@tilde.club> Date: Fri, 15 Sep 2023 08:53:10 -0500 Subject: [PATCH 5/5] build-system: dub: add #:ld-gold-wrapper to private-keywords. This isn't an accepted keyword to dub-build, so it will currently cause an error if it is specified, which rather defeats the purpose of having it as an argument. Putting it in private-keywords will cause it to be stripped from the final bag arguments. * guix/build-system/dub.scm (lower): add #:ld-gold-wrapper to private-keywords. --- guix/build-system/dub.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guix/build-system/dub.scm b/guix/build-system/dub.scm index 1b9f21b052..b325357589 100644 --- a/guix/build-system/dub.scm +++ b/guix/build-system/dub.scm @@ -112,7 +112,8 @@ (define* (lower name "Return a bag for NAME." (define private-keywords - '(#:target #:ldc #:dub #:pkg-config #:inputs #:native-inputs #:outputs)) + '(#:target #:ldc #:dub #:pkg-config #:ld-gold-wrapper + #:inputs #:native-inputs #:outputs)) (and (not target) ;; TODO: support cross-compilation (bag -- 2.40.1 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply related [flat|nested] 23+ messages in thread
* bug#65665: [PATCH] Really get all the implicit inputs. 2023-09-16 9:45 ` bug#65665: [PATCH] Really " Ulf Herrman @ 2023-10-06 2:36 ` Maxim Cournoyer 2023-10-06 7:37 ` Ulf Herrman ` (2 more replies) 2023-10-12 14:06 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès 1 sibling, 3 replies; 23+ messages in thread From: Maxim Cournoyer @ 2023-10-06 2:36 UTC (permalink / raw) To: Ulf Herrman; +Cc: dev, zimon.toutoune, othacehe, ludo, me, 65665, rekado, guix Hello Ulf! Ulf Herrman <striness@tilde.club> writes: > This patch series causes package-mapping to recurse into package and bag > arguments when #:deep? #t is given. It also recurses into gexps and > gexp inputs in search of packages to devour. It also ensures that build > systems leave all of their implicit package arguments in the bag > arguments, ready to be found by package-mapping. It also fixes a couple > build system errors I came across while modifying 40+ build systems and > testing a deep package transformation. Nice series! I've reviewed it, and it makes sense to me. I'd like to apply it to the core-updates branch. Core team, what say you? -- Thanks, Maxim ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: [PATCH] Really get all the implicit inputs. 2023-10-06 2:36 ` Maxim Cournoyer @ 2023-10-06 7:37 ` Ulf Herrman 2023-10-07 3:47 ` Ulf Herrman 2023-10-12 13:47 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès 2023-10-12 7:07 ` bug#65665: [PATCH] Really " Ludovic Courtès 2023-10-12 14:22 ` Simon Tournier 2 siblings, 2 replies; 23+ messages in thread From: Ulf Herrman @ 2023-10-06 7:37 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: Ulf Herrman, 65665 [-- Attachment #1.1: Type: text/plain, Size: 697 bytes --] I've also been using this patch, which rebinds `this-package' within package variants to refer instead to the variant rather than the original. When I tried applying a deep transformation to icecat, it failed to reach icecat-minimal or something like that. Or maybe it was some input of icecat - might have been my local version of mesa that had breakage. Anyway, I've since forgotten exactly what happened and why (I didn't actually write the commit message until quite some time later), but I do know that this patch fixed it. I might try to rediscover what the problem was later, but thought it would be good to make you aware of this so as to hopefully consolidate world rebuilds. - Ulf [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-guix-packages-rebind-this-package-for-package-varian.patch --] [-- Type: text/x-patch, Size: 6882 bytes --] From 06245c37fc0ee21144279682223dff01f3e6dbf4 Mon Sep 17 00:00:00 2001 Message-Id: <06245c37fc0ee21144279682223dff01f3e6dbf4.1696574074.git.striness@tilde.club> From: Ulf Herrman <striness@tilde.club> Date: Wed, 4 Oct 2023 03:17:25 -0500 Subject: [PATCH] guix: packages: rebind `this-package' for package variants. Background: there is a `this-package' identifier that can be used within any of the thunked fields of <package>. This is implemented by passing the package in question as an argument to the "thunk" that is called to get the field value. `this-package' is used to implement macros like `this-package-input'. Consequently, there is a subtle difference between a package that inherits another package's thunked field and one that wraps it: in the former, the `this-package' of the thunked field will refer to the inheriting package, while in the latter case it will refer to the original package. Use of `this-package' tends to cause lots of subtle and hard-to-debug breakage when package transformations are used. In `package-mapping', it makes more sense to have `this-package' refer to the transformed package (that is, the package after being transformed by the user-provided procedure and having all of its applicable inputs transformed, recursively), since otherwise untransformed inputs may be reintroduced via `this-package'. There's still one place where `this-package' can cause problems, though, and that's in the user-specified transformation procedure itself. Whether it's appropriate to have the thunks of the original refer to the original package or the transformed package is only really known by the author of the transformation. We therefore expose procedures for invoking the field thunks with arbitrary packages. In my experience, this has led to far more consistent and predictable package-transforming. If we really need the ability to refer to the lexically enclosing package instead of "whichever package ends up using this field definition" - which seems to be unnecessary at present, since the overwhelming majority of uses of 'this-package' are in the context of 'this-package-input', etc - we could introduce a 'this-literal-package' identifier. Or we could rename all current uses of 'this-package' to use 'this-package-variant' or something like that, though that sounds like more work. * guix/packages.scm (package-inputs-with-package, package-native-inputs-with-package, package-propagated-inputs-with-package, package-arguments-with-package): new procedures. (package-mapping): use them. --- guix/packages.scm | 61 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index 1334def142..288867b911 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -138,6 +138,11 @@ (define-module (guix packages) package-transitive-propagated-inputs package-transitive-native-search-paths package-transitive-supported-systems + package-inputs-with-package + package-native-inputs-with-package + package-propagated-inputs-with-package + package-arguments-with-package + package-mapping package-input-rewriting package-input-rewriting/spec @@ -1451,6 +1456,31 @@ (define (build-system-with-package-mapping bs rewrite-input rewrite-argument) (inherit bs) (lower lower*))) +(define (package-inputs-with-package p0 p) + (match p0 + (($ <package> _ _ _ _ args-proc + inputs-proc + propagated-inputs-proc + native-inputs-proc) + (inputs-proc p)))) + +(define (package-native-inputs-with-package p0 p) + (match p0 + (($ <package> _ _ _ _ _ _ _ + native-inputs-proc) + (native-inputs-proc p)))) + +(define (package-propagated-inputs-with-package p0 p) + (match p0 + (($ <package> _ _ _ _ _ _ + propagated-inputs-proc) + (propagated-inputs-proc p)))) + +(define (package-arguments-with-package p0 p) + (match p0 + (($ <package> _ _ _ _ arguments-proc) + (arguments-proc p)))) + (define* (package-mapping proc #:optional (cut? (const #f)) #:key deep?) "Return a procedure that, given a package, applies PROC to all the packages @@ -1525,22 +1555,25 @@ (define* (package-mapping proc #:optional (cut? (const #f)) rewrite-input rewrite-argument) (package-build-system p))) - (inputs (map rewrite-input (package-inputs p))) - (native-inputs (map rewrite-input (package-native-inputs p))) + (inputs (map rewrite-input + (package-inputs-with-package p this-package))) + (native-inputs (map rewrite-input + (package-native-inputs-with-package + p this-package))) (propagated-inputs - (map rewrite-input (package-propagated-inputs p))) + (map rewrite-input + (package-propagated-inputs-with-package + p this-package))) (arguments - (match p - (($ <package> _ _ _ _ args-proc) - ;; If we let ARGS-PROC be passed its original package, - ;; we somehow end up in an infinite (or maybe just - ;; exponential? Never seen it end...) loop. Should - ;; probably figure out what's causing that at some - ;; point. - (let ((args (args-proc this-package))) - (if deep? - (map rewrite-argument args) - args))))) + ;; If we let ARGS-PROC be passed its original package, + ;; we somehow end up in an infinite (or maybe just + ;; exponential? Never seen it end...) loop. Should + ;; probably figure out what's causing that at some + ;; point. + (if deep? + (map rewrite-argument (package-arguments-with-package + p this-package)) + (package-arguments-with-package p this-package))) (replacement (and=> (package-replacement p) replace)) (properties `((,mapping-property . #t) ,@(package-properties p))))))))) -- 2.40.1 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply related [flat|nested] 23+ messages in thread
* bug#65665: [PATCH] Really get all the implicit inputs. 2023-10-06 7:37 ` Ulf Herrman @ 2023-10-07 3:47 ` Ulf Herrman 2023-10-12 13:47 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès 1 sibling, 0 replies; 23+ messages in thread From: Ulf Herrman @ 2023-10-07 3:47 UTC (permalink / raw) To: Ulf Herrman; +Cc: Maxim Cournoyer, 65665 [-- Attachment #1: Type: text/plain, Size: 2193 bytes --] Ulf Herrman <striness@tilde.club> writes: > Anyway, I've since forgotten exactly what happened and why (I didn't > actually write the commit message until quite some time later), but I > do know that this patch fixed it. > > I might try to rediscover what the problem was later, but thought it > would be good to make you aware of this so as to hopefully consolidate > world rebuilds. I've since done some more checking to recall what the problem actually was, and it indeed manifested as a combination of an icecat and mesa problem: the wrap-program phase of icecat-minimal uses `this-package-input' to get the mesa to point LD_LIBRARY_PATH to. However, it then stuffs the resulting package inside a <file-append> object, which we don't currently recurse through, so it ends up compiling with one mesa and using another at runtime, which somehow causes a segmentation fault. Having looked at it again, I'm not sure that rebinding `this-package' is the best solution - it's certainly not a general solution, since any old package could be shoved into a <file-append> object (or really any declarative file-like object) and thereby be hidden from transformations. My understanding is that packaging guidelines already discourage directly substituting top-level package references, preferring instead tools like `this-package-input' so as to work nicely with transformations. If those guidelines are adhered to, the aforementioned patch should fix issues of this nature. I'm not sure what the best way of handling objects like <file-append> and such is, but as long as package references go through `this-package', it should only matter for implicit inputs, and I don't think any of them use declarative file-like objects other than <package>. After thinking about it some more, I think it would be good if we had a way of testing to make sure that every package is "transformable": that is, if you apply a deep transformation to it, and lower the result to a derivation, at no point within the dynamic extent of that lowering is a derivation from an untransformed package introduced. This would allow for testing for transformability en masse, and could be added to 'guix lint'. - Ulf [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-06 7:37 ` Ulf Herrman 2023-10-07 3:47 ` Ulf Herrman @ 2023-10-12 13:47 ` Ludovic Courtès 1 sibling, 0 replies; 23+ messages in thread From: Ludovic Courtès @ 2023-10-12 13:47 UTC (permalink / raw) To: Ulf Herrman; +Cc: Maxim Cournoyer, 65665 Hi, Ulf Herrman <striness@tilde.club> skribis: > I've also been using this patch, which rebinds `this-package' within > package variants to refer instead to the variant rather than the > original. Could you send it as a separate issue? (I think I once reported a bug for this issue, but I can’t find it.) Ludo’. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: [PATCH] Really get all the implicit inputs. 2023-10-06 2:36 ` Maxim Cournoyer 2023-10-06 7:37 ` Ulf Herrman @ 2023-10-12 7:07 ` Ludovic Courtès 2023-10-12 14:22 ` Simon Tournier 2 siblings, 0 replies; 23+ messages in thread From: Ludovic Courtès @ 2023-10-12 7:07 UTC (permalink / raw) To: Maxim Cournoyer Cc: dev, Ulf Herrman, zimon.toutoune, othacehe, me, 65665, rekado, guix Hi! Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: > Ulf Herrman <striness@tilde.club> writes: > >> This patch series causes package-mapping to recurse into package and bag >> arguments when #:deep? #t is given. It also recurses into gexps and >> gexp inputs in search of packages to devour. It also ensures that build >> systems leave all of their implicit package arguments in the bag >> arguments, ready to be found by package-mapping. It also fixes a couple >> build system errors I came across while modifying 40+ build systems and >> testing a deep package transformation. > > Nice series! > > I've reviewed it, and it makes sense to me. I'd like to apply it to the > core-updates branch. Core team, what say you? Sorry for the delay, I’ll provide feedback within a couple of days. Ludo’. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: [PATCH] Really get all the implicit inputs. 2023-10-06 2:36 ` Maxim Cournoyer 2023-10-06 7:37 ` Ulf Herrman 2023-10-12 7:07 ` bug#65665: [PATCH] Really " Ludovic Courtès @ 2023-10-12 14:22 ` Simon Tournier 2 siblings, 0 replies; 23+ messages in thread From: Simon Tournier @ 2023-10-12 14:22 UTC (permalink / raw) To: Maxim Cournoyer, Ulf Herrman; +Cc: dev, othacehe, ludo, me, 65665, rekado, guix Hi Maxim, On Thu, 05 Oct 2023 at 22:36, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote: > I've reviewed it, and it makes sense to me. I'd like to apply it to the > core-updates branch. Core team, what say you? Well, I am not sure to deeply understand some details to get all the implications here, so I have nothing relevant to say. For instance, from my understanding, the core change is: --8<---------------cut here---------------start------------->8--- + (define (rewrite-argument arg) + (match arg + ((? package? p) + (replace p)) + ((? gexp-input? gi) + (gexp-input (rewrite-argument (gexp-input-thing gi)) + (gexp-input-output gi) + #:native? (gexp-input-native? gi))) + ((? gexp? gxp) + (make-gexp (map rewrite-argument (gexp-references gxp)) + (gexp-self-modules gxp) + (gexp-self-extensions gxp) + (gexp-proc gxp) + (%gexp-location gxp))) + ((lst ...) + (map rewrite-argument lst)) + (_ + arg))) --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- + (arguments + (match p + (($ <package> _ _ _ _ args-proc) + ;; If we let ARGS-PROC be passed its original package, + ;; we somehow end up in an infinite (or maybe just + ;; exponential? Never seen it end...) loop. Should + ;; probably figure out what's causing that at some + ;; point. + (let ((args (args-proc this-package))) + (if deep? + (map rewrite-argument args) + args))))) --8<---------------cut here---------------end--------------->8--- and I do not feel enough skilled here for getting the implications. Equally for this kind of changes: --8<---------------cut here---------------start------------->8--- - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:guile _ #t) guile)))))) --8<---------------cut here---------------end--------------->8--- Therefore, I trust other opinions or I need some time for diving and filling some gaps. Cheers, simon ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-09-16 9:45 ` bug#65665: [PATCH] Really " Ulf Herrman 2023-10-06 2:36 ` Maxim Cournoyer @ 2023-10-12 14:06 ` Ludovic Courtès 2023-10-12 16:00 ` Maxim Cournoyer 2023-10-13 3:11 ` Ulf Herrman 1 sibling, 2 replies; 23+ messages in thread From: Ludovic Courtès @ 2023-10-12 14:06 UTC (permalink / raw) To: Ulf Herrman; +Cc: 65665 Ulf Herrman <striness@tilde.club> skribis: > -(define (build-system-with-package-mapping bs rewrite) > +(define (build-system-with-package-mapping bs rewrite-input rewrite-argument) > "Return a variant of BS, a build system, that rewrites a bag's inputs by > passing them through REWRITE, a procedure that takes an input tuplet and > returns a \"rewritten\" input tuplet." > @@ -1442,9 +1442,10 @@ (define (build-system-with-package-mapping bs rewrite) > (let ((lowered (apply lower args))) > (bag > (inherit lowered) > - (build-inputs (map rewrite (bag-build-inputs lowered))) > - (host-inputs (map rewrite (bag-host-inputs lowered))) > - (target-inputs (map rewrite (bag-target-inputs lowered)))))) > + (build-inputs (map rewrite-input (bag-build-inputs lowered))) > + (host-inputs (map rewrite-input (bag-host-inputs lowered))) > + (target-inputs (map rewrite-input (bag-target-inputs lowered))) > + (arguments (map rewrite-argument (bag-arguments lowered)))))) Aah, now I understand. :-) It’s indeed the case that arguments can capture references to packages that won’t be caught by ‘package-mapping’. For instance, if you write: (package … (arguments (list … #~(whatever #$coreutils)))) … then ‘coreutils’ here cannot be replaced. To address this, the recommendation is to always add dependencies to input fields and to use self-references within arguments. The example above should be written like this: (package … (arguments (list … #~(whatever #$(this-package-input "coreutils"))))) It’s just a recommendation and one can perfectly ignore it, and I suppose that was the impetus for this patch. This is one of the things discussed while designing this change: https://guix.gnu.org/en/blog/2021/the-big-change/ (search for “self-referential records”) https://issues.guix.gnu.org/49169 My take was and still is that it’s an acceptable limitation. Packagers need to follow the guideline above if they want proper support for rewriting, ‘guix graph’, and other tools. WDYT? Thanks, Ludo’. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-12 14:06 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès @ 2023-10-12 16:00 ` Maxim Cournoyer 2023-10-14 14:47 ` Ludovic Courtès 2023-10-13 3:11 ` Ulf Herrman 1 sibling, 1 reply; 23+ messages in thread From: Maxim Cournoyer @ 2023-10-12 16:00 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Ulf Herrman, 65665 Hi, Ludovic Courtès <ludo@gnu.org> writes: > Ulf Herrman <striness@tilde.club> skribis: > >> -(define (build-system-with-package-mapping bs rewrite) >> +(define (build-system-with-package-mapping bs rewrite-input rewrite-argument) >> "Return a variant of BS, a build system, that rewrites a bag's inputs by >> passing them through REWRITE, a procedure that takes an input tuplet and >> returns a \"rewritten\" input tuplet." >> @@ -1442,9 +1442,10 @@ (define (build-system-with-package-mapping bs rewrite) >> (let ((lowered (apply lower args))) >> (bag >> (inherit lowered) >> - (build-inputs (map rewrite (bag-build-inputs lowered))) >> - (host-inputs (map rewrite (bag-host-inputs lowered))) >> - (target-inputs (map rewrite (bag-target-inputs lowered)))))) >> + (build-inputs (map rewrite-input (bag-build-inputs lowered))) >> + (host-inputs (map rewrite-input (bag-host-inputs lowered))) >> + (target-inputs (map rewrite-input (bag-target-inputs lowered))) >> + (arguments (map rewrite-argument (bag-arguments lowered)))))) > > Aah, now I understand. :-) > > It’s indeed the case that arguments can capture references to packages > that won’t be caught by ‘package-mapping’. For instance, if you write: > > (package > … > (arguments (list … #~(whatever #$coreutils)))) > > … then ‘coreutils’ here cannot be replaced. > > To address this, the recommendation is to always add dependencies to > input fields and to use self-references within arguments. The example > above should be written like this: > > (package > … > (arguments > (list … #~(whatever #$(this-package-input "coreutils"))))) > > It’s just a recommendation and one can perfectly ignore it, and I > suppose that was the impetus for this patch. > > This is one of the things discussed while designing this change: > > https://guix.gnu.org/en/blog/2021/the-big-change/ > (search for “self-referential records”) > > https://issues.guix.gnu.org/49169 > > My take was and still is that it’s an acceptable limitation. Packagers > need to follow the guideline above if they want proper support for > rewriting, ‘guix graph’, and other tools. > > WDYT? But not all packages found in a bag come from inputs; they may be provided as an argument to the build system (cmake, meson, qt, etc. all allow for this). -- Thanks, Maxim ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-12 16:00 ` Maxim Cournoyer @ 2023-10-14 14:47 ` Ludovic Courtès 0 siblings, 0 replies; 23+ messages in thread From: Ludovic Courtès @ 2023-10-14 14:47 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: Ulf Herrman, 65665 [-- Attachment #1: Type: text/plain, Size: 3583 bytes --] Hello, Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: >> It’s indeed the case that arguments can capture references to packages >> that won’t be caught by ‘package-mapping’. For instance, if you write: >> >> (package >> … >> (arguments (list … #~(whatever #$coreutils)))) >> >> … then ‘coreutils’ here cannot be replaced. >> >> To address this, the recommendation is to always add dependencies to >> input fields and to use self-references within arguments. The example >> above should be written like this: >> >> (package >> … >> (arguments >> (list … #~(whatever #$(this-package-input "coreutils"))))) >> >> It’s just a recommendation and one can perfectly ignore it, and I >> suppose that was the impetus for this patch. >> >> This is one of the things discussed while designing this change: >> >> https://guix.gnu.org/en/blog/2021/the-big-change/ >> (search for “self-referential records”) >> >> https://issues.guix.gnu.org/49169 >> >> My take was and still is that it’s an acceptable limitation. Packagers >> need to follow the guideline above if they want proper support for >> rewriting, ‘guix graph’, and other tools. >> >> WDYT? > > But not all packages found in a bag come from inputs; they may be > provided as an argument to the build system (cmake, meson, qt, etc. all > allow for this). Yes, but these packages (#:cmake for ‘cmake-build-system’, #:python for ‘python-build-system’, etc.) become inputs of the bag, and are taken into account, as in this example: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix show tinyxml2 name: tinyxml2 version: 8.0.0 outputs: + out: everything systems: x86_64-linux i686-linux dependencies: location: gnu/packages/xml.scm:1295:2 homepage: http://www.grinninglizard.com/tinyxml2/ license: Zlib synopsis: Small XML parser for C++ description: TinyXML2 is a small and simple XML parsing library for the C++ programming + language. $ ./pre-inst-env guix build tinyxml2 The following graft will be made: /gnu/store/qf8w8ch1mrxk6k34g2d6bisny5pq8gnv-tinyxml2-8.0.0.drv applying 2 grafts for tinyxml2-8.0.0 ... grafting '/gnu/store/ndzyiwhypsbgrbaz7rmz3649b6ghlfal-tinyxml2-8.0.0' -> '/gnu/store/2da5frl36gd51653bjjypqvwdk0bh25v-tinyxml2-8.0.0'... successfully built /gnu/store/qf8w8ch1mrxk6k34g2d6bisny5pq8gnv-tinyxml2-8.0.0.drv /gnu/store/2da5frl36gd51653bjjypqvwdk0bh25v-tinyxml2-8.0.0 $ ./pre-inst-env guix build tinyxml2 --with-input=cmake-minimal=cmake The following derivation will be built: /gnu/store/hx0hx1nrmxzdhy9yw1d0md2q78y4spd4-tinyxml2-8.0.0.drv 8.4 MB will be downloaded: /gnu/store/qwy25ivr63087x9fdl9km0m44hn5bimg-cmake-3.25.1 /gnu/store/3vh9b2i93na8wwdrj6n0q2qbgd2fzxik-tinyxml2-8.0.0-checkout [...] /gnu/store/cmn551x8iksy44cdqypyq2129lm8ym60-tinyxml2-8.0.0 --8<---------------cut here---------------end--------------->8--- (In this case I had to apply the patch below because ‘cmake-minimal’ was mistakenly marked as hidden which, as implemented by eee95b5a879b7096dffd533f24107cf8926b621e, meant that it could not be replaced.) I gave a similar example with ‘python-build-system’ here: https://issues.guix.gnu.org/65665#10 My understanding is that understanding is that this patch series is about addressing cases as I explained above, where ‘arguments’ refer to packages directly instead of using self references. Do I get this right, Ulf? Thanks, Ludo’. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: Type: text/x-patch, Size: 515 bytes --] diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm index bc14286070..1592703f8d 100644 --- a/gnu/packages/cmake.scm +++ b/gnu/packages/cmake.scm @@ -263,6 +263,7 @@ (define-public cmake-minimal (package (inherit cmake-bootstrap) (name "cmake-minimal") + (properties (alist-delete 'hidden? (package-properties cmake-bootstrap))) (source (origin (inherit (package-source cmake-bootstrap)) ;; Purge CMakes bundled dependencies as they are no longer needed. ^ permalink raw reply related [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-12 14:06 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès 2023-10-12 16:00 ` Maxim Cournoyer @ 2023-10-13 3:11 ` Ulf Herrman 2023-10-14 15:18 ` Ludovic Courtès 1 sibling, 1 reply; 23+ messages in thread From: Ulf Herrman @ 2023-10-13 3:11 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Ulf Herrman, 65665 [-- Attachment #1: Type: text/plain, Size: 4456 bytes --] Ludovic Courtès <ludo@gnu.org> writes: > Ulf Herrman <striness@tilde.club> skribis: > >> -(define (build-system-with-package-mapping bs rewrite) >> +(define (build-system-with-package-mapping bs rewrite-input rewrite-argument) >> "Return a variant of BS, a build system, that rewrites a bag's inputs by >> passing them through REWRITE, a procedure that takes an input tuplet and >> returns a \"rewritten\" input tuplet." >> @@ -1442,9 +1442,10 @@ (define (build-system-with-package-mapping bs rewrite) >> (let ((lowered (apply lower args))) >> (bag >> (inherit lowered) >> - (build-inputs (map rewrite (bag-build-inputs lowered))) >> - (host-inputs (map rewrite (bag-host-inputs lowered))) >> - (target-inputs (map rewrite (bag-target-inputs lowered)))))) >> + (build-inputs (map rewrite-input (bag-build-inputs lowered))) >> + (host-inputs (map rewrite-input (bag-host-inputs lowered))) >> + (target-inputs (map rewrite-input (bag-target-inputs lowered))) >> + (arguments (map rewrite-argument (bag-arguments lowered)))))) > > Aah, now I understand. :-) > > It’s indeed the case that arguments can capture references to packages > that won’t be caught by ‘package-mapping’. For instance, if you write: > > (package > … > (arguments (list … #~(whatever #$coreutils)))) > > … then ‘coreutils’ here cannot be replaced. > > To address this, the recommendation is to always add dependencies to > input fields and to use self-references within arguments. The example > above should be written like this: > > (package > … > (arguments > (list … #~(whatever #$(this-package-input "coreutils"))))) > > It’s just a recommendation and one can perfectly ignore it, and I > suppose that was the impetus for this patch. That and a growing thirst for a nuclear option for package rewriting brought about by trying to debug deep transformations while simultaneously experimenting with rewriting a manifest of around 270 packages. There are really several distinct issues at play here: 1. The case of #:qtbase and #:guile being invisible to package-mapping. This is what I first noticed, and cannot be fixed without modifying the build systems. This is what prompted looking for packages in package and bag arguments, and recursing into lists therein (just in case an argument took a list of packages). 2. The (perceived) case of packages hiding inside arguments. In hindsight, this was probably actually (3) causing this, though it's hard to tell because I discovered it last. I attempted to resolve this by recursing through <gexp>s and <gexp-input>s. 3. `this-package' referring to the inherited package in thunked fields, rather than the package inheriting them. This is what prompted the use of package-{inputs,arguments,etc}-with-package. (1) could be resolved in several ways. I'm partial to looking for arguments whose values are packages and transforming them (when #:deep? #t is specified), and adjusting the build systems to make that work consistently, which is what I've done. (2) is probably not an issue, though it occurs to me that the technique of recursively searching through arguments looking for packages could be used to implement a sort of automated "transformability" check, which could help a lot when trying to debug transformations. (3) is a major issue; the entire strategy of using `this-package-input' to enable transformations breaks because of it. My fix works for me at least, though it requires exposing additional low-level procedures and transformation authors using them. I'll open another bug about it, as requested. > This is one of the things discussed while designing this change: > > https://guix.gnu.org/en/blog/2021/the-big-change/ > (search for “self-referential records”) > > https://issues.guix.gnu.org/49169 > > My take was and still is that it’s an acceptable limitation. Packagers > need to follow the guideline above if they want proper support for > rewriting, ‘guix graph’, and other tools. > > WDYT? I think it's probably reasonable, though I would like it if there were tooling in place to detect cases where said guidelines are not followed, so as to aid in debugging and verifying that a transformation worked as intended. - Ulf [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-13 3:11 ` Ulf Herrman @ 2023-10-14 15:18 ` Ludovic Courtès 2023-10-15 7:12 ` Ulf Herrman 0 siblings, 1 reply; 23+ messages in thread From: Ludovic Courtès @ 2023-10-14 15:18 UTC (permalink / raw) To: Ulf Herrman; +Cc: 65665 Hello, Ulf Herrman <striness@tilde.club> skribis: > That and a growing thirst for a nuclear option for package rewriting > brought about by trying to debug deep transformations while > simultaneously experimenting with rewriting a manifest of around 270 > packages. On that topic of a catch-all option for rewriting: there’s an unused procedure called ‘map-derivation’, which performs rewriting at the level of derivations. It’s harder to use, more expensive, but who knows, perhaps we’ll find a motivating use case… (Allowing for graph rewriting has been a major goal for me since the beginning.) > There are really several distinct issues at play here: > 1. The case of #:qtbase and #:guile being invisible to package-mapping. > This is what I first noticed, and cannot be fixed without modifying > the build systems. This is what prompted looking for packages in > package and bag arguments, and recursing into lists therein (just in > case an argument took a list of packages). How are #:qtbase and #:guile invisible to package mapping? They appear in the bag inputs and thus are definitely visible to ‘package-mapping’, as a I showed with the CMake and Python examples in this thread. For good measure :-) here’s an example with #:qtbase: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix build qgit -n substitute: updating substitutes from 'http://192.168.1.48:8123'... 100.0% substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% 0.4 MB would be downloaded: /gnu/store/7b20q17yg90b62404chgbnwgvd6ry1qf-qgit-2.10 $ ./pre-inst-env guix build qgit -n --with-latest=qtbase following redirection to `https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/'... following redirection to `https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/6.6/'... guix build: warning: cannot authenticate source of 'qtbase', version 6.6.0 Starting download of /tmp/guix-file.CTehnY From https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/6.6/6.6.0/submodules/qtbase-everywhere-src-6.6.0.tar.xz... …-src-6.6.0.tar.xz 46.1MiB 12.9MiB/s 00:04 ▕██████████████████▏ 100.0% substitute: updating substitutes from 'http://192.168.1.48:8123'... 100.0% substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0% substitute: updating substitutes from 'https://guix.bordeaux.inria.fr'... 100.0% The following derivations would be built: /gnu/store/paixxkdaakv55bffggxx4l9hiknl8i5r-qgit-2.10.drv /gnu/store/f9fdjk1g1s1aqmlmi4clla2kqns7283v-qtbase-6.6.0.drv 0.4 MB would be downloaded: /gnu/store/nl9dadzfmjm9wg7v3r31jkx773dl683x-module-import-compiled /gnu/store/6zryxmypw0wygayc9pvhyxkx47w0lyci-gperf-3.1 /gnu/store/a57n7wy8mdi7l52pr4zg07132blgj5xp-qgit-2.10-checkout --8<---------------cut here---------------end--------------->8--- Now, package transformation options are almost all implemented in terms of ‘package-input-rewriting/spec’, and I have to admit that it’s much easier to use than ‘package-mapping’. The latter is low-level and it can be a source of headaches. > 2. The (perceived) case of packages hiding inside arguments. In > hindsight, this was probably actually (3) causing this, though it's > hard to tell because I discovered it last. I attempted to resolve > this by recursing through <gexp>s and <gexp-input>s. Yeah. I think we have to understand that “hiding” is to some extent inevitable; <package> is more concise than <bag>, which is more concise than <derivation>. There are extra “inputs” showing up when we go from one abstraction to the one below. > 3. `this-package' referring to the inherited package in thunked fields, > rather than the package inheriting them. This is what prompted the > use of package-{inputs,arguments,etc}-with-package. Ah yes, I agree; I reported it here: https://issues.guix.gnu.org/50335 I think we can discuss it separately though, in that bug report probably. > (1) could be resolved in several ways. I'm partial to looking for > arguments whose values are packages and transforming them (when #:deep? > #t is specified), and adjusting the build systems to make that work > consistently, which is what I've done. > > (2) is probably not an issue, though it occurs to me that the technique > of recursively searching through arguments looking for packages could be > used to implement a sort of automated "transformability" check, which > could help a lot when trying to debug transformations. OK. > (3) is a major issue; the entire strategy of using `this-package-input' > to enable transformations breaks because of it. My fix works for me at > least, though it requires exposing additional low-level procedures and > transformation authors using them. I'll open another bug about it, as > requested. Yeah, understood. Thanks, Ludo’. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-14 15:18 ` Ludovic Courtès @ 2023-10-15 7:12 ` Ulf Herrman 2023-10-21 14:31 ` Ludovic Courtès 0 siblings, 1 reply; 23+ messages in thread From: Ulf Herrman @ 2023-10-15 7:12 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Ulf Herrman, 65665 [-- Attachment #1: Type: text/plain, Size: 9887 bytes --] Ludovic Courtès <ludo@gnu.org> writes: > Hello, > > Ulf Herrman <striness@tilde.club> skribis: > >> That and a growing thirst for a nuclear option for package rewriting >> brought about by trying to debug deep transformations while >> simultaneously experimenting with rewriting a manifest of around 270 >> packages. > > On that topic of a catch-all option for rewriting: there’s an unused > procedure called ‘map-derivation’, which performs rewriting at the level > of derivations. It’s harder to use, more expensive, but who knows, > perhaps we’ll find a motivating use case… (Allowing for graph rewriting > has been a major goal for me since the beginning.) > >> There are really several distinct issues at play here: >> 1. The case of #:qtbase and #:guile being invisible to package-mapping. >> This is what I first noticed, and cannot be fixed without modifying >> the build systems. This is what prompted looking for packages in >> package and bag arguments, and recursing into lists therein (just in >> case an argument took a list of packages). > > How are #:qtbase and #:guile invisible to package mapping? > > They appear in the bag inputs and thus are definitely visible to > ‘package-mapping’, as a I showed with the CMake and Python examples in > this thread. "Invisible to package-mapping" was perhaps not the clearest phrasing; "not completely replaced by package-mapping" might be better. qtbase does indeed go in the bag inputs, but replacing the bag inputs has no effect on the bag arguments, and even if we replaced it in the bag arguments as well, it might not even be in there to begin with, in which case the bag-builder would introduce a default that is only visible at the level of derivations. > > For good measure :-) here’s an example with #:qtbase: > > $ ./pre-inst-env guix build qgit -n > substitute: updating substitutes from 'http://192.168.1.48:8123'... 100.0% > substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% > 0.4 MB would be downloaded: > /gnu/store/7b20q17yg90b62404chgbnwgvd6ry1qf-qgit-2.10 > $ ./pre-inst-env guix build qgit -n --with-latest=qtbase > following redirection to `https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/'... > following redirection to `https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/6.6/'... > guix build: warning: cannot authenticate source of 'qtbase', version 6.6.0 > > Starting download of /tmp/guix-file.CTehnY > From https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/6.6/6.6.0/submodules/qtbase-everywhere-src-6.6.0.tar.xz... > …-src-6.6.0.tar.xz 46.1MiB 12.9MiB/s 00:04 ▕██████████████████▏ 100.0% > substitute: updating substitutes from 'http://192.168.1.48:8123'... 100.0% > substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% > substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0% > substitute: updating substitutes from 'https://guix.bordeaux.inria.fr'... 100.0% > The following derivations would be built: > /gnu/store/paixxkdaakv55bffggxx4l9hiknl8i5r-qgit-2.10.drv > /gnu/store/f9fdjk1g1s1aqmlmi4clla2kqns7283v-qtbase-6.6.0.drv > 0.4 MB would be downloaded: > /gnu/store/nl9dadzfmjm9wg7v3r31jkx773dl683x-module-import-compiled > /gnu/store/6zryxmypw0wygayc9pvhyxkx47w0lyci-gperf-3.1 > /gnu/store/a57n7wy8mdi7l52pr4zg07132blgj5xp-qgit-2.10-checkout And if you do a quick 'cat /gnu/store/paixxkdaakv55bffggxx4l9hiknl8i5r-qgit-2.10.drv'... ------------------------------ Derive ([("out","/gnu/store/z8qrhfmicylxy2mwvcvh9sizfhd3x4d3-qgit-2.10","","")] ,[("/gnu/store/0jk33gpzyicyppbnh458213007v0qjhs-mesa-23.1.4.drv",["out"]) ,("/gnu/store/0njvvgjlb52abhqnmb4rx22sfkxm2h9c-gcc-11.3.0.drv",["out"]) ,("/gnu/store/0p1sns81qbgr8ayiv02fv4rm5drcycd7-libxdamage-1.1.5.drv",["out"]) ,("/gnu/store/14a2ban238fng3c8632lrfkmz54y7m2c-binutils-2.38.drv",["out"]) ,("/gnu/store/1n39zcbr528b7rh9bf1pwfrm7mv8nr8m-bzip2-1.0.8.drv",["out"]) ,("/gnu/store/2pv3mjjiwh37b0m3m1hijxifnchrw76i-libpciaccess-0.16.drv",["out"]) ,("/gnu/store/3fy3bf7wysi1n1qz9jz8xzx11sgy8m6d-git-2.41.0.drv",["out"]) ,("/gnu/store/3r0r8j76l0qvxasmb7rgn7lvpikjdyn1-libxdmcp-1.1.3.drv",["out"]) ,("/gnu/store/4jfy1ca1d5772z15jcyk1v8wdwdcllbi-gzip-1.12.drv",["out"]) ,("/gnu/store/5nvwagz2hphvlax2bnj93smr1rgrzr8l-libx11-1.8.1.drv",["out"]) ,("/gnu/store/64vwaah2spd7q66hji6sm1j2fl6pd1rn-diffutils-3.8.drv",["out"]) ,("/gnu/store/6k4xxkp725r09vkn7rz2gc50asjjhpkk-xorgproto-2022.2.drv",["out"]) ,("/gnu/store/91b6yraa6qax7lq7riqg1ag6lql2gfzi-tar-1.34.drv",["out"]) ,("/gnu/store/9kcv1x0lrf6fdck2j42zarxrvjzxxznv-coreutils-9.1.drv",["out"]) ,("/gnu/store/9piaq0aaf202r1gq7crig1cr131kx8zn-file-5.44.drv",["out"]) ,("/gnu/store/9y28bf3ywai2ybhr92c904s3cxsc8apx-libpthread-stubs-0.4.drv",["out"]) ,("/gnu/store/ak17xsjb4zcw7sf0r0lxxiy4xmh57i2h-findutils-4.9.0.drv",["out"]) ,("/gnu/store/bmc1hqlb207n1mnf9rs7wy8zh9hhf0br-qgit-2.10-checkout.drv",["out"]) ,("/gnu/store/cmd13zzya808ca8siibj8ib3llpkrr3f-sed-4.8.drv",["out"]) ,("/gnu/store/cr84vpnszpy3hkwsm8ijwpnkknxvx8k4-grep-3.8.drv",["out"]) ,("/gnu/store/cx6ws98i67qf6ba9msz7n63x78ky812c-libxxf86vm-1.1.4.drv",["out"]) ,("/gnu/store/f9fdjk1g1s1aqmlmi4clla2kqns7283v-qtbase-6.6.0.drv",["out"]) ,("/gnu/store/fpprrvfiqw6g0mn5gb7ac87nbmrsq64l-make-4.3.drv",["out"]) ,("/gnu/store/g2z0fvzkh5xl4f00aixchkwxrwbbljlr-libxext-1.3.4.drv",["out"]) ,("/gnu/store/gb247cil5nlnx175dhqmgg67q7ng7n2h-which-2.21.drv",["out"]) ,("/gnu/store/hb2y5axynnpwqpx1znjsn5azspc9a4lw-module-import-compiled.drv",["out"]) ,("/gnu/store/hjhr64r5x3bhdw63zz3a3v09vfrlkhrh-qtbase-5.15.10.drv",["out"]) ,("/gnu/store/hvqfl21wx397k58jpn5dpn2l5y5k1dl0-patch-2.7.6.drv",["out"]) ,("/gnu/store/kn7kcpkkcvy6gmrc74mf4mq0290dsf94-glibc-2.35.drv",["out","static"]) ,("/gnu/store/l3ns54f8vgqmycwi50p5cwbr6l466kj3-libdrm-2.4.114.drv",["out"]) ,("/gnu/store/lfsv077ggq8w8cbw86wf1075zhb3bhrw-xz-5.2.8.drv",["out"]) ,("/gnu/store/lssiz5ppxfybwmr638x3bcmn4b6ixk89-linux-libre-headers-5.15.49.drv",["out"]) ,("/gnu/store/n4p8vzp14k1pkgxyfb5mak12rm1yiwnr-cmake-minimal-3.24.2.drv",["out"]) ,("/gnu/store/nldpb7xl1slkiigvr9rax7qhcky5flnc-util-macros-1.19.3.drv",["out"]) ,("/gnu/store/nvaxgm6jvjy6agmp89ivahz7z9vl3ldh-libxcb-1.15.drv",["out"]) ,("/gnu/store/pdkcmkk5h3zq82ws9fps4bxnfmsmz0kx-libxshmfence-1.3.drv",["out"]) ,("/gnu/store/s5nyfh0cd3z9wsk69c9blj5y850kvvcm-libvdpau-1.5.drv",["out"]) ,("/gnu/store/swblndkq2c4rzyv3xfkmsa4cjf6abphf-ld-wrapper-0.drv",["out"]) ,("/gnu/store/vkns1vij5hjamh7dpd74zs5203526747-libxfixes-6.0.0.drv",["out"]) ,("/gnu/store/w2mnryfds1bd7wyyqmdi0kblz0dym1bx-glibc-utf8-locales-2.35.drv",["out"]) ,("/gnu/store/wwmk0rrnb5q8f48fm7h6grzar5qmslgi-libxau-1.0.10.drv",["out"]) ,("/gnu/store/xwckz4hbfydkfiiaa7bgslbh317gdkiq-bash-minimal-5.1.16.drv",["out"]) ,("/gnu/store/z7fxw9jj7avcr1ng88pak3ds3kxbfy15-gawk-5.2.1.drv",["out"]) ,("/gnu/store/zraigp7miin3vzr5dcbr4i9rvds0i07r-guile-3.0.9.drv",["out"])] ,["/gnu/store/2lg0ibv3vw01xc83advvrhvmc8yxbhh0-qgit-2.10-builder","/gnu/store/p173g6kxa69qaypf8dvnw1ismd8g4k8q-module-import"] ,"x86_64-linux","/gnu/store/g8p09w6r78hhkl2rv1747pcp9zbk6fxv-guile-3.0.9/bin/guile",["--no-auto-compile","-L","/gnu/store/p173g6kxa69qaypf8dvnw1ismd8g4k8q-module-import","-C","/gnu/store/nl9dadzfmjm9wg7v3r31jkx773dl683x-module-import-compiled","/gnu/store/2lg0ibv3vw01xc83advvrhvmc8yxbhh0-qgit-2.10-builder"] ,[("out","/gnu/store/z8qrhfmicylxy2mwvcvh9sizfhd3x4d3-qgit-2.10")]) --------------------------- you'll see we have both a ("/gnu/store/f9fdjk1g1s1aqmlmi4clla2kqns7283v-qtbase-6.6.0.drv",["out"]) and a ("/gnu/store/hjhr64r5x3bhdw63zz3a3v09vfrlkhrh-qtbase-5.15.10.drv",["out"]) in use. (and if this were a transformation that applied to all packages, it would be using two variants of the entire world beneath qtbase also) >> 2. The (perceived) case of packages hiding inside arguments. In >> hindsight, this was probably actually (3) causing this, though it's >> hard to tell because I discovered it last. I attempted to resolve >> this by recursing through <gexp>s and <gexp-input>s. > > Yeah. I think we have to understand that “hiding” is to some extent > inevitable; <package> is more concise than <bag>, which is more concise > than <derivation>. There are extra “inputs” showing up when we go from > one abstraction to the one below. Ideally no new packages would be introduced when going from bags to derivations - there is also information at the package level that is missing at the derivation level, like properties and arguments, that transformations should be able to access. > >> 3. `this-package' referring to the inherited package in thunked fields, >> rather than the package inheriting them. This is what prompted the >> use of package-{inputs,arguments,etc}-with-package. > > Ah yes, I agree; I reported it here: > > https://issues.guix.gnu.org/50335 > > I think we can discuss it separately though, in that bug report > probably. Ah, in the meantime I created issue #66510. I suppose I should merge that. I think the syntactic option presented there seems promising - extending record constructors so that (inherit parent) can be replaced with (inherit parent (fieldname variable-like-macro-name) ...) to cause uses of variable-like-macro-name within the constructor to refer to the parent's value of fieldname, with any field thunk of the parent evaluated while `this-package' is bound to the package being defined. - Ulf [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-15 7:12 ` Ulf Herrman @ 2023-10-21 14:31 ` Ludovic Courtès 2023-10-21 22:22 ` Ulf Herrman 0 siblings, 1 reply; 23+ messages in thread From: Ludovic Courtès @ 2023-10-21 14:31 UTC (permalink / raw) To: Ulf Herrman; +Cc: 65665 Hi, Ulf Herrman <striness@tilde.club> skribis: >> $ ./pre-inst-env guix build qgit -n --with-latest=qtbase >> following redirection to `https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/'... >> following redirection to `https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/6.6/'... >> guix build: warning: cannot authenticate source of 'qtbase', version 6.6.0 >> >> Starting download of /tmp/guix-file.CTehnY >> From https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/6.6/6.6.0/submodules/qtbase-everywhere-src-6.6.0.tar.xz... >> …-src-6.6.0.tar.xz 46.1MiB 12.9MiB/s 00:04 ▕██████████████████▏ 100.0% >> substitute: updating substitutes from 'http://192.168.1.48:8123'... 100.0% >> substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% >> substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0% >> substitute: updating substitutes from 'https://guix.bordeaux.inria.fr'... 100.0% >> The following derivations would be built: >> /gnu/store/paixxkdaakv55bffggxx4l9hiknl8i5r-qgit-2.10.drv >> /gnu/store/f9fdjk1g1s1aqmlmi4clla2kqns7283v-qtbase-6.6.0.drv >> 0.4 MB would be downloaded: >> /gnu/store/nl9dadzfmjm9wg7v3r31jkx773dl683x-module-import-compiled >> /gnu/store/6zryxmypw0wygayc9pvhyxkx47w0lyci-gperf-3.1 >> /gnu/store/a57n7wy8mdi7l52pr4zg07132blgj5xp-qgit-2.10-checkout > > And if you do a quick 'cat > /gnu/store/paixxkdaakv55bffggxx4l9hiknl8i5r-qgit-2.10.drv'... [...] > you'll see we have both a > ("/gnu/store/f9fdjk1g1s1aqmlmi4clla2kqns7283v-qtbase-6.6.0.drv",["out"]) > and a > ("/gnu/store/hjhr64r5x3bhdw63zz3a3v09vfrlkhrh-qtbase-5.15.10.drv",["out"]) > in use. > > (and if this were a transformation that applied to all packages, it > would be using two variants of the entire world beneath qtbase also) D’oh! Now we have a bug to chew. (Sorry if this was obvious to you from the start; it wasn’t to me!) I don’t know, should we start by having a proper bug report for this and study how this happen? Again I’m sorry if I’m slow to understand, but I’d like to make sure we have a good understanding of the problem before we start discussing solutions. Thanks, Ludo’. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-21 14:31 ` Ludovic Courtès @ 2023-10-21 22:22 ` Ulf Herrman 2023-10-23 13:53 ` Simon Tournier 0 siblings, 1 reply; 23+ messages in thread From: Ulf Herrman @ 2023-10-21 22:22 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Ulf Herrman, 65665 [-- Attachment #1: Type: text/plain, Size: 3686 bytes --] Ludovic Courtès <ludo@gnu.org> writes: > I don’t know, should we start by having a proper bug report for this and > study how this happen? Does that mean opening a new issue, or what? The bug you've described is the one this issue was initially opened for. > Again I’m sorry if I’m slow to understand, but I’d like to make sure we > have a good understanding of the problem before we start discussing > solutions. Okay, I suppose I should have given a concrete example of the behavior. The qgit example can fill that role: $ cat $(./pre-inst-env guix build qgit -n --derivations --no-grafts --with-latest=qtbase) <observe that an untransformed qtbase is present> The way this happens is that qt-build-system's bag-builder (e.g. qt-build, qt-cross-build)) introduces a reference to the qtbase from its #:qtbase argument into the gexp it creates a derivation from, completely independently of any inputs. qgit doesn't explicitly specify #:qtbase, and qt-build-system's 'lower' procedure doesn't add one, so the default value for that keyword argument, (default-qtbase), is used in qt-build. This default value can only be overridden by explicitly passing #:qtbase as a package or bag argument. This requirement doesn't map well to a generic package transformation interface at all - it requires that every transformer (e.g. package-mapping) check if the package it's transforming is using qt-build-system, and if so explicitly supply a #:qtbase that is the result of transforming the original implicit or explicit value, after somehow figuring out what that may be (currently only doable by manually reading guix/build-system/qt.scm). This behavior is also currently exhibited by all build systems' handling of #:guile. Here's a concrete example of that, taken from another mailing I sent to this issue (https://issues.guix.gnu.org/65665#15): --------------------------------- (use-modules (guix packages) (guix profiles) (gnu packages base)) (define guile-named-lyle (package (inherit (default-guile)) (name "lyle"))) ;; contrived example that only replaces hello's immediate dependencies (define hello-transformer (package-mapping (lambda (p0) (if (eq? p0 (default-guile)) guile-named-lyle p0)) (lambda (p) (not (eq? p hello))) #:deep? #t)) (define hello-with-lyle (hello-transformer hello)) (packages->manifest (list hello hello-with-lyle)) ;; $ guix build --derivations --manifest=THISFILE ;; Expectation: build for hello-with-lyle is done with guile-named-lyle. ;; Reality: derivation for hello-with-lyle is the same as hello. --------------------------------- Hopefully that makes it clear why this is happening. As for solutions, some options that come to mind: 1. guile and qtbase, instead of being passed to bag builders as a separate argument, are passed as a bag input that is looked up by magic input label, e.g. "guile-for-build", "qtbase-for-build", etc. Seems fragile, but requires no changes to package-mapping, etc. 2. Modify the build systems so that these kinds of implicit arguments that are packages are always present in bags, and the defaults for those keyword arguments in e.g. qt-build are never used. This is the approach I've taken with https://issues.guix.gnu.org/issue/65665/attachment/4/0/3. This still requires that bag arguments that are packages are transformed in addition to inputs. I hope that counts as a proper bug report. - Ulf [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-21 22:22 ` Ulf Herrman @ 2023-10-23 13:53 ` Simon Tournier 0 siblings, 0 replies; 23+ messages in thread From: Simon Tournier @ 2023-10-23 13:53 UTC (permalink / raw) To: Ulf Herrman, Ludovic Courtès; +Cc: Ulf Herrman, 65665 Hi, On Sat, 21 Oct 2023 at 17:22, Ulf Herrman <striness@tilde.club> wrote: >> I don’t know, should we start by having a proper bug report for this and >> study how this happen? [...] >> Again I’m sorry if I’m slow to understand, but I’d like to make sure we >> have a good understanding of the problem before we start discussing >> solutions. > > Okay, I suppose I should have given a concrete example of the behavior. > The qgit example can fill that role: > > $ cat $(./pre-inst-env guix build qgit -n --derivations --no-grafts --with-latest=qtbase) If I might, Guix revision a25a492f2b, my understanding is, $ ./pre-inst-env guix build qgit -n --with-latest=qtbase /gnu/store/gx5d03as0k1w6jv0pssi6j69n8glf6w5-qgit-2.10.drv /gnu/store/h02aizdjy4p10n4gmcy0y35x14lmjx3n-qtbase-6.6.0.drv Then the builder of the derivation /gnu/store/gx5d03as0k1w6jv0pssi6j69n8glf6w5-qgit-2.10.drv reads, --8<---------------cut here---------------start------------->8--- (begin (use-modules (guix build qt-build-system) (guix build utils)) (qt-build #:source "/gnu/store/a57n7wy8mdi7l52pr4zg07132blgj5xp-qgit-2.10-checkout" #:system "x86_64-linux" #:outputs (list (cons "out" ((@ (guile) getenv) "out"))) #:inputs (quote (("source" . "/gnu/store/a57n7wy8mdi7l52pr4zg07132blgj5xp-qgit-2.10-checkout") ("cmake" . "/gnu/store/ygab8v4ci9iklaykapq52bfsshpvi8pw-cmake-minimal-3.24.2") ("qtbase" . "/gnu/store/khlz8afih21pd0szn5x1ck6bp6w320cz-qtbase-6.6.0") [...] #:qtbase "/gnu/store/h8z3xhpb8m1ih2k45935kqx0wya5w7vq-qtbase-5.15.10" --8<---------------cut here---------------end--------------->8--- Therefore, the transformation does not rewrite #:qtbase. And note that qtbase-5.15.10 is not listed as #:inputs. Without the transformations, it reads, --8<---------------cut here---------------start------------->8--- (begin (use-modules (guix build qt-build-system) (guix build utils)) (qt-build #:source "/gnu/store/a57n7wy8mdi7l52pr4zg07132blgj5xp-qgit-2.10-checkout" #:system "x86_64-linux" #:outputs (list (cons "out" ((@ (guile) getenv) "out"))) #:inputs (quote (("source" . "/gnu/store/a57n7wy8mdi7l52pr4zg07132blgj5xp-qgit-2.10-checkout") ("cmake" . "/gnu/store/ygab8v4ci9iklaykapq52bfsshpvi8pw-cmake-minimal-3.24.2") ("qtbase" . "/gnu/store/h8z3xhpb8m1ih2k45935kqx0wya5w7vq-qtbase-5.15.10") [...] #:qtbase "/gnu/store/h8z3xhpb8m1ih2k45935kqx0wya5w7vq-qtbase-5.15.10" --8<---------------cut here---------------end--------------->8--- Cheers, simon ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-08-31 20:14 bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs Ulf Herrman ` (3 preceding siblings ...) 2023-09-16 9:45 ` bug#65665: [PATCH] Really " Ulf Herrman @ 2023-10-12 13:53 ` Ludovic Courtès 2023-10-12 15:53 ` Maxim Cournoyer 4 siblings, 1 reply; 23+ messages in thread From: Ludovic Courtès @ 2023-10-12 13:53 UTC (permalink / raw) To: Ulf Herrman; +Cc: 65665 Hi Ulf, Ulf Herrman <striness@tilde.club> skribis: > In short, the current approach of having the build-system lower > procedure leave the arguments mostly unchanged and letting the > bag->derivation procedure (the "bag builder") fill in lots of defaults > means that there are implicit inputs that cannot be touched at the > package level without adding special logic for every single build system > that does something like this. Could you share an example of what is fixed by these changes? Let’s take ‘python-itsdangerous’ as an example. It has zero inputs, only implicit dependencies, yet I can do this: --8<---------------cut here---------------start------------->8--- $ guix build python-itsdangerous -n substitute: updating substitutes from 'http://192.168.1.48:8123'... 100.0% 0.0 MB would be downloaded: /gnu/store/yhvhrmqd5znjs7vsq8kc55nc3rkg4w6x-python-itsdangerous-2.0.1 $ guix build python-itsdangerous --with-input=python=python2 -n The following derivations would be built: /gnu/store/b1hji2qzdiwfg2wx11l1fyjrgiy0f50v-python-itsdangerous-2.0.1.drv /gnu/store/5gibs6x75acc6j0g0rh8m66191l9wq12-python-wrapper-3.10.7.drv 0.1 MB would be downloaded: /gnu/store/b2qv97jbih850zn35b2j84n2acj079cv-itsdangerous-2.0.1.tar.gz $ guix gc --references /gnu/store/5gibs6x75acc6j0g0rh8m66191l9wq12-python-wrapper-3.10.7.drv |grep python /gnu/store/n0snl506x5bbs5c2496blh79yil3pf44-python2-2.7.18.drv /gnu/store/whwrah24q7syyiqra16sm9mjvdxld1pv-python-wrapper-3.10.7-builder --8<---------------cut here---------------end--------------->8--- ‘python’ above is an implicit dependency, yet it was suitably replaced by ‘--with-input’. In what cases does ‘package-mapping #:deep? #t’ miss implicit inputs? Thanks, Ludo’. ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-12 13:53 ` Ludovic Courtès @ 2023-10-12 15:53 ` Maxim Cournoyer 2023-10-13 1:49 ` Ulf Herrman 0 siblings, 1 reply; 23+ messages in thread From: Maxim Cournoyer @ 2023-10-12 15:53 UTC (permalink / raw) To: Ludovic Courtès; +Cc: Ulf Herrman, 65665 Hi Ludovic, Ludovic Courtès <ludo@gnu.org> writes: > Hi Ulf, > > Ulf Herrman <striness@tilde.club> skribis: > >> In short, the current approach of having the build-system lower >> procedure leave the arguments mostly unchanged and letting the >> bag->derivation procedure (the "bag builder") fill in lots of defaults >> means that there are implicit inputs that cannot be touched at the >> package level without adding special logic for every single build system >> that does something like this. > > Could you share an example of what is fixed by these changes? Ulf had mentioned the problems they were facing in the original post of this issue: > The problem with this approach is that it doesn't affect the bag > arguments. This means that packages passed in as arguments may still > end up being used without being transformed. Worse still, packages > *not* passed in as arguments may end up being used *unless one is > explicitly passed in as an argument*, as is the case with > qt-build-system's #:qtbase argument. Examples would be an Qt packages, or packages using #:meson meson-variant. Any build system accepting package as arguments are subject to this problem, if I understand correctly. I hope that helps, -- Thanks, Maxim ^ permalink raw reply [flat|nested] 23+ messages in thread
* bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs 2023-10-12 15:53 ` Maxim Cournoyer @ 2023-10-13 1:49 ` Ulf Herrman 0 siblings, 0 replies; 23+ messages in thread From: Ulf Herrman @ 2023-10-13 1:49 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: Ludovic Courtès, Ulf Herrman, 65665 [-- Attachment #1: Type: text/plain, Size: 2624 bytes --] Maxim Cournoyer <maxim.cournoyer@gmail.com> writes: > Any build system accepting package as arguments are subject to this > problem, if I understand correctly. It's not quite everywhere a package is accepted as an argument: there are many cases where a package is passed as a package argument but doesn't end up in the arguments list of the corresponding bag. This is usually the case because that argument is only overriding a default package that is just added as an input to the bag, with no special treatment aside from being an implicit input. For example, #:cmake in cmake-build-system works this way. This is however not the case for #:qtbase in qt-build-system, and, much more prominently, for #:guile. Neither qtbase nor guile are added to bag inputs implicitly, but they do end up in the final builder, even if not specified. Concretely, this looks like this: --------------------------------- (use-modules (guix packages) (guix profiles) (gnu packages base)) (define guile-named-lyle (package (inherit (default-guile)) (name "lyle"))) ;; contrived example that only replaces hello's immediate dependencies (define hello-transformer (package-mapping (lambda (p0) (if (eq? p0 (default-guile)) guile-named-lyle p0)) (lambda (p) (not (eq? p hello))) #:deep? #t)) (define hello-with-lyle (hello-transformer hello)) (packages->manifest (list hello hello-with-lyle)) ;; $ guix build --derivations --manifest=THISFILE ;; Expectation: build for hello-with-lyle is done with guile-named-lyle. ;; Reality: derivation for hello-with-lyle is the same as hello. --------------------------------- (and I have confirmed that the above results in guile-named-lyle being used with the proposed patches applied) A similar problem manifests when one tries replacing (default-qtbase) in a package using qt-build-system. Both it and guile are in bag arguments and not inputs because it's not enough that they be included as inputs, the builder must also know which one is considered "used by the build system" if there are multiple. One could argue that this ambiguity also exists with other build systems - "which cmake should be used, which gcc should be used", etc - but they choose to resolve it with "eh, whatever shows up first in PATH matching the required name is probably fine". It's not unimaginable that there could be cases where explicitly specifying which package should be used for a particular role would be necessary, though. - Ulf [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 686 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2023-10-23 17:31 UTC | newest] Thread overview: 23+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-31 20:14 bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs Ulf Herrman 2023-09-01 18:08 ` Csepp 2023-09-03 13:02 ` Maxim Cournoyer 2023-09-05 14:57 ` Simon Tournier 2023-09-16 9:45 ` bug#65665: [PATCH] Really " Ulf Herrman 2023-10-06 2:36 ` Maxim Cournoyer 2023-10-06 7:37 ` Ulf Herrman 2023-10-07 3:47 ` Ulf Herrman 2023-10-12 13:47 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès 2023-10-12 7:07 ` bug#65665: [PATCH] Really " Ludovic Courtès 2023-10-12 14:22 ` Simon Tournier 2023-10-12 14:06 ` bug#65665: package-mapping with #:deep? #t doesn't " Ludovic Courtès 2023-10-12 16:00 ` Maxim Cournoyer 2023-10-14 14:47 ` Ludovic Courtès 2023-10-13 3:11 ` Ulf Herrman 2023-10-14 15:18 ` Ludovic Courtès 2023-10-15 7:12 ` Ulf Herrman 2023-10-21 14:31 ` Ludovic Courtès 2023-10-21 22:22 ` Ulf Herrman 2023-10-23 13:53 ` Simon Tournier 2023-10-12 13:53 ` Ludovic Courtès 2023-10-12 15:53 ` Maxim Cournoyer 2023-10-13 1:49 ` Ulf Herrman
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.