From: James Knight <git@jdknight.me>
To: buildroot@buildroot.org
Cc: James Knight <git@jdknight.me>
Subject: [Buildroot] [PATCH 1/1] package: add support for <pkg>_SITE_ONLY
Date: Wed, 19 Mar 2025 00:39:35 -0400 [thread overview]
Message-ID: <20250319043935.7756-1-git@jdknight.me> (raw)
This will allow individual packages to hint that sources for the package
should only ever be downloaded from the specified `<pkg>_SITE` location.
Can be useful to avoid hitting configured cache sites when it is known
that a package would only ever be available from the package's site.
Signed-off-by: James Knight <git@jdknight.me>
---
docs/manual/adding-packages-generic.adoc | 6 ++++++
package/pkg-download.mk | 17 ++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/docs/manual/adding-packages-generic.adoc b/docs/manual/adding-packages-generic.adoc
index f0b0508f537d4a0329b48e2f8696ca43b098f1f2..35bd05e790520b92462e7acfb47472d44f5de792 100644
--- a/docs/manual/adding-packages-generic.adoc
+++ b/docs/manual/adding-packages-generic.adoc
@@ -336,6 +336,12 @@ not and can not work as people would expect it should:
still patch the source code, use +LIBFOO_POST_RSYNC_HOOKS+, see
xref:hooks-rsync[].
+* +LIBFOO_SITE_ONLY+ can be set to +YES+ to indicate that the package
+ should only be attempted to be downloaded from the configured site
+ defined by +LIBFOO_SITE+. Useful to avoid hitting configured cache
+ sites when it is known that the package would only ever be available
+ from the package's site.
+
* +LIBFOO_GIT_SUBMODULES+ can be set to +YES+ to create an archive
with the git submodules in the repository. This is only available
for packages downloaded with git (i.e. when
diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index cf5959ea95549c896fd0837faf43f8e09f88b167..9b8ed92e9d3fb036aae6b84825cd2410337bf34d 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -59,6 +59,15 @@ gitlab = https://gitlab.com/$(1)/$(2)/-/archive/$(3)
# Expressly do not check hashes for those files
BR_NO_CHECK_HASH_FOR =
+################################################################################
+# DOWNLOAD_DEFAULT_URI - Default download site to get a package from.
+#
+# Argument 1 is the source location
+#
+################################################################################
+
+DOWNLOAD_DEFAULT_URI = $(patsubst %/,%,$(dir $(call qstrip,$(1))))
+
################################################################################
# DOWNLOAD_URIS - List the candidates URIs where to get the package from:
# 1) BR2_PRIMARY_SITE if enabled
@@ -77,8 +86,7 @@ DOWNLOAD_URIS += \
endif
ifeq ($(BR2_PRIMARY_SITE_ONLY),)
-DOWNLOAD_URIS += \
- $(patsubst %/,%,$(dir $(call qstrip,$(1))))
+DOWNLOAD_URIS += $(DOWNLOAD_DEFAULT_URI)
ifneq ($(call qstrip,$(BR2_BACKUP_SITE)),)
DOWNLOAD_URIS += \
$(call getschemeplusuri,$(call qstrip,$(BR2_BACKUP_SITE)/$($(2)_DL_SUBDIR)),urlencode) \
@@ -129,7 +137,10 @@ define DOWNLOAD
$(if $(filter YES,$($(PKG)_SVN_EXTERNALS)),-r) \
$(if $($(PKG)_GIT_SUBMODULES),-r) \
$(if $($(PKG)_GIT_LFS),-l) \
- $(foreach uri,$(call DOWNLOAD_URIS,$(1),$(PKG)),-u $(uri)) \
+ $(if $($(PKG)_SITE_ONLY), \
+ $(DOWNLOAD_DEFAULT_URI), \
+ $(foreach uri,$(call DOWNLOAD_URIS,$(1),$(PKG)),-u $(uri)) \
+ ) \
$(2) \
$(QUIET) \
-- \
--
2.48.1.windows.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next reply other threads:[~2025-03-19 4:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 4:39 James Knight [this message]
2025-03-25 20:15 ` [Buildroot] [PATCH 1/1] package: add support for <pkg>_SITE_ONLY Arnout Vandecappelle via buildroot
2025-03-25 20:19 ` Arnout Vandecappelle via buildroot
2025-09-25 5:33 ` James Knight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250319043935.7756-1-git@jdknight.me \
--to=git@jdknight.me \
--cc=buildroot@buildroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.