bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42212: [PATCH v2 1/1] Use nearest tag as the version string in docum


From: Arun Isaac
Subject: bug#42212: [PATCH v2 1/1] Use nearest tag as the version string in documentation.
Date: Tue, 28 Jul 2020 04:43:31 +0530

* guix/channels.scm (latest-channel-instance): Write nearest tag into .version
of the checkout.
* guix/self.scm (info-manual): Use nearest tag from .version as the version
string while generating documentation.
---
 guix/channels.scm | 13 ++++++++++++-
 guix/self.scm     | 10 ++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index ad2442f50e..e8941bb28e 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -393,7 +394,17 @@ thus potentially malicious code."))))))))
     (when (guix-channel? channel)
       ;; Apply the relevant subset of PATCHES directly in CHECKOUT.  This is
       ;; safe to do because 'switch-to-ref' eventually does a hard reset.
-      (apply-patches checkout commit patches))
+      (apply-patches checkout commit patches)
+
+      ;; Write into .version, the nearest tag without the "v" prefix.
+      (call-with-output-file (string-append checkout "/.version")
+        (lambda (port)
+          (display (substring
+                    (describe-format
+                     (describe-workdir (repository-open checkout))
+                     (make-describe-format-options #:abbreviated-size 0))
+                    1)
+                   port))))
 
     (let* ((name     (url+commit->name (channel-url channel) commit))
            (checkout (add-to-store store name #t "sha256" checkout
diff --git a/guix/self.scm b/guix/self.scm
index f70b1ecdd8..58ca4386f1 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -459,16 +460,17 @@ a list of extra files, such as '(\"contributing\")."
     (with-imported-modules '((guix build utils))
       #~(begin
           (use-modules (guix build utils)
+                       (rnrs io ports)
                        (ice-9 match))
 
           (mkdir #$output)
 
-          ;; Create 'version.texi'.
-          ;; XXX: Can we use a more meaningful version string yet one that
-          ;; doesn't change at each commit?
+          ;; Create 'version.texi'. Use nearest tag written in .version as the
+          ;; version string.
           (call-with-output-file "version.texi"
             (lambda (port)
-              (let ((version "0.0-git"))
+              (let* ((version (call-with-input-file (string-append #$source 
"/.version")
+                                get-string-all)))
                 (format port "
 @set UPDATED 1 January 1970
 @set UPDATED-MONTH January 1970
-- 
2.26.2






reply via email to

[Prev in Thread] Current Thread [Next in Thread]