bitbake: fetch: Add support for remapping URL's
PATCH 1/1 bitbake: fetch: Add support for remapping URL's
From: Savvas Etairidis <[email protected]>
This commit adds support for remapping URL's in the fetcher. This is useful for cases where the same server is access with different protocols or different URL's. The remapping is done by adding a remap entry to the global configuration or the recipe file.
Fixed #10699
--- .../bitbake-user-manual-fetching.rst | 10 ++ .../bitbake-user-manual-ref-variables.rst | 9 ++ bitbake/lib/bb/fetch2/__init__.py | 68 +++++++++++- bitbake/lib/bb/tests/fetch.py | 104 +++++++++++++++++- 4 files changed, 187 insertions(+), 4 deletions(-)
bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +10 -0
@@ -148,6 +148,16 @@ If :term:`BB_CHECK_SSL_CERTS` is set to ``0`` then SSL certificate checking will be disabled. This variable defaults to ``1`` so SSL certificates are normally checked. +If :term:`BB_ALLOW_URL_REMAP` is set to ``1`` then URL's will be remapped +based on the rules defined in :term:`BB_URL_REMAP` the varriable can be set +in the global configuration or in the recipe. + +Here is a examples of how to set the variable:: + + BB_URL_REMAP = "\ + git://example.com/ https://example.com/ \ + http://example.com/ https://example.com/" + .. _bb-the-unpack: The Unpack
bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +9 -0
@@ -494,6 +494,15 @@ overview of their function and contents. running builds when not connected to the Internet, and when operating in certain kinds of firewall environments. + :term:`BB_ALLOW_URL_REMAP` + Allows the use of the :term:`BB_URL_REMAP` variable to remap URL's. + + :term:`BB_URL_REMAP` + A table of remappings. This variable is used to remap URLs to + different locations. The remapping is done by the fetcher module + before the fetcher attempts to access the URL. The remapping is + performed by replacing the string with the remapped string. + :term:`BB_NUMBER_PARSE_THREADS` Sets the number of threads BitBake uses when parsing. By default, the number of threads is equal to the number of cores on the system.
bitbake/lib/bb/fetch2/__init__.py +65 -3
93 lines not on this page · raw message
bitbake/lib/bb/tests/fetch.py +103 -1
155 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 8 lines · Savvas Etairidis via lists.openembedded.org
From: Savvas Etairidis <[email protected]>
This commit adds support for remapping URL's in the fetcher. This is useful for cases where the same server is access with different protocols or different URL's. The remapping is done by adding a remap entry to the global configuration or the recipe file.
Fixed #10699
I'm curious why you didn't use the PREMIRRORS and MIRRORS support that already exists?
Cheers,
Richard
Hi Richard,
I think it would be better to not modify how PREMIRRORS and MIRRORS work since users already depend on them and expect them to work on specific way. Like this you can add extra rules to rewrite the source code url and then use PREMIRRORS and MIRRORS if they exists.
I could instead provide an example how someone could have the same result using PREMIRRORS if you think it is not worth having this as standalone feature.
Regards,
Savvas
Στις Τρί 6 Μαΐ 2025 στις 12:46 π.μ., ο/η Richard Purdie < [email protected]> έγραψε:
Quoted 18 lines
Quoted 8 lines · Savvas Etairidis via lists.openembedded.org
From: Savvas Etairidis <[email protected]>
This commit adds support for remapping URL's in the fetcher. This is useful for cases where the same server is access with different protocols or different URL's. The remapping is done by adding a remap entry to the global configuration or the recipe file.
Fixed #10699
I'm curious why you didn't use the PREMIRRORS and MIRRORS support that already exists?
Cheers,
Richard
Hi Savvas,
Quoted 8 lines · Sawas Etairidis
I think it would be better to not modify how PREMIRRORS and MIRRORS work since users already depend on them and expect them to work on specific way.
Like this you can add extra rules to rewrite the source code url and then use PREMIRRORS and MIRRORS if they exists.
I could instead provide an example how someone could have the same result using PREMIRRORS if you think it is not worth having this as standalone feature.
Looking at the bug in question
(https://bugzilla.yoctoproject.org/show_bug.cgi?id=10699), the issue is filed against the layer index and the issue in question was more about allowing layers to list their mirror urls so that we could canonicalise different urls.
Your patch is against bitbake itself and it is unclear if we need that support in bitbake itself to solve that bug which was targetting a layer index change if I understand correctly.
There is already some discussion about changing the way PREMIRRORS/MIRRORS work for other issues and given that, I'm reluctant to add new code paths that add complexity and do things in a different way. I've been hoping rather than adding complexity, we could try and simplify whilst still maintaining the different use cases we need.
Cheers,
Richard
Hi Richard,
My bad, I never noticed this was in another component. Sorry to waste your time on this.
I will look if I can work on this in the layer index project if not, I move to NEW again.
If you think it is of value, I could build a check if a URL is the same, but the access protocol is not the same to at least inform the developer that something is wrong.
For example, if the following is configured.
recipe_a.bbSRC_URI = "git://github.com/project/repo"
recipe_b.bbSRC_URI = "https://github.com/project/repo"
The following warning should be generated.
WARNING: recipe_a-0.0.0-r0 do_fetch: Url github.com/project is accessed with diffrent protocols
Regards,
Savvas
Στις Τετ 7 Μαΐ 2025 στις 10:05 π.μ., ο/η Richard Purdie < [email protected]> έγραψε:
Quoted 32 lines
Hi Savvas,
Quoted 8 lines · Sawas Etairidis
I think it would be better to not modify how PREMIRRORS and MIRRORS work since users already depend on them and expect them to work on specific way.
Like this you can add extra rules to rewrite the source code url and then use PREMIRRORS and MIRRORS if they exists.
I could instead provide an example how someone could have the same result using PREMIRRORS if you think it is not worth having this as standalone feature.Looking at the bug in question
(https://bugzilla.yoctoproject.org/show_bug.cgi?id=10699), the issue is filed against the layer index and the issue in question was more about allowing layers to list their mirror urls so that we could canonicalise different urls.Your patch is against bitbake itself and it is unclear if we need that support in bitbake itself to solve that bug which was targetting a layer index change if I understand correctly.
There is already some discussion about changing the way PREMIRRORS/MIRRORS work for other issues and given that, I'm reluctant to add new code paths that add complexity and do things in a different way. I've been hoping rather than adding complexity, we could try and simplify whilst still maintaining the different use cases we need.
Cheers,
Richard