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

Allow all opam URLs in opam-repositories section #649

Closed
dra27 opened this issue Mar 4, 2023 · 6 comments
Closed

Allow all opam URLs in opam-repositories section #649

dra27 opened this issue Mar 4, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@dra27
Copy link
Member

dra27 commented Mar 4, 2023

While working on #647, I attempted to add a repository git+file://D:\\opam-repo#branch which is a valid opam URL but which causes an exception with setup-ocaml ("Error: Invalid URL" in "Retrieve the opam download cache"). I have a recollection that fully specified opam URLs have caused problems in the past (e.g. git+https://github.com/ocaml/opam-repository). The issue looks like it's in composeOpamDownloadCacheKeys:

const repositories = OPAM_REPOSITORIES.map(([, u]) => {
const url = new URL(u);
const urn = path.join(url.hostname, url.pathname);
return urn;
}).join("_");

when trying to create a URL object.

@dra27 dra27 added the bug Something isn't working label Mar 4, 2023
@smorimoto
Copy link
Member

So it seems to make more sense here not to create a URL object, but simply to pass it, right?

@dra27
Copy link
Member Author

dra27 commented Mar 4, 2023

I guess so - I wasn't entirely sure what existing code was trying to do. Is it trying to remove the protocol from the cache key?

@dra27
Copy link
Member Author

dra27 commented Mar 4, 2023

(this was non-urgent for me, too - it was easy to work-around, and I was setting up an unusual workflow to test something)

@psafont
Copy link
Contributor

psafont commented Mar 16, 2023

I've encountered this symptom because I'm trying to convert a legacy workflow using the ocaml's docker images to setup-ocaml for testing xapi's custom repo. I don't think I can use v1 (where local repos work fine) as I need to disable opam's sandboxing.

This also happens when using "." as a shorthand of the current working directory. Maybe the url could be fetched from opam instead, or maybe just use the name of the repository? I'm not sure what is it that it's trying to solved by using the url in the key that can't be solved by using the name

@psafont
Copy link
Contributor

psafont commented Mar 23, 2023

Now the action builds the key in an ad-hoc way which takes into account relative filepaths. I'm unsure whether this is enough to cover all types of URLs supported by opam

@smorimoto
Copy link
Member

Fixed in #656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants