GNU bug report logs - #73126
[PATCH] git-download: Add git-origin macro.

Previous Next

Package: guix-patches;

Reported by: Herman Rimm <herman <at> rimm.ee>

Date: Sun, 8 Sep 2024 20:34:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 73126 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#73126; Package guix-patches. (Sun, 08 Sep 2024 20:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Herman Rimm <herman <at> rimm.ee>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 08 Sep 2024 20:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: guix-patches <at> gnu.org
Subject: [PATCH] git-download: Add git-origin macro.
Date: Sun,  8 Sep 2024 22:30:24 +0200
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#73126; Package guix-patches. (Mon, 16 Sep 2024 16:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 73126 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 73126 <at> debbugs.gnu.org
Subject: [PATCH v2 0/2] Add git-source procedure.
Date: Mon, 16 Sep 2024 18:29:56 +0200
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





Information forwarded to guix <at> cbaines.net, pelzflorian <at> pelzflorian.de, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, maxim.cournoyer <at> gmail.com, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#73126; Package guix-patches. (Mon, 16 Sep 2024 16:32:02 GMT) Full text and rfc822 format available.

Message #11 received at 73126 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 73126 <at> debbugs.gnu.org
Subject: [PATCH v2 1/2] download: Add git-source.
Date: Mon, 16 Sep 2024 18:29:57 +0200
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#73126; Package guix-patches. (Mon, 16 Sep 2024 16:32:03 GMT) Full text and rfc822 format available.

Message #14 received at 73126 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 73126 <at> debbugs.gnu.org
Subject: [PATCH v2 2/2] gnu: Add inadyn.
Date: Mon, 16 Sep 2024 18:29:58 +0200
* 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(-)

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 <at> makinata.eu>
 ;;; Copyright © 2023 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2024 John Kehayias <john.kehayias <at> protonmail.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> 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





This bug report was last modified 271 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.