-
Notifications
You must be signed in to change notification settings - Fork 4
Add plugin support for download resolving #129
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
Draft
Urist-McGit
wants to merge
10
commits into
main
Choose a base branch
from
feat/plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
ecd6947 to
58f4a8c
Compare
fmoessbauer
reviewed
Nov 19, 2025
Member
fmoessbauer
left a comment
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.
In general this implementation is already pretty solid. Just some minor comments.
Member
|
+cc @chombourger |
fcbc98d to
671bb9b
Compare
Signed-off-by: Christoph Steiger <[email protected]>
As a preparation for upcoming work untangle the logic surrounding the upstream resolver. For this create a generic base class for resolving and a generic remote file representation. Move logic related to the snapshot mirror to the snapshot client module. Also factor out the resolve logic itself: there is a base part which handles caching of packages and one specific to the actual resolver. Signed-off-by: Christoph Steiger <[email protected]>
With the refactored remote file structure it is not possible to derive the target path directly from the remote file. For this information about the package, namely if it is source or binary, is required. The size is also optional now, so the calculation of download sizes needs to consider that too. For files where the size is unknown the size is 0. Signed-off-by: Christoph Steiger <[email protected]>
With the --resolver option a resolver can be specified. As it stands right now there is only one resolver for the debian snapshot mirror. This option is intended to be used by plugins in the future. Signed-off-by: Christoph Steiger <[email protected]>
We currently only have a simple file cache. Make it unique by adding the resolver type to the cache directory. Signed-off-by: Christoph Steiger <[email protected]>
Allow a cache implementation to be replaced while in use. This is required so we do not have to pass the default cache instance to the initialization. This is in preparation for the upcoming plugin work. The use-case is to allow for custom cache implementations and, in case no custom implementation is provided, use our internal default implementation. Signed-off-by: Christoph Steiger <[email protected]>
To decouple the caching implementation and the resolver it is necessary to upcast any downstream RemoteFile to its base instance. Our simple cache implementation otherwise stumbles over any additional fields that might have been added to any downstream remote files. Our caching implementation works solely based on the hash of the remote file, which is already available in the base instance. Signed-off-by: Christoph Steiger <[email protected]>
Introduce a common base error for resolving. This error is caught on the outermost level instead of the snapshot error now. Signed-off-by: Christoph Steiger <[email protected]>
Add the option to use plugins for resolving download location of packages. Signed-off-by: Christoph Steiger <[email protected]>
Since resolvers do not necessarily look "upstream", the error message is now more general and simply states that the package could not be resolved. Signed-off-by: Christoph Steiger <[email protected]>
671bb9b to
d6e7657
Compare
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.
Add a new
--resolveroption to thedownloadcommand. New choices for this option can be added with plugins. The plugin functionality is based on entry points.This is marked as Draft since I consider a full example of a plugin necessary documentation, and for technical reason this has to live in a separate repository. Until the Siemens internal review process for open source publications is done I can not publish it, so we have to wait until then. Otherwise I consider this ready, except for the missing link to the plugin examples repository.