download: allow for BR2_PRIMARY_SITE(_ONLY) environment override
PATCH 1/1 download: allow for BR2_PRIMARY_SITE(_ONLY) environment override
Allow BR2_PRIMARY_SITE and BR2_PRIMARY_SITE_ONLY .config options to be overriden by environment variables with the same names.
This is usefull for CI build environments, so primary site can be overridden without .config change. That way download can be speeded up if using mirror servers in the same network as CI.
--- Makefile | 6 ++++++ docs/manual/common-usage.txt | 6 ++++++ package/pkg-download.mk | 8 ++++++++ 3 files changed, 20 insertions(+)
Makefile +6 -0
@@ -208,6 +208,12 @@ endif ifneq ($(BR2_CCACHE_DIR),) BR_CACHE_DIR := $(BR2_CCACHE_DIR) endif +ifneq ($(BR2_PRIMARY_SITE),) +BR_PRIMARY_SITE := $(BR2_PRIMARY_SITE) +endif +ifneq ($(BR2_PRIMARY_SITE_ONLY),) +BR_PRIMARY_SITE_ONLY := $(BR2_PRIMARY_SITE_ONLY) +endif # Need that early, before we scan packages # Avoids doing the $(or...) everytime
docs/manual/common-usage.txt +6 -0
@@ -90,6 +90,12 @@ to +make+ or set in the environment: * +BR2_DL_DIR+ to override the directory in which Buildroot stores/retrieves downloaded files + +* +BR2_PRIMARY_SITE+ to override .config primary site to download + package sources from. + + +* +BR2_PRIMARY_SITE_ONLY+ to override .config primary site only + download option. + + Note that the Buildroot download directory can also be set from the configuration interface, so through the Buildroot +.config+ file. See xref:download-location[] for more details on how you can set the download
package/pkg-download.mk +8 -0
@@ -217,6 +217,14 @@ endef # sites serve just plain files. ################################################################################ +# Restore the BR2_PRIMARY_SITE(_ONLY) that were overridden by the .config file +ifneq ($(origin BR_PRIMARY_SITE),undefined) +BR2_PRIMARY_SITE = $(BR_PRIMARY_SITE) +endif +ifneq ($(origin BR_PRIMARY_SITE_ONLY),undefined) +BR2_PRIMARY_SITE_ONLY = $(BR_PRIMARY_SITE_ONLY) +endif + define DOWNLOAD $(call DOWNLOAD_INNER,$(1),$(notdir $(1)),DOWNLOAD) endef
Signature · 1 line
2.13.2
PATCH 1/1 download: allow for BR2_PRIMARY_SITE(_ONLY) environment override
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcin" == Marcin Niestroj <[email protected]> writes:
Allow
BR2_PRIMARY_SITEandBR2_PRIMARY_SITE_ONLY.config options to be overriden by environment variables with the same names.This is usefull for CI build environments, so primary site can be overridden without .config change. That way download can be speeded up if using mirror servers in the same network as CI.
You can already pass these as make arguments (E.G. make BR2_PRIMARY_SITE=".."). Is there any real reason why that cannot be used by the CI setup instead?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 download: allow for BR2_PRIMARY_SITE(_ONLY) environment override
Hi,
Quoted 5 lines · Peter Korsgaard
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcin" == Marcin Niestroj <[email protected]> writes:
Allow
BR2_PRIMARY_SITEandBR2_PRIMARY_SITE_ONLY.config options to be overriden by environment variables with the same names.
Quoted 8 lines
Quoted 3 lines
This is usefull for CI build environments, so primary site can be overridden without .config change. That way download can be speeded up if using mirror servers in the same network as CI.
You can already pass these as make arguments (E.G. make BR2_PRIMARY_SITE=".."). Is there any real reason why that cannot be used by the CI setup instead?
1. Environment variable allows to set this configuration in a single place, so in case of multiple CI jobs we do not need to modify the "make" step in each one.
2. In case of CI setups that are configured by a file in project git repository (such as gitlab CI) we do not need to hardcode BR2_PRIMARY_SITE there.
3. As a developer I want to have BR2_PRIMARY_SITE set in ~/.bashrc or something similar, so I do not need to issue
"make BR2_PRIMARY_SITE=some_really_long_uri" every time in multiple Buildroot projects / board configurations that I have on my workstation.
Signature · 2 lines
Regards, Marcin Niestroj
PATCH 1/1 download: allow for BR2_PRIMARY_SITE(_ONLY) environment override
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcin" == Marcin Niestroj <[email protected]> writes:
Hi,
Quoted 9 lines · Peter Korsgaard
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcin" == Marcin Niestroj <[email protected]> writes:
Allow
BR2_PRIMARY_SITEandBR2_PRIMARY_SITE_ONLY.config options to be overriden by environment variables with the same names.This is usefull for CI build environments, so primary site can be overridden without .config change. That way download can be speeded up if using mirror servers in the same network as CI.
Quoted 8 lines
Quoted 4 lines
You can already pass these as make arguments (E.G. make BR2_PRIMARY_SITE=".."). Is there any real reason why that cannot be used by the CI setup instead?
1. Environment variable allows to set this configuration in a single place, so in case of multiple CI jobs we do not need to modify the "make" step in each one.
Ok, but this is just a one-time step, right?
Quoted 3 lines
2. In case of CI setups that are configured by a file in project git repository (such as gitlab CI) we do not need to hardcode
BR2_PRIMARY_SITEthere.
You can always do 'make BR2_PRIMARY_SITE="$BR2_PRIMARY_SITE"' to grab the value from the environment instead of hardcoding it.
Quoted 4 lines
3. As a developer I want to have
BR2_PRIMARY_SITEset in ~/.bashrc or something similar, so I do not need to issue
"make BR2_PRIMARY_SITE=some_really_long_uri" every time in multiple Buildroot projects / board configurations that I have on my workstation.
We really try to not add any more magic environment variables affecting the build.
You could always add a brmake shell alias in your ~/.bashrc which passes these arguments.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 download: allow for BR2_PRIMARY_SITE(_ONLY) environment override
Quoted 18 lines · Peter Korsgaard
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcin" == Marcin Niestroj <[email protected]> writes:
Hi,
Quoted 13 lines · Peter Korsgaard
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcin" == Marcin Niestroj <[email protected]> writes:
Allow
BR2_PRIMARY_SITEandBR2_PRIMARY_SITE_ONLY.config options to be overriden by environment variables with the same names.This is usefull for CI build environments, so primary site can be overridden without .config change. That way download can be speeded up if using mirror servers in the same network as CI.
You can already pass these as make arguments (E.G. make BR2_PRIMARY_SITE=".."). Is there any real reason why that cannot be used by the CI setup instead?
Quoted 5 lines
Quoted 3 lines
1. Environment variable allows to set this configuration in a single place, so in case of multiple CI jobs we do not need to modify the "make" step in each one.
Ok, but this is just a one-time step, right?
That is right.
Quoted 7 lines
Quoted 4 lines
2. In case of CI setups that are configured by a file in project git repository (such as gitlab CI) we do not need to hardcode
BR2_PRIMARY_SITEthere.You can always do 'make BR2_PRIMARY_SITE="$BR2_PRIMARY_SITE"' to grab the value from the environment instead of hardcoding it.
Thanks for that hint. It covers the most desirable use case for me.
Quoted 6 lines
Quoted 5 lines
3. As a developer I want to have
BR2_PRIMARY_SITEset in ~/.bashrc or something similar, so I do not need to issue
"make BR2_PRIMARY_SITE=some_really_long_uri" every time in multiple Buildroot projects / board configurations that I have on my workstation.
Quoted 6 lines
We really try to not add any more magic environment variables affecting the build.
You could always add a brmake shell alias in your ~/.bashrc which passes these arguments.
I still think that using environment variable with make command instead of brmake alias is more comfortable for a developer. But I get your point, so I will not insist on this patch :)
Signature · 2 lines
Regards, Marcin Niestroj
PATCH 1/1 download: allow for BR2_PRIMARY_SITE(_ONLY) environment override
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcin" == Marcin Niestroj <[email protected]> writes:
Hi,
Quoted 3 lines
I still think that using environment variable with make command instead of brmake alias is more comfortable for a developer. But I get your point, so I will not insist on this patch :)
I understand. The problem is that it is very difficult to remove features once people start using it, and we try very hard to keep Buildroot (relatively) simple. Part of this is to not have multiple ways of doing the same thing.
Sorry.
Signature · 1 line
Bye, Peter Korsgaard