GNU bug report logs - #48852
[PATCH] hg-download: Add helpers for defining packages.

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Sat, 5 Jun 2021 20:04:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48852 in the body.
You can then email your comments to 48852 AT debbugs.gnu.org in the normal way.

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#48852; Package guix-patches. (Sat, 05 Jun 2021 20:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xinglu Chen <public <at> yoctocell.xyz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 05 Jun 2021 20:04:01 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH] hg-download: Add helpers for defining packages.
Date: Sat, 05 Jun 2021 21:18:26 +0200
Hg followup to commit ee17a9e06e636400e3354796a42ac445dbcc8f96.

* hg-download.scm (hg-version, hg-file-name): New procedures.
---
 guix/hg-download.scm | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/guix/hg-download.scm b/guix/hg-download.scm
index c6cee2dbb8..9f23e4c40d 100644
--- a/guix/hg-download.scm
+++ b/guix/hg-download.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,7 +35,9 @@
             hg-reference-changeset
             hg-reference-recursive?
             hg-predicate
-            hg-fetch))
+            hg-fetch
+            hg-version
+            hg-file-name))
 
 ;;; Commentary:
 ;;;
@@ -102,6 +105,23 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
                       #:recursive? #t
                       #:guile-for-build guile)))
 
+(define (hg-version version revision changeset)
+  "Return the version string for packages using hg-download."
+  ;; hg-version is almost exclusively executed while modules are being loaded.
+  ;; This makes any errors hide their backtrace. Avoid the mysterious error
+  ;; "Value out of range 0 to N: 7" when the commit ID is too short, which
+  ;; can happen, for example, when the user swapped the revision and commit
+  ;; arguments by mistake.
+  (when (< (string-length changeset) 7)
+    (raise
+     (condition
+      (&message (message "hg-version: changeset ID unexpectedly short")))))
+  (string-append version "-" revision "." (string-take changeset 7)))
+
+(define (hg-file-name name version)
+  "Return the file-name for packages using hg-download."
+  (string-append name "-" version "-checkout"))
+
 (define (hg-file-list directory)
   "Evaluates to a list of files contained in the repository at path
   @var{directory}"

base-commit: 9da90938c63208b7721276f8cefcdac82ba765f2
-- 
2.31.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 05 Jun 2021 21:14:01 GMT) Full text and rfc822 format available.

Notification sent to Xinglu Chen <public <at> yoctocell.xyz>:
bug acknowledged by developer. (Sat, 05 Jun 2021 21:14:01 GMT) Full text and rfc822 format available.

Message #10 received at 48852-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 48852-done <at> debbugs.gnu.org
Subject: Re: bug#48852: [PATCH] hg-download: Add helpers for defining packages.
Date: Sat, 05 Jun 2021 23:13:26 +0200
Hi,

Xinglu Chen <public <at> yoctocell.xyz> skribis:

> Hg followup to commit ee17a9e06e636400e3354796a42ac445dbcc8f96.
>
> * hg-download.scm (hg-version, hg-file-name): New procedures.

Applied, thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#48852; Package guix-patches. (Sat, 05 Jun 2021 21:18:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 48852 <at> debbugs.gnu.org
Subject: Re: bug#48852: [PATCH] hg-download: Add helpers for defining packages.
Date: Sat, 05 Jun 2021 23:17:18 +0200
I added the missing srfi-3[45] imports too.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 04 Jul 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 267 days ago.

Previous Next


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