Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common-updater-scripts: add mark-broken script #85337

Merged
merged 1 commit into from Apr 24, 2020
Merged

common-updater-scripts: add mark-broken script #85337

merged 1 commit into from Apr 24, 2020

Conversation

ghost
Copy link

@ghost ghost commented Apr 15, 2020

Motivation for this change

https://twitter.com/grhmc/status/1250541029180280833

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.


nixFile=$(nix-instantiate --eval --json -E "with import ./. {}; (builtins.unsafeGetAttrPos \"description\" $attr.meta).file" | jq -r .)
if [[ ! -f "$nixFile" ]]; then
die "Couldn't evaluate 'builtins.unsafeGetAttrPos \"meta\" $attr' to locate the .nix file!"
Copy link
Member

Choose a reason for hiding this comment

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

Hope you're not sick of me yet... ;)

Suggested change
die "Couldn't evaluate 'builtins.unsafeGetAttrPos \"meta\" $attr' to locate the .nix file!"
die "Couldn't evaluate 'builtins.unsafeGetAttrPos \"description\" $attr' to locate the .nix file!"

Somewhat unfortunate that meta points to pkgs/stdenv/generic/make-derivation.nix for the rare cases (if any) where a package doesn't have a description, but what can ya do...

Copy link
Author

Choose a reason for hiding this comment

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

Yeah I thought about what meta attribute is set for almost all packages. If there is a better way to find the file containing the meta section for a nixpkgs attribute, it would be great to know it.
Otherwise we can try to improve the checks to detect if it found the wrong file, for example a specific check for make-derivation.nix.

Copy link
Author

@ghost ghost Apr 16, 2020

Choose a reason for hiding this comment

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

I committed something similar to your suggested change, but I will still leave this conversation open, because I think there should be more improvements in this regard.

Copy link
Member

Choose a reason for hiding this comment

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

There is <pkg>.meta.position, but that doesn't work for things like cargo-download which returns pkgs/build-support/rust/build-rust-crate/default.nix:224 (and includes the line number, which would need to be stripped out).

Copy link
Member

Choose a reason for hiding this comment

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

Something to keep in mind with your new wording here: trying to evaluate builtins.unsafeGetAttrPos \"meta.description\" claws (as displayed) returns null, while builtins.unsafeGetAttrPos \"description\" claws.meta (which is what is actually evaluated) returns the desired information.

@worldofpeace
Copy link
Contributor

Works for me, and that would probably be just enough for me 😄

@worldofpeace worldofpeace merged commit 05d1546 into NixOS:master Apr 24, 2020
@worldofpeace
Copy link
Contributor

Thank you @petabyteboy ✨

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

Successfully merging this pull request may close these issues.

None yet

2 participants