Skip to content

Comments

chromium,ungoogled-chromium: fix ofborg maintainer pings#245762

Merged
emilylange merged 1 commit intoNixOS:masterfrom
emilylange:chromium-maintainer-ping-fix
Aug 2, 2023
Merged

chromium,ungoogled-chromium: fix ofborg maintainer pings#245762
emilylange merged 1 commit intoNixOS:masterfrom
emilylange:chromium-maintainer-ping-fix

Conversation

@emilylange
Copy link
Member

Description of changes

ofborg uses builtins.unsafeGetAttrPos internally, to figure out which maintainers need to be pinged.

e.g:
builtins.unsafeGetAttrPos "version" drv

When using a .json file containing the version via lib.importJSON, this will always return null and thus leading to no pings at all.

This commit works around this, resulting in properly working pings for any changes to the upstream-info file.

A similar thing has been done for element-{web,desktop} in the past (#219821).

ofborg not pinging maintainers can be seen in #245572 and #245710

The ofborg code section in question is https://github.com/NixOS/ofborg/blob/released/ofborg/src/maintainers.nix#L50-L66

And yes, this should probably be fixed in ofborg in the long run, but for now, this works too.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Result of nixpkgs-review run on x86_64-linux 1

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jul 27, 2023
@emilylange
Copy link
Member Author

ofborg didn't ping for this PR either, because the change is a no-op.

cc @primeos @thefloweringash @networkException @squalus @michaeladler

@emilylange emilylange marked this pull request as draft July 29, 2023 09:40
@emilylange emilylange force-pushed the chromium-maintainer-ping-fix branch from c9fb56a to 96baaf3 Compare July 29, 2023 09:41
@emilylange
Copy link
Member Author

Rebased to include #245710 (and resolved the merge conflict).

@michaeladler, you reacted with 👍 on the initial PR comment. Does this mean you approve this fix? Any objections to merging? :)

I will also need to manually backport this to 23.05.

@emilylange emilylange marked this pull request as ready for review July 29, 2023 09:47
Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look fine to me (although I cannot test/verify the result) - thanks for looking into this! :)

Comment on lines +378 to +382
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: It's a bit unfortunate that this hack is required (twice) but I guess it should be fine.

@emilylange emilylange force-pushed the chromium-maintainer-ping-fix branch from 96baaf3 to 932d09a Compare July 29, 2023 16:54
@emilylange
Copy link
Member Author

Testing this change isn't really straight forward, yeah.
I didn't really think of adding instructions, sorry for that.

As mentioned in multiple places, ofborg uses builtins.unsafeGetAttrPos for a bunch of attr names, including, but not limited to, version1.

Without this patch:

❯ nix repl -f "<nixpkgs>"
Welcome to Nix 2.15.1. Type :? for help.

Loading installable ''...
Added 19765 variables.
nix-repl> builtins.unsafeGetAttrPos "version" chromium
{ column = 10; file = "/nix/store/nhk2gnp8jf1xshlym3g63m6k7v35p21h-source/pkgs/applications/networking/browsers/chromium/default.nix"; line = 160; }

nix-repl> builtins.unsafeGetAttrPos "version" ungoogled-chromium
{ column = 10; file = "/nix/store/nhk2gnp8jf1xshlym3g63m6k7v35p21h-source/pkgs/applications/networking/browsers/chromium/default.nix"; line = 160; }

Note that it does not return null, but instead the default.nix.
This is because of the inherit, which loses the "pointer".
If we kept the weird builtins.removeAttrs logic together with lib.fromJSON upstream-info.json, is would return null.
Which is why we have to use a .nix instead.

With this patch:

❯ nix repl -f .
Welcome to Nix 2.15.1. Type :? for help.

Loading installable ''...
Added 19832 variables.
nix-repl> builtins.unsafeGetAttrPos "version" chromium           
{ column = 5; file = "/home/me/dev/NixOS/nixpkgs/pkgs/applications/networking/browsers/chromium/upstream-info.nix"; line = 46; }

nix-repl> builtins.unsafeGetAttrPos "version" ungoogled-chromium
{ column = 5; file = "/home/me/dev/NixOS/nixpkgs/pkgs/applications/networking/browsers/chromium/upstream-info.nix"; line = 63; }

The actual ofborg thingy can be tested by running the following in a git clone of https://github.com/NixOS/ofborg -- instructions mostly copied from #219821 (comment)

Pointing ofborg to the local nixpkgs checkout:

diff --git a/ofborg/src/maintainers.nix b/ofborg/src/maintainers.nix
index c519725..dbc861e 100644
--- a/ofborg/src/maintainers.nix
+++ b/ofborg/src/maintainers.nix
@@ -1,6 +1,6 @@
 { changedattrsjson, changedpathsjson }:
 let
-  pkgs = import ./. {};
+  pkgs = import ../../../nixpkgs {};
 
   changedattrs = builtins.fromJSON (builtins.readFile changedattrsjson);
   changedpaths = builtins.fromJSON (builtins.readFile changedpathsjson);

Populating the diff:

❯ echo '[["chromium"]]' > changedattrs.json
❯ echo '["pkgs/applications/networking/browsers/chromium/upstream-info.nix"]' > changedpaths.json

Running the script:

❯ nix-instantiate ofborg/src/maintainers.nix --arg changedattrsjson ./changedattrs.json --arg changedpathsjson ./changedpaths.json --eval
{ networkexception = <CODE>; primeos = <CODE>; thefloweringash = <CODE>; }

Without this PR, on the current nixpkgs master branch and telling ofborg that some change to the update-info.json happened, ofborg would simply not return anything:

❯ echo '["pkgs/applications/networking/browsers/chromium/upstream-info.json"]' > changedpaths.json
{ }

Which is why ofborg did not ping maintainers for version bumps in the past, at least those, that only touch the upstream-info.json and nothing else.


I am a quite tired; sorry if this doesn't make all that much sense.
But feel free to ask if I should clear up something or elaborate/rephrase.

Footnotes

  1. https://github.com/NixOS/ofborg/blob/cda5aa2ac77a70bb5660d8d5614a640aacbe7523/ofborg/src/maintainers.nix#L50-L66

Copy link
Member

@michaeladler michaeladler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works (and the order of the keys is preserved when dumping upstream-info.nix) then I'm fine with it :)

ofborg uses `builtins.unsafeGetAttrPos` internally, to figure out which
maintainers need to be pinged.

e.g:
`builtins.unsafeGetAttrPos "version" drv`

When using a `.json` file containing the version via `lib.importJSON`,
this will always return `null` and thus leading to no pings at all.

This commit works around this, resulting in properly working pings
for any changes to the upstream-info file.

A similar thing has been done for element-{web,desktop} in the past.
@emilylange emilylange force-pushed the chromium-maintainer-ping-fix branch from 932d09a to 68c5979 Compare August 2, 2023 10:18
@emilylange emilylange merged commit 9261255 into NixOS:master Aug 2, 2023
@emilylange emilylange deleted the chromium-maintainer-ping-fix branch August 2, 2023 19:51
@emilylange
Copy link
Member Author

^Manual backport in #246843 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants