Skip to content
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

Support file:// scheme for repo URLs #63

Merged
merged 1 commit into from
Oct 6, 2023
Merged

Support file:// scheme for repo URLs #63

merged 1 commit into from
Oct 6, 2023

Conversation

wwade
Copy link
Contributor

@wwade wwade commented Oct 4, 2023

In a repo.yaml file, instead of just the http:// or https:// scheme, the user might want to specify a local path for an repo, e.g.

repositories:
- arch: x86_64
  baseurl: file:///RPMS
  name: local

And then use that with fetch, e.g.

% bazeldnf fetch
INFO[0000] Resolving repomd.xml from file:///RPMS/repodata/repomd.xml
INFO[0000] Loading primary file from file:///RPMS/repodata/<HASH>-primary.xml.gz

To address this, update the Getter implementation to parse the URL using net/url Parse, and the call a handler that opens a local file and returns a wrapper http.Response when the scheme is "file".

In a repo.yaml file, instead of just the http:// or https:// scheme,
the user might want to specify a local path for an repo, e.g.

    repositories:
    - arch: x86_64
      baseurl: file:///RPMS
      name: local

And then use that with fetch, e.g.

    % bazeldnf fetch
    INFO[0000] Resolving repomd.xml from file:///RPMS/repodata/repomd.xml
    INFO[0000] Loading primary file from file:///RPMS/repodata/<HASH>-primary.xml.gz

To address this, update the Getter implementation to parse the URL
using net/url Parse, and the call a handler that opens a local file
and returns a wrapper http.Response when the scheme is "file".
@wwade
Copy link
Contributor Author

wwade commented Oct 5, 2023

@rmohr mind a quick look here?

Copy link
Owner

@rmohr rmohr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. thanks.

Would be great to have a test in a follow up if you can allocate some time.

@rmohr rmohr merged commit e65d2a3 into rmohr:main Oct 6, 2023
1 check passed
wwade pushed a commit to wwade/bazeldnf that referenced this pull request Oct 6, 2023
Pull request rmohr#63 added support for the `file://` scheme for `fetch`.
This change adds the suggested test case to ensure that both the
baseline `http://` support and the newly-added `file://` support are
working as expected.
@wwade
Copy link
Contributor Author

wwade commented Oct 6, 2023

lgtm. thanks.

Would be great to have a test in a follow up if you can allocate some time.

Done, added in #64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants