Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Perale via buildroot <buildroot@buildroot.org>
To: buildroot@buildroot.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Thomas Perale <thomas.perale@mind.be>,
	Christian Stewart <christian@aperture.us>,
	Arnout Vandecappelle <arnout@rnout.be>
Subject: [Buildroot] [PATCH 2/7] package/pkg-download: add repository macro
Date: Tue, 15 Apr 2025 21:55:36 +0200	[thread overview]
Message-ID: <20250415195547.199428-4-thomas.perale@mind.be> (raw)
In-Reply-To: <20250415195547.199428-1-thomas.perale@mind.be>

This patch introduces the 'repository' macro that retrieve the repository
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 '{github|gitlab}.com/<owner>/<name>' part of
the url.
This macro will works as well for the `<pkg>_SITE` variable made with
the `github` & `gitlab` macros.

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 'repository' macro will retrieve the following.

```
$(call repository,$(MENDER_SITE)) # github.com/mendersoftware/mender
```

Signed-off-by: Thomas Perale <thomas.perale@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..4a2561cf86 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 from an url
+# repository: {github,gitlab}.com/<owner>/<name>
+repository = $(call domain,$(1))/$(word 1,$(subst /, ,$(call notdomain,$(1))))/$(word 2,$(subst /, ,$(call notdomain,$(1))))
 
 # github(user,package,version): returns site of GitHub repository
 github = https://github.com/$(1)/$(2)/archive/$(3)
-- 
2.49.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2025-04-15 19:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 19:55 [Buildroot] [PATCH 0/7] Add PURL support Thomas Perale via buildroot
2025-04-15 19:55 ` [Buildroot] [PATCH 1/7] package/pkg-generic.mk: add PURL package variable Thomas Perale via buildroot
2025-04-15 19:55 ` [Buildroot] [PATCH 2/7] package/pkg-download: add 'owner' macro Thomas Perale via buildroot
2025-04-15 19:55 ` Thomas Perale via buildroot [this message]
2025-04-15 19:55 ` [Buildroot] [PATCH 3/7] package/pkg-golang: support PURL generation Thomas Perale via buildroot
2025-04-15 19:55 ` [Buildroot] [PATCH 4/7] package/pkg-cargo: " Thomas Perale via buildroot
2025-04-15 19:55 ` [Buildroot] [PATCH 5/7] package/pkg-perl: " Thomas Perale via buildroot
2025-04-15 19:55 ` [Buildroot] [PATCH 6/7] package/pkg-python: " Thomas Perale via buildroot
2025-04-15 19:55 ` [Buildroot] [PATCH 7/7] package/pkg-utils: add PURL to show-info output Thomas Perale via buildroot
2025-04-16 19:07 ` [Buildroot] [PATCH 0/7] Add PURL support Peter Korsgaard
2025-04-16 19:19   ` Arnout Vandecappelle via buildroot
     [not found]     ` <4b029329-2258-428d-80c9-315dbd6335be@essensium.com>
2025-04-16 19:58       ` Thomas Petazzoni via buildroot
2025-04-16 20:06         ` Thomas Perale via buildroot
2025-04-16 20:40           ` Thomas Petazzoni via buildroot
2025-04-16 20:49             ` Thomas Perale via buildroot
2025-04-18 10:39               ` Thomas Petazzoni via buildroot
2025-04-21 20:19                 ` Thomas Perale via buildroot
2025-04-22 12:53                   ` Thomas Petazzoni via buildroot
2025-04-22 14:00                     ` Peter Korsgaard

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=20250415195547.199428-4-thomas.perale@mind.be \
    --to=buildroot@buildroot.org \
    --cc=arnout@rnout.be \
    --cc=christian@aperture.us \
    --cc=thomas.perale@mind.be \
    --cc=thomas.petazzoni@bootlin.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox