| Summary: | [PATCH] fetcher: allow git+<protocol>: syntax | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] BitBake | Reporter: | Enrico Scholz <enrico.scholz> | ||||||
| Component: | bitbake | Assignee: | Richard Purdie <richard.purdie> | ||||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | Medium | CC: | evadeflow, liam.howlett, poky.bs.watcher, poky.watcher, randy.macleod | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | 4.99 | ||||||||
| Hardware: | x86 | ||||||||
| OS: | Multiple | ||||||||
| Whiteboard: | |||||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||||
| Verified: | Documentation change: | Yes (doc changes required) | |||||||
| Attachments: |
|
||||||||
|
Description
Enrico Scholz
2016-06-09 14:14:55 UTC
Created attachment 3224 [details]
patch
correct patch; previous ones missed half of required changes
Your patch means special casing the git fetcher and the protocol parameter into generic code. I've also wondered about this problem but I think I'd prefer to fix it by allowing the MIRRORS code to handle remapping the protocol part of the url. Code can be generalized to accept <scm>[+<protocol>]:// syntax. Other SCMs (bzr, clearcase, hg, osc, repo, svn) have this parameter too. Modifying MIRROR would be too complicated for generic case IMO. *** Bug 13211 has been marked as a duplicate of this bug. *** *** Bug 3306 has been marked as a duplicate of this bug. *** fwiw, we are solving this with a .bbclass now (no changes to bitbake itself required): https://github.com/sigma-embedded/meta-de.sigma-chemnitz/blob/thud/classes/elito-uridecode.bbclass https://github.com/sigma-embedded/meta-de.sigma-chemnitz/blob/thud/lib/elito/__init__.py The url remapping code now supports setting parameters in mirror urls so it is possible to change a procotol using the mirror syntax. I've just added a test for it to ensure it keeps working, Enrico also shared another way to do that here by patching the fetcher. I'm marking this bug as obsolete, it is hard to know what to do as there is a solution here and there is a way to use the mirrors too so that could be fixed, won't fix or obsolete! This does not seem to work. I have | PREMIRRORS:prepend = "git\+([^/]+)://.* git://\\2;protocol=\\1 \n" | SRC_URI = "git+http://git.example.org" which fails with | WARNING: Invalid protocol (git\+([^/]+)) in PREMIRRORS: ('git\\+([^/]+)://.*', 'git://\\\\2;protocol=\\\\1') | ... NoMethodError: Could not find a fetcher which supports the URL: 'git+http://git.example.org' I am in doubt that mirrors are good way to set the protocol: they add new uri entries but do not replace them. The original uri might be still tried under some conditions. Native 'git+<protocol>://' support would be much better. (In reply to comment #8) > This does not seem to work. I have > > | PREMIRRORS:prepend = "git\+([^/]+)://.* git://\\2;protocol=\\1 \n" > | SRC_URI = "git+http://git.example.org" > > which fails with > > | WARNING: Invalid protocol (git\+([^/]+)) in PREMIRRORS: > ('git\\+([^/]+)://.*', 'git://\\\\2;protocol=\\\\1') > | ... NoMethodError: Could not find a fetcher which supports the URL: > 'git+http://git.example.org' > > I am in doubt that mirrors are good way to set the protocol: they add new > uri entries but do not replace them. They can offer replacement, see: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=b3dcb6b1790d14845cc5ad70b0749dd6aed32e7a > The original uri might be still tried under some conditions. > > Native 'git+<protocol>://' support would be much better. We have never supported that syntax and I'm not planning to add it as we do not want to support too many different ways of doing things, it just complicates the codebase. FWIW the regex in the above likely wouldn't work anyway since the pattern substitutions work within the url component they're part of, so the \1 in the parameter wouldn't see the match from the protocol section. Changing that would again significantly complicate the code which I don't believe is necessary. This syntax is already supported by the npmsw fetcher and a common way to express the git protocol. Writing a non-generic PREMIRROR (e.g. to add alternatives for certain hosts) for git:// uris is not ergonomic because mirror setup is global configuration and expensive to change. |