-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Remote index branch configuration #9466
Conversation
Add a new `get_registry_branch` method to `Config` in order to retrieve the value of a new `branch` key of a registry entry of the Cargo global configuration file as a `GitReference`. Used in `RemoteRegistry::new`. Signed-off-by: Paul Mabileau <[email protected]>
Signed-off-by: Paul Mabileau <[email protected]>
Extend the testing framework specifically in order to offer utility functions and builder methods for alternativ index branches equivalent to those for alternative registries. Modify the `RegistryBuilder::build` and `Package::publish` methods to take the index branch operations into account. Signed-off-by: Paul Mabileau <[email protected]>
Add them in the `config` test suite. Signed-off-by: Paul Mabileau <[email protected]>
Add them to the `alt_registry` test suite. Cover most cases by deriving them from a good part of the other tests and using basic combinations. Signed-off-by: Paul Mabileau <[email protected]>
Add a hard reset from HEAD to discard the previous branch's artifacts in the index and working directory. Signed-off-by: Paul Mabileau <[email protected]>
More details are reported than initially foreseen. Signed-off-by: Paul Mabileau <[email protected]>
Use `[CWD]` as a pattern instead of `[ROOT]/foo`. Signed-off-by: Paul Mabileau <[email protected]>
Signed-off-by: Paul Mabileau <[email protected]>
Some dependencies had names missing when packaging, so this attempts to circumvent this restriction by hacking the name back. Signed-off-by: Paul Mabileau <[email protected]>
Soften the repository reset to `mixed`. Signed-off-by: Paul Mabileau <[email protected]>
~~Drugs~~ Unwraps are bad, m'kay? Signed-off-by: Paul Mabileau <[email protected]>
Signed-off-by: Paul Mabileau <[email protected]>
Add a checkout operation that removes untracked files in order to make sure the registry index is in a clean state. Signed-off-by: Paul Mabileau <[email protected]>
The "branch" word was missing at the end. Signed-off-by: Paul Mabileau <[email protected]>
"alternative-branches" is its name for now. The dirty unwrap is temporary. Signed-off-by: Paul Mabileau <[email protected]>
Enables better handling of error cases. The hack is still there for `SourceId::load` though... Signed-off-by: Paul Mabileau <[email protected]>
Signed-off-by: Paul Mabileau <[email protected]>
Replace the HEAD on the default branch and hard-reset. Signed-off-by: Paul Mabileau <[email protected]>
Make sure they use the appropriate CLI unstable flag. Signed-off-by: Paul Mabileau <[email protected]>
Hard-reset instead of checkout to switch to the alternative branch. Signed-off-by: Paul Mabileau <[email protected]>
The alternative branch was missing in the relative registry's configuration table. Do the same for `*_path_not_allowed`, although it does not change the result of the test. Signed-off-by: Paul Mabileau <[email protected]>
Check that not having the alternative branch set up in the configuration of the `relative` registry pointing to `alternative` actually makes the build fail: the value is taken from the direct table, no inheritance. Signed-off-by: Paul Mabileau <[email protected]>
Avoid switching and resetting branches if not needed. Signed-off-by: Paul Mabileau <[email protected]>
Signed-off-by: Paul Mabileau <[email protected]>
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Eh2406 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
☔ The latest upstream changes (presumably #9475) made this pull request unmergeable. Please resolve the merge conflicts. |
r? @ehuss |
Hi, thanks for the PR! And sorry for the slow response. Just some high-level feedback before reviewing the code itself, I think the branch should be a part of the SourceId itself. Can you think of any particular problems with that? That is, the branch would be encoded in the SourceId in a fashion similar to how it is done with a git dependency (like As for bikeshedding the unstable name, if you want another option I might suggest |
Thanks for the feedback @ehuss! Indeed, putting the branch information in I took a good look at the code for As for the unstable option name, yes, it is a little bit very much bikeshedding, but I think your suggestion |
Missing 'c' in "lexicographically". Signed-off-by: Paul Mabileau <[email protected]>
"registry-branches" instead of "alternative-branches". Only the feature has been renamed, the test support and integration tests still use "alternative_branch" as field and function names as it makes sense just fine in my opinion. Signed-off-by: Paul Mabileau <[email protected]>
The errors are passed to the caller. Signed-off-by: Paul Mabileau <[email protected]>
☔ The latest upstream changes (presumably #9657) made this pull request unmergeable. Please resolve the merge conflicts. |
Ping @PaulDance Just checking in to see if you are still interested in working on this, or if you had any questions. |
@ehuss Yeah sorry, I had a bit of trouble making things work at the time and since then, I did not take the time to try again. It's not that I forgot about it though. I would like to finish it, but I have to motivate myself again first. |
@PaulDance I merged with the lastest upstream at [email protected]:wt/cargo.git on the branch remote-index-branch. Would you be willing to pull it in to resolve the conflict above? Upstream folks, what would it take to get this to a mergeable state? |
@wt Alright, I'll try to take a look at it tomorrow. |
FWIW, I pushed the wrong commit before. I think I fixed it now. I force pushed the branch, so if you pulled before, you'll need to pull it again. |
This way the enum can be fully leveraged. Note: one last test still fails. Signed-off-by: Paul Mabileau <[email protected]>
Signed-off-by: Paul Mabileau <[email protected]>
The error messages regarding registries seem to have changed since the last time I was working on this... Signed-off-by: Paul Mabileau <[email protected]>
Signed-off-by: Paul Mabileau <[email protected]>
@wt I have just now pushed everything I had on my side plus a merge. Notes:
As things stand currently, I don't think I will have the energy necessary in order to fix the issue all by myself, although it may be quite simple in practice. Can anyone investigate the test failure? It would help me quite a bit. |
I'll see if I can find time. This would be amazing to get working.
…On Tue, Feb 15, 2022 at 2:21 PM Paul Mabileau ***@***.***> wrote:
@wt <https://github.com/wt> I have just now pushed everything I had on my
side plus a merge.
Notes:
- I had some commits I did not push because I was working on
refactoring things at the time, so I found it simpler to do the merge again
myself.
- There is one last test that fails. I wasn't able to make it work at
the time and even though I took a look again right now, I had the same
difficulty to find the root cause.
As things stand currently, I don't think I will have the energy necessary
in order to fix the issue all by myself, although it may be quite simple in
practice. Can anyone investigate the test failure? It would help me quite a
bit.
—
Reply to this email directly, view it on GitHub
<#9466 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADFT7YCFPU7MHPUE3PALWTU3LGXJANCNFSM44LA4C3Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
You're More Amazing Than You Think! ymatyt.com
|
☔ The latest upstream changes (presumably #10470) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm closing this due to inactivity. If you (or anyone else) wants to pick this up again, feel free to open a new PR. |
Dear all,
It is my first time contributing to this great project, so some things may not be the best. This is an attempt to close #7329, which still seemed desirable and which I thought was relatively simple, but there were definitely some challenges to it.
A few notes about the implementation:
alternative-branches
, which is always shorter than "alternative registries index alternative branches". Better naming is welcome.ops::RegistryConfig
has a newbranch
field which is retrieved from the configuration usingConfig::get_registry_branch
with the known registry name.sources::registry::RegistrySource::remote
and saved in the already-existingindex_git_ref
field ofsources::registry::remote::RemoteRegistry
.RegistrySource::remote
is also used bycore::source::source_id::SourceId::load
, but thename
field is not always set, soConfig::get_registry_branch_from_id
is used in order to try getting it back by finding which registry configuration has the same index URL. This is actually a source of bug when packaging and therefore publishing: if two registries are configured with the same URL but different branches, the heuristic will yield inconsistent results between different executions, so some dependency may be correctly found once but not during the next run in identical conditions. I'm not very happy with this, but I really don't known how to get the registry name otherwise. I would very much appreciate some guidance here to get this to work consistently.git::RepoBuilder
.alternative_branch
field and its builder methods toregistry::RegistryBuilder
andregistry::Package
so we may correctly manipulate repositories and fake the publication accordingly.alt_br_init
: helper function to do the same asalt_init
but with an additionalalternative-branch
branch.alt_registry
as I thought they would naturally belong there, but maybe it would warrant another module. They were mostly done by taking tests for regular registries and adapting them to check if they still work with or without using the alternative branch.Remarks and suggestions are obviously welcome. I hope this could prove useful to some.
Cheers,
Paul.