Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] core: add BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS
@ 2020-12-04 12:33 Thomas De Schampheleire
  2020-12-04 12:33 ` [Buildroot] [PATCH 2/2] utils/source-check: new script Thomas De Schampheleire
  2021-01-02 22:07 ` [Buildroot] [PATCH 1/2] core: add BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS Yann E. MORIN
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas De Schampheleire @ 2020-12-04 12:33 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

If configured, the primary site typically points to a mirror on the intranet
of an organization. The purpose of BR2_PRIMARY_SITE_ONLY is then to only
download from this mirror.

However, the organization may also have some local Buildroot packages
that download from a version control repository (git, hg, ...). In this case,
the mirror will normally not contain the sources, instead they should be
cloned via the version control tool. So in this case, BR2_PRIMARY_SITE_ONLY
cannot be used.

This means that the organization must resort to other means to make sure no
external downloads are performed.

This patch attempts to solve this situation by adding
BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS. This string option can contain
additional domains from which download is allowed when BR2_PRIMARY_SITE_ONLY
is set.

The organization can thus set:
BR2_PRIMARY_SITE_ONLY=y
BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS="git.example.com hg.example.com"

to disallow any external downloads other than the primary site and the
mentioned version control domains.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 Config.in               | 12 ++++++++++++
 package/pkg-download.mk |  8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/Config.in b/Config.in
index e35a78fb71..c9206876ff 100644
--- a/Config.in
+++ b/Config.in
@@ -231,6 +231,18 @@ config BR2_PRIMARY_SITE_ONLY
 	  the project can be built even if the upstream tarball
 	  locations disappear.
 
+config BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS
+	string "Additional domains to allow downloads from"
+	depends on BR2_PRIMARY_SITE_ONLY
+	help
+	  If BR2_PRIMARY_SITE_ONLY is enabled, version control downloads
+	  (git, hg, ...) on the 'internal' domain would also be
+	  disallowed.
+	  With this option, you can specify additional domains from
+	  which downloads will be allowed in BR2_PRIMARY_SITE_ONLY-mode.
+	  Domains should not include a protocol prefix, and multiple
+	  domains can be separated by spaces.
+
 if !BR2_PRIMARY_SITE_ONLY
 
 config BR2_BACKUP_SITE
diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index 951d2fb554..d23838a329 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -78,7 +78,13 @@ DOWNLOAD_URIS += \
 	$(call getschemeplusuri,$(call qstrip,$(BR2_PRIMARY_SITE)),urlencode)
 endif
 
-ifeq ($(BR2_PRIMARY_SITE_ONLY),)
+ifeq ($(BR2_PRIMARY_SITE_ONLY),y)
+# Conditionally add site download if it matches the configured extended domains
+DOWNLOAD_URIS += \
+	$(if $(filter $(call qstrip,$(BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS)),$(call domain,$(1))), \
+		$(patsubst %/,%,$(dir $(call qstrip,$(1)))))
+else
+# Unconditionally add site download
 DOWNLOAD_URIS += \
 	$(patsubst %/,%,$(dir $(call qstrip,$(1))))
 ifneq ($(call qstrip,$(BR2_BACKUP_SITE)),)
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 0/2] Add utils/source-check
@ 2020-05-04 11:15 Thomas De Schampheleire
  2020-05-04 11:15 ` [Buildroot] [PATCH 2/2] utils/source-check: new script Thomas De Schampheleire
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas De Schampheleire @ 2020-05-04 11:15 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Hello,

Buildroot used to have a 'make source-check' command, which was later removed.
Nevertheless, for organizations that use a download mirror and want to
efficiently check that all needed files are present without actually
downloading, an equivalent is still useful.

After the addition of the 'show-info' target, this is now possible without
polluting the core Buildroot infrastructure.

The script is a 'utility', it is not used automatically, just present for the
benefit of users.

Note: as mentioned in the commit msg, the current script only covers scp and hg
downloads, my needs. It could be extended to cover git etc., but it may not be
possible to check remotely if a git revision exists on a repository. So for
these additional download methods, it may be needed to perform an actual clone?


Patch 1 adds BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS and is useful independently
from source-check. It addresses the problem where BR2_PRIMARY_SITE_ONLY cannot
be used if you also have packages under version control.

Patch 2 adds the source-check script.



Best regards,
Thomas

Thomas De Schampheleire (2):
  core: add BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS
  utils/source-check: new script

 Config.in               |  11 +++
 package/pkg-download.mk |   8 +-
 utils/source-check      | 170 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+), 1 deletion(-)
 create mode 100755 utils/source-check

-- 
2.26.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-15 10:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-04 12:33 [Buildroot] [PATCH 1/2] core: add BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS Thomas De Schampheleire
2020-12-04 12:33 ` [Buildroot] [PATCH 2/2] utils/source-check: new script Thomas De Schampheleire
2021-01-02 22:56   ` Yann E. MORIN
2021-01-15 10:55     ` Thomas De Schampheleire
2021-01-02 22:07 ` [Buildroot] [PATCH 1/2] core: add BR2_PRIMARY_SITE_ONLY_EXTENDED_DOMAINS Yann E. MORIN
2021-01-15 10:27   ` Thomas De Schampheleire
  -- strict thread matches above, loose matches on Subject: below --
2020-05-04 11:15 [Buildroot] [PATCH 0/2] Add utils/source-check Thomas De Schampheleire
2020-05-04 11:15 ` [Buildroot] [PATCH 2/2] utils/source-check: new script Thomas De Schampheleire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox