Allow running updateScript of package sets#2154
Conversation
78d2420 to
565d2ce
Compare
565d2ce to
af63a3e
Compare
|
I plan to compare the update result of |
af63a3e to
e6bb561
Compare
Without this patch, package sets, such as bonfire[1], cannot be updated in PRs created by .github/workflows/update-packages.yaml. Before, `update` and `update-all` commands relied on flakes. This patch also lifts that restriction. [1]: ngi-nix#1984
e6bb561 to
58f0bc4
Compare
nix-update -> update.nix of NixpkgsAfter ignoring success -> failure
failure -> success
|
|
This is ready for review @eljamm |
|
BTW, during comparison, I find a seemingly wrong update of funkwhale. cc @JuneStepp |
It might be easiest to just leave it; they're on release candidate 17 now, so 2.0 probably isn't far away. |
|
By itself, this change is great and allows us to update packages inside scopes, but this PR actually does more than this, namely replacing Could we perhaps introduce a default/fallback updater as well? |
|
Currently, there are only 8 packages without a updateScript. Adding updateScript for them is not a big deal. Not a fan of nix-update. Feel free to close this PR and experiment with nix-update. |
Thanks for working on this nice feature @jian-lin, from what you already did, do you already know if it would be equivalent to add the following to the 8 packages? passthru.updateScript = nix-update-script { }; |
Let me elaborate this.
Yes. But apparently it is not always correct. For example, some packages need to update to unstable versions and some need to update to latest commit.
This is a misfeature. I just explained why it is not always correct.
We can. It can be done by customizing |
|
Let me add one point. For package sets sharing the same To express that we do not want to run updateScript on other packages in those package sets, we can not add updateScript to them, which is clear and simple. If we implement the misfeature, i.e., adding a default updateScript for packages not having one, we have to use another way to express not running updateScript for some packages. |
How does Nixpkgs handle this, if at all?
That's fine. The point is having a sane fallback so we at least attempt to update the packages. If we discover that some have more requirements (unstable releases, updating hashes, ...), we just add explicit update scripts to them. This is how Nixpkgs does it for Python modules and possibly other package sets. |
Note that unstable versions are only 1.6% of python3Packages. While in Ngipkgs, they are about 50%. So it makes some sense to default to
Not sure. Note that Anyway, following the logic of choosing nixpkgs flake input, if Ngipkgs maintainers who deal with package updates want to do so, then fine. |
|
pushed a new commit which provides a default updateScript |
debe03d to
bf2308c
Compare
I am not a fan of doing so because the default updateScript is not always correct. For example, about 50% packages in Ngipkgs need to update to unstable versions. In addition, packages not wanting to run updateScript have to do it in another way instead of not providing an updateScript. Ngipkgs maintainers who deal with package updates really want to do so. So I add this patch following the logic of choosing nixpkgs flake input[1]. [1]: ngi-nix#2023 (comment)
bf2308c to
1a0d76c
Compare
eljamm
left a comment
There was a problem hiding this comment.
I ran this locally against the latest main branch, and it's successfully updating package-set items, although it fails for bonfire and dnsvizor:
Packages updated!
Failed to update the following packages:
bonfire.ember
bonfire.open_science
bonfire.social
dnsvizor.hvt
dnsvizor.muen
dnsvizor.qubes
dnsvizor.spt
dnsvizor.unix
dnsvizor.updateScript
dnsvizor.virtio
dnsvizor.xen
openfire
For the former, it's because --repair fails locally (it succeeds in CI):
error: repairing is not allowed because you are not in 'trusted-users'
+ deps=
but for the latter, I assume this PR would fix it.
I'm also not sure about the issue of race conditions that's been mentioned here. I haven't personally encountered it and I can't reproduce it, but I guess we can discuss it in other issues.
This said, not needing flakes to update anymore is obviously a big win, so all in all this looks good to me. Thanks!
The correct flag is
When an input (flake or FOD) is shared between updated packages, the race condition would happen every time upstream of that input releases a new version during an update. Eg. when updating from It happened to me with Bonfire because a Bonfire update takes more than 3 hours. Also, same problem happens without a race condition if a package updates a globally shared flake input. |
|
Note that in #2154 (comment), I said "adding a few updateScript fixes". Without those fixes, dnsvizor package set fails to update. That's because updateScripts of them are wrong and are orthogonal to this PR which is a updateScript runner/driver running those updateScripts. Yes, #2174 is one proper fix. A small "fix" which lets the update process succeeds but not semantically correct is: --- a/pkgs/by-name/dnsvizor/mirage.nix
+++ b/pkgs/by-name/dnsvizor/mirage.nix
@@ -175,7 +175,7 @@ rec {
(
lib.composeExtensions (finalAttrs: previousAttrs: {
passthru = previousAttrs.passthru or { } // {
- updateScript = writeShellApplication {
+ updateScript = lib.getExe <| writeShellApplication {
name = "${pname}-${target}-update";
runtimeInputs = [
coreutils
@@ -205,14 +205,6 @@ rec {
lib.recurseIntoAttrs (
self
// {
- updateScript = writeShellApplication {
- name = "dnsvizor-update";
- runtimeInputs = [
- jq
- nix
- ];
- text = lib.concatMapStringsSep "\n" (target: lib.getExe self.${target}.updateScript) targets;
- };
}
);
} |
When reviewing #2063, I realize that the current package update CI does not work for package sets. This PR fixes that.
Without this patch, package sets, such as bonfire1, cannot be updated in PRs created by .github/workflows/update-packages.yaml.
Before,
updateandupdate-allcommands relied on flakes. This patch also lifts that restriction.a follow-up of #1699
cc @eljamm for review
With this patch, disabled package sets can be enabled for update. That can be done in future PRs.