unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: "Ludovic Courtès" <ludo@gnu.org>,
	"Arun Isaac" <arunisaac@systemreboot.net>
Cc: 42212@debbugs.gnu.org
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	[thread overview]
Message-ID: <20200727231332.10489-2-arunisaac@systemreboot.net> (raw)
In-Reply-To: <87ft9mqsd2.fsf@gnu.org>

* 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





      parent reply	other threads:[~2020-07-27 23:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-05  7:59 bug#42212: Guix version rendered as 0.0-git in info manual Arun Isaac
2020-07-09 22:29 ` Ludovic Courtès
2020-07-15 21:42   ` Arun Isaac
2020-07-15 23:26     ` Ludovic Courtès
2020-07-16  0:46     ` Bengt Richter
2020-07-16  5:08       ` Bengt Richter
2020-07-16 10:06       ` zimoun
2020-07-16  9:37   ` zimoun
2020-07-16  9:48     ` Ludovic Courtès
2020-07-16 10:19       ` zimoun
2020-07-16 19:36   ` Efraim Flashner
2020-07-17 23:55     ` bug#42212: [PATCH 0/1] Use nearest tag as the version string in documentation Arun Isaac
2020-07-17 23:55     ` bug#42212: [PATCH 1/1] self: " Arun Isaac
2020-07-20  8:13       ` Ludovic Courtès
2020-07-20  8:36         ` Arun Isaac
2020-07-20 12:32           ` Ludovic Courtès
2020-07-20 13:42             ` zimoun
2020-07-27 23:13             ` bug#42212: [PATCH v2 0/1] " Arun Isaac
2020-07-27 23:13             ` Arun Isaac [this message]

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=20200727231332.10489-2-arunisaac@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=42212@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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).