[PATCH] git-download: Add git-origin macro.

  • Open
  • quality assurance status badge
Details
One participant
  • Herman Rimm
Owner
unassigned
Submitted by
Herman Rimm
Severity
normal

Debbugs page

Herman Rimm wrote 6 months ago
(address . guix-patches@gnu.org)
20240908203024.4762-1-herman@rimm.ee
* guix/packages.scm (git-origin-helper, git-origin): Add macros.
---
guix/git-download.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (47 lines)
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
Herman Rimm wrote 6 months ago
[PATCH v2 0/2] Add git-source procedure.
(address . 73126@debbugs.gnu.org)
cover.1726495443.git.herman@rimm.ee
Hi,

A procedure is shorter for sure and so is its invocation, see patch #2.
On the one hand the hash line is close to the version line, but there
are no field names anymore; it may be unclear that a 'version' variable
is used as a 'commit' argument.

I keep a 'host' argument separate from 'author' in case we want to use
symbols for popular hosts or ones that use protocols other than HTTPS.
I could add a version keyword argument, which would be useful for
packages which have their version field generated by git-version.

Cheers,
Herman

Herman Rimm (2):
download: Add git-source.
gnu: Add inadyn.

doc/guix.texi | 7 +++++++
gnu/packages/dns.scm | 27 +++++++++++++++++++++++++--
guix/git-download.scm | 12 +++++++++++-
3 files changed, 43 insertions(+), 3 deletions(-)


base-commit: ee64bcfb796ef36db4b63f79540627fb25f3320a
--
2.45.2
Herman Rimm wrote 6 months ago
[PATCH v2 1/2] download: Add git-source.
(address . 73126@debbugs.gnu.org)
6857a5838688c629dc90efd5fe3769a7d4301223.1726495443.git.herman@rimm.ee
* guix/git-download.scm (git-source): Add and export procedure.
* doc/guix.texi (origin Reference): Document git-source.

Change-Id: I40c24ff10135e4895c5319f969005ba1c09760db
---
doc/guix.texi | 7 +++++++
guix/git-download.scm | 12 +++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)

Toggle diff (48 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index bc4d306c2d..fa64c6a3fc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8248,6 +8248,13 @@ origin Reference
@end lisp
@end deftp
+@deffn {Procedure} git-source hash host author project commit [prefix]
+Return an @code{origin} corresponding to the @var{host}'s repository for
+the @var{author}'s @var{project}. It is checked out at @var{commit},
+with a consistent @var{prefix} used in some repositories. @var{hash} is
+the string for a base32-encoded SHA256 hash used by @code{git-fetch}.
+@end deffn
+
For Mercurial repositories, the module @code{(guix hg-download)} defines
the @code{hg-fetch} origin method and @code{hg-reference} data type for
support of the Mercurial version control system.
diff --git a/guix/git-download.scm b/guix/git-download.scm
index ae2073ea06..6de53fec70 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -59,7 +59,8 @@ (define-module (guix git-download)
git-fetch/lfs
git-version
git-file-name
- git-predicate))
+ git-predicate
+ git-source))
;;; Commentary:
;;;
@@ -395,4 +396,13 @@ (define* (git-predicate directory #:key (recursive? #t))
(#f #f)))))
(const #f)))
+(define* (git-source hash host author project commit #:optional prefix)
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url (string-join (list "https:/" host author project) "/"))
+ (commit (if prefix (string-append prefix commit) commit))))
+ (file-name (git-file-name project commit))
+ (hash (content-hash (base32 hash) sha256))))
+
;;; git-download.scm ends here
--
2.45.2
Herman Rimm wrote 6 months ago
[PATCH v2 2/2] gnu: Add inadyn.
(address . 73126@debbugs.gnu.org)
a9d1eb9573e41f5fb38246494ef5eb456be5513b.1726495443.git.herman@rimm.ee
* gnu/packages/dns.scm (inadyn): Add variable.
(unbound): Remove trailing whitespace.

Change-Id: I47ba0f6c3537b963623011d1862aa4abf528b53b
---
gnu/packages/dns.scm | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)

Toggle diff (68 lines)
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index ffc8eda6bb..52e5103603 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -22,6 +22,7 @@
;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space>
;;; Copyright © 2024 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -78,6 +79,7 @@ (define-module (gnu packages dns)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages swig)
#:use-module (gnu packages texinfo)
+ #:use-module (gnu packages textutils)
#:use-module (gnu packages tls)
#:use-module (gnu packages web)
#:use-module (gnu packages xml)
@@ -714,7 +716,7 @@ (define-public unbound
p->p_name = \"udp\";
p->p_proto = 17;
p->p_aliases[0] = \"UDP\";
- } else
+ } else
p = NULL;
return p;
}
@@ -750,7 +752,7 @@ (define-public unbound
s->s_name = \"domain\";
s->s_port = htons(53);
s->s_proto = buf;
- } else
+ } else
s = NULL;
return s;
}
@@ -790,6 +792,27 @@ (define-public unbound
served by AS112. Stub and forward zones are supported.")
(license license:bsd-4)))
+(define-public inadyn
+ (package
+ (name "inadyn")
+ (version "2.12.0")
+ (source (git-source
+ "1a9i9ayxcvgcvj1b68wl9mkgrzp9a42w2rcgbmsp2s03ffvcj0b9"
+ "github.com" "troglobit" name version "v"))
+ (build-system gnu-build-system)
+ (arguments '(#:configure-flags (list "--localstatedir=/var")))
+ (inputs (list libconfuse gnutls))
+ (native-inputs (list autoconf automake libtool pkg-config))
+ (home-page "https://troglobit.com/projects/inadyn")
+ (synopsis "Dynamic DNS (DDNS) client with HTTPS support")
+ (description
+ "In-a-Dyn is a small and simple Dynamic DNS (DDNS) client with
+HTTPS support. DDNS is used in off-the-shelf routers and Internet
+gateways to automate the task of keeping your DNS record up to date with
+any IP address changes from your ISP. DDNS can also be used in
+installations with redundant (backup) connections to the Internet.")
+ (license license:gpl2)))
+
(define-public yadifa
(package
(name "yadifa")
--
2.45.2
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73126@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73126
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help