From: Herman Rimm via Guix-patches via <guix-patches@gnu.org>
To: 73126@debbugs.gnu.org
Subject: [bug#73126] [PATCH] git-download: Add git-origin macro.
Date: Sun, 8 Sep 2024 22:30:24 +0200 [thread overview]
Message-ID: <20240908203024.4762-1-herman@rimm.ee> (raw)
* guix/packages.scm (git-origin-helper, git-origin): Add macros.
---
guix/git-download.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/guix/git-download.scm b/guix/git-download.scm
index ae2073ea06..d32f9a25eb 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -55,6 +55,8 @@ (define-module (guix git-download)
git-reference-commit
git-reference-recursive?
+ git-origin
+
git-fetch
git-fetch/lfs
git-version
@@ -87,6 +89,31 @@ (define (git-lfs-package)
(let ((distro (resolve-interface '(gnu packages version-control))))
(module-ref distro 'git-lfs)))
+(define-syntax git-origin-helper
+ (syntax-rules (commit hash repository)
+ ((_ () (fields ...) c repo)
+ (origin fields ...
+ (method git-fetch)
+ (uri (git-reference (commit c)
+ (url repo)))))
+ ((_ ((commit exp) rest ...) others _ repo)
+ (git-origin-helper (rest ...) others exp repo))
+ ((_ ((hash exp) rest ...) (others ...) c repo)
+ (git-origin-helper
+ (rest ...)
+ (others ... (hash (content-hash (base32 exp) sha256)))
+ c
+ repo))
+ ((_ ((repository exp) rest ...) others c _)
+ (git-origin-helper (rest ...) others c exp))
+ ((_ (field rest ...) (others ...) c repo)
+ (git-origin-helper (rest ...) (others ... field) c repo))))
+
+(define-syntax-rule (git-origin fields ...)
+ "Build an <origin> record, converting the commit and repository field
+specifications to a <git-reference> and hash to a <content-hash>."
+ (git-origin-helper (fields ...) () #f #f))
+
(define (git-fetch-builder git git-lfs git-ref-recursive? hash-algo)
(define inputs
`(,(or git (git-package))
--
2.45.2
next reply other threads:[~2024-09-08 20:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-08 20:30 Herman Rimm via Guix-patches via [this message]
2024-09-16 16:29 ` [bug#73126] [PATCH v2 0/2] Add git-source procedure Herman Rimm via Guix-patches via
2024-09-16 16:29 ` [bug#73126] [PATCH v2 1/2] download: Add git-source Herman Rimm via Guix-patches via
2024-09-16 16:29 ` [bug#73126] [PATCH v2 2/2] gnu: Add inadyn Herman Rimm via Guix-patches via
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240908203024.4762-1-herman@rimm.ee \
--to=guix-patches@gnu.org \
--cc=73126@debbugs.gnu.org \
--cc=herman@rimm.ee \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).