Indexes 5: Adds spk repo index subcommand for index generation and updates#1340
Open
dcookspi wants to merge 1 commit intoindex-4-indexed-repository-and-fbindexfrom
Open
Conversation
This was referenced Mar 20, 2026
spk repo index subcommand for index generation and updates
9da2f7c to
d88602e
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
d88602e to
027a156
Compare
8530adc to
68bb519
Compare
dcookspi
commented
Mar 20, 2026
Comment on lines
+118
to
+121
| // There isn't an existing index, so generate one from scratch that | ||
| // will also include the update package version. | ||
| // TODO: could also just error out and say run a full index first, | ||
| // or ask the user "are you sure?" before continuing. |
Collaborator
Author
There was a problem hiding this comment.
Let me know if this should error rather than generate a full index.
dcookspi
commented
Mar 20, 2026
Comment on lines
+1178
to
+1180
| // Local repo only case does not use indexes because they | ||
| // are typically small and not indexed. If local repos | ||
| // became large and were indexed, this might change. |
Collaborator
Author
There was a problem hiding this comment.
This is the default we intend to use, but maybe it should be configurable.
dcookspi
commented
Mar 20, 2026
Comment on lines
+784
to
+788
| // TODO: does not handle packages from indexes. This will | ||
| // crash if --use-indexes was used. Those packages would need | ||
| // to be converted to something that could be serialized, or | ||
| // pieces extracted individually from the index packages, for | ||
| // this to work. |
Collaborator
Author
There was a problem hiding this comment.
The plan is not to address this in this PR-chain. Users can specify --no-indexes if they want info when indexes are the default. Although, perhaps we should disable index use for spk info ? That would probably be better.
68bb519 to
1e28bf4
Compare
027a156 to
cdaf8f9
Compare
dcookspi
commented
Mar 20, 2026
| index.check_fb_index()?; | ||
| tracing::debug!( | ||
| "'{name}' repo index checked as flatb RepositoryIndex: {} secs", | ||
| "'{name}' repo index verified before use : {} secs", |
Collaborator
Author
There was a problem hiding this comment.
This change and the next one make the times line up in the output.
Adds --use-indexes and --no-indexes flags to repository. Updates resolvo solver to get global variables data from an indexed repository. Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
1e28bf4 to
854446a
Compare
cdaf8f9 to
b70cba2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new
repo indexsubcommand to spk for index generation and updates. It adds the--use-indexesand--no-indexesflags for repository index usage. This also updatesresolvosolver to get global variables data from an indexed repository. This allowsresolvoto solve without needing to restart its solves.Indexing
The index is design to help the solvers with solves. It doesn't contain enough data to help with other spk operations like building and testing a package. Indexing can be enabled or disabled in the spk config file. If indexing is enabled, you also have to generate an index, with
spk repo index, prior to trying to use it.To generate an index (for the origin):
spk repo index --disable-repo localTo update an existing index, e.g. after a new python package was published:
spk repo index --disable-repo local --update pythonIf index use is enabled in the config file, it can be disabled with the
--no-indexescommand line flag. If index use is disabled by default, it can be enbled with the--use-indexesflag. If index use is enabled but no index has been generated, spk will fallback to using the underlying repo directly (as it does before this change).Speed Diferences
Generating the index file on our repo (sizes below) takes about 2 minutes. Updating a package in an existing index, such as after a new build is published, takes a few seconds.
Sample solver time improvements using this indexing with:
The indexing doesn't have a noticable impact (to users) on smaller solves. But it allows our larger solves to finish in under 10 seconds.
This is the final 5 of 5 chained PRs for adding indexes to spk solves:
new_unchecked()constructors to spk schema objects #1337