Hello Timothy, Timothy Sample <samp...@ngyro.com> skribis:
> I’ve been using GuixSD for a couple of months now, and it is super > cool. Thanks for all your hard work! There is one little thing, > though. :) If it’s just this one thing, that’s okay. ;-) > Ludo suggested to check each package using the “substitute-paths” RPC > and filter them accordingly. I did exactly this, but there was a > problem. Packages were being built before my code even ran! It turns out > that calling “package-output” (or “package-derivation”) to get a > package’s output path may result in building the package. It’s the > grafting code that does this − it needs to get a package’s references, > and if the daemon gives it any trouble, it tells the daemon to just > build the package to figure it out. This is a real problem if you are > trying to avoid building. This all happens pretty early when running > “guix package -u”, since it compares output paths when figuring out what > needs upgrading. Indeed, I hadn’t thought of this “little detail”! > Therefore, to make it work, I introduced a flag, “#:fail-on-build?”, > that I threaded through a few functions that lets me try to get a > package’s output path without resorting to building the package. The > change looks like this: I would probably take a different route: we could check for the substitutes of the ungrafted packages (hydra.gnu.org does not provide substitutes for the grafted packages anyway) and decide based on that. How does that sound? I haven’t checked the code, let me know if there’s something else I’m missing. BTW, should --only-substitutes filter out packages without a substitute, or should it simply stop and report the list of missing substitutes (after which the user could use --do-not-upgrade)? > If adding this extra parameter isn’t too ugly, then I will put together > two patches: one with this parameter, and another that uses it to > implement “--only-substitutes”. (And maybe a third that fixes a very > minor bug in “guix package”, but that’s another story.) I’m new to > Scheme programming, so this may be an atrocity of some sort that I just > don’t know about; go easy! :) Well that’s a very nice dive into this code base in a foreign language. :-) Thank you! Ludo’.