Repository navigation
multiple by-name directories - #206
quantenzitrone wants to merge 8 commits into
Conversation
6b0c568 to
beb7817
Compare
This comment was marked as outdated.
This comment was marked as outdated.
f9bea1e to
179e56c
Compare
2815e2b to
1969d8c
Compare
bafbeff to
6a6ab6c
Compare
|
This is mostly done now, some things are still up for debate (especially how the config file should be done). edit: moved the nixpkgs test branches to the pr description |
|
I believe I've fixed the issue you mentioned in d97ae0f. |
| - Attribute `new1` is a new top-level package using `callPackage ... { /* ... */ }`. | ||
| - Attribute `fooPackages.new1` is a new package using `callPackage ... { /* ... */ }`. | ||
| Please define it in pkgs/sets/fooPackages/by-name/ne/new1/package.nix instead. | ||
| See `pkgs/by-name/README.md` for more details. |
There was a problem hiding this comment.
Should we be referencing pkgs/sets/fooPackages/by-name/README.md or similar instead? (Do/should we guarantee it exists?)
There was a problem hiding this comment.
The workaround for a new non-by-name package would be the same, so i think its fine to refer to the pkgs/by-name README for now. Tho this could be changed later once stuff is in nixpkgs.
9d06c69 to
bf9d9ac
Compare
204d8a6 to
580bf7f
Compare
| // ignore certain problems for new package sets | ||
| if new_package_sets | ||
| .iter() | ||
| .any(|x| x.attr_path == pkgset.attr_path) | ||
| { | ||
| other_package_result = other_package_result.map(|package_result_inner| { | ||
| package_result_inner | ||
| .into_iter() | ||
| .filter(|(_full_attr_path, package)| { | ||
| // skip checks for packages that don't use by-name | ||
| matches!( | ||
| package.uses_by_name, | ||
| ratchet::RatchetState::Tight | ratchet::RatchetState::NonApplicable | ||
| ) | ||
| }) | ||
| .collect() | ||
| }); | ||
| } |
There was a problem hiding this comment.
I believe I've fixed the issue you mentioned in d97ae0f.
I fixed the issue in a different way: i just skip some checks for new package sets.
It's quite a lot simpler than what you (or your clanker) came up with.
I only saw your comment after I already finished implementing my changes.
What do you think?
There was a problem hiding this comment.
ok my current version breaks for aliases
kinda makes sense, aliases are never in by-name, thus RatchetState::TightRatchetState::NonApplicable for uses_by_name
edit: fixed and added to test
b7ce4d9 to
1a060d6
Compare
There is not much more to what the commit message summary says. This commit changes the function signatures and doc comments throughout the codebase (where applicable) to include the subpath in nixpkgs where the by-name directory resides. This is the first step of making it possible to use multiple by-name directories.
Simple rename of a function argument to avoid confusion with the argument introduced in the next commit.
This replaces a lot of `attribute_name` or `package_name` function arguments with `full_attr_path` and it adds `attr_path` to some functions throughout the codebase. - `attr_path` is the attribute path to the package set, so excluding the package name. - `full_attr_path` is the attribute path to the package, so including the package name. Thus `full_attr_path` should never be empty. This is the second step of making it possible to use multiple by-name directories. TODO: remove some commented out debugging code once the pr is ready for merge
The config file format is very simple for now: An attribute set with `package_sets` as its only key, which is just a list of configs for a by-name dir with its file path and attr path. If there is no config file, a basic config with `pkgs/by-name` as a top level package set is used to have the same behaviour as before this PR. When a new package set is added to the config file, all checks on packages that don't use the by-name structure are ignored. Because otherwise it would be really hard to migrate a package set. Checks on packages in the by-name directory and basic checks e.g. that the sharding structure is correct are still done. This also adds NPV-180 which checks the parsability of the config file, aswell as several tests for that NPV. This also adds several tests that change which package sets are tracked and validate the behaviour when adding or removing a package set. Changes to consider: - Make the config file a nix file and eval it to json before parsing it with serde. This would make it possble to dynamically configure directories based on patterns. e.g. all pkgs/sets/*/by-name are checked under the respective directory name attr path - Different default config path (maybe with a . in front). - A way to configure the config file path via command line options. This is the third step of making it possible to use multiple by-name directories.
This adds a non top-level by-name directory to every existing test.
1a060d6 to
d8ccf3b
Compare
d8ccf3b to
432749b
Compare
Basically a new attempt at #31, but instead of adapting #180, i start from scratch because i wasn't able to rebase it.
The pr is supposed to be reviewed commit-by-commit.
There are 4 big relatively self-contained steps for this:
const BASE_SUBPATHto function arguments[ ]) configurablecargo check --all-targets,cargo clippy --all-targetsandcargo testshould be happy after every commit.I have test fork test branches of nixpkgs:
fishPluginstopkgs/sets)fishPlugins/*topkgs/sets/fishPlugins/by-name)When vetting
initwith basebaseit succeeds.When vetting
fishPlugins-by-namewith baseinitit fails because all the fish plugins don't use strictDeps and structuredAttrs.When vetting
fishPluginswth baseinitit succeeds, because checks for non-by-name attributes are skipped for new package sets.When vetting
fishPlugins-by-namewith basefishPluginsit succeeds.Closes #180