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
Experiment/maintainer ping #293
Conversation
Does it need to say |
No, removed in 8c2a87a. Thanks! |
ofborg/src/maintainers.rs
Outdated
use ofborg::nix::Nix; | ||
use std::path::Path; | ||
use tempfile::NamedTempFile; | ||
use std::io::Write; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your import ordering system? It looks either random or append-to-bottom
ofborg/src/maintainers.rs
Outdated
|
||
impl ImpactedMaintainers { | ||
pub fn calculate(nix: &Nix, checkout: &Path, paths: &Vec<String>, attributes: & | ||
Vec<Vec<&str>>) -> Result<ImpactedMaintainers, CalculationError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&Vec
is never what you want, use &[...]
.checkout_ref(&OsStr::new(&hash)) | ||
.unwrap(); | ||
|
||
let remote = env::var("NIX_REMOTE").unwrap_or("".to_owned()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very subjective, but I prefer String::new()
. I haven't checked whether "".to_owned()
gets away with not heap allocations, but String::new()
does. Feel free to ignore
ofborg/src/nix.rs
Outdated
attrargs.push(argstr.to_owned()); | ||
} | ||
|
||
return self.safe_command(Operation::Evaluate, nixpkgs, attrargs, extra_paths); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary return
ofborg/src/nix.rs
Outdated
@@ -150,7 +161,26 @@ impl Nix { | |||
attrargs.push(attr); | |||
} | |||
|
|||
return self.safe_command(Operation::Instantiate, nixpkgs, attrargs); | |||
return self.safe_command(Operation::Instantiate, nixpkgs, attrargs, vec![]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The algorithm looks good to me.
{ changedattrsjson, changedpathsjson }: | ||
let | ||
pkgs = import ./. {}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a with pkgs.lib; with builtins;
to improve the readability. Namespacing is typically good, but I don't think it's worth it here. Or do you want to keep track of what's provided by lib
since it's vendored?
matching = builtins.filter | ||
(changed: pkgs.lib.strings.hasSuffix changed filename) | ||
changedpaths; | ||
in (builtins.length matching) > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
( isEmpty = list: (length list) == 0
function in lib
would be nice :) )
ofborg/src/maintainers.nix
Outdated
}) | ||
changedattrs; | ||
|
||
validPackageAttributes = builtins.filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wishing for a nice nixfmt :)
) | ||
enrichedAttrs; | ||
|
||
attrsWithPackages = builtins.map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation changes
3. identify the file which defines each changed attribute
4. filter out all attributes whose containing file is not modified by the PR
What does it mean «defines the changed attribute»?
I have a feeling that either we will have problems with all-packages.nix, or with Firefox/Wine (where bumps go in one file and mkDerivation goes into another).
Were both these cases considered, or should I try to work out the specifics?
(I assume that a change also includes addition/removal; by the way, how do we want to handle aliases.nix ?)
|
@7c6f434c those cases the algorithm indeed won't cache. As a work-around, we may continue on 4) with:
It won't solve it entirely, but I don't think we can do any better than that. |
@7c6f434c those cases the algorithm indeed won't cache.
There is a moderate chance of false-positive on something interesting in all-packages.nix or aliases.
As a work-around, we may continue on 4) with:
- if an attribute doesn't have a transitive parent that is already in the result of 4), then extend 4) with that one. I think a breadth first search is needed for this.
I think if you do that (and even if you just don't special-case large files), it is also a good idea to have logic like «going to ping more than 6 people → file an issue in ofborg instead» (you can just ping me, I will file the issue manually)
|
The current algorithm says an attribute is changed if the derivation it points to changed. |
8c2a87a
to
07a5a14
Compare
I've rebased this on top of my branch where I rustfmt'd and cargo clippy'd the codebase, and formatted the Nix code with the changes in nix-mode at NixOS/nix-mode#61. I'm thinking I'll probably deploy this in the morning unless someone would like to review it more carefully. |
For people having questions about how ofborg handles' all-packages.nix: NixOS/nixpkgs#53281 it didn't ping anyone because the change was only in all-packages.nix. |
OK, so we do need a combination of |
Ping maintainers based on the algorithm:
Presently it is "no-op": posting the list of packages under the grahamcofborg-eval-check-maintainers check to a gist and not pinging anyone. After a few days of "burning in" and seeing how it goes, I plan on actually pinging people.
Here is a demo: NixOS/nixpkgs#53142
output: https://gist.github.com/GrahamcOfBorg/fa9a84d85a7ad2633df025f2735dfa22