[Buildroot] [PATCH 2/7] package/pkg-download: add 'owner' macro
Thomas Perale
thomas.perale at mind.be
Tue Apr 15 19:55:35 UTC 2025
This patch introduces the 'owner' macro that retrieve the repository
owner part of an URL.
This macro works for repositories that share the URL scheme of website
such as Github or Gitlab:
```
https://{github|gitlab}.com/<owner>/<name>/....
```
The macro will retrieve the 'owner' part of
the url.
For example with the 'mender' package version '3.5.3'. The `MENDER_SITE`
variable value is the following.
```
MENDER_SITE=https://github.com/mendersoftware/mender/archive/3.5.3
```
Calling the 'owner' macro will retrieve the following.
```
$(call owner,$(MENDER_SITE)) # mendersoftware
```
Signed-off-by: Thomas Perale <thomas.perale at mind.be>
---
package/pkg-download.mk | 3 +++
1 file changed, 3 insertions(+)
diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index cf5959ea95..3c946a3f69 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -49,6 +49,9 @@ notdomain = $(patsubst $(call domain,$(1),$(2))$(call domainseparator,$(2))%,%,$
#
# default domainseparator is /, specify alternative value as first argument
domainseparator = $(if $(1),$(1),/)
+# Retrieve the repository owner from an url
+# owner: {github,gitlab}.com/<owner>/...
+owner = $(firstword $(subst /, ,$(call notdomain,$(1))))
# github(user,package,version): returns site of GitHub repository
github = https://github.com/$(1)/$(2)/archive/$(3)
--
2.49.0
More information about the buildroot
mailing list