GNU bug report logs - #42212
Guix version rendered as 0.0-git in info manual

Previous Next

Package: guix;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Sun, 5 Jul 2020 08:00:02 UTC

Severity: normal

Full log


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

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Efraim Flashner <efraim <at> flashner.co.il>,
 Ludovic Courtès <ludo <at> gnu.org>
Cc: Arun Isaac <arunisaac <at> systemreboot.net>, Bengt Richter <bokr <at> bokr.com>,
 42212 <at> debbugs.gnu.org, zimoun <zimon.toutoune <at> gmail.com>
Subject: [PATCH 1/1] self: Use nearest tag as the version string in
 documentation.
Date: Sat, 18 Jul 2020 05:25:03 +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 | 15 ++++++++++++++-
 guix/self.scm     | 11 +++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index bbabf654a9..d35cbc42cf 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,6 +41,7 @@
   #:use-module (guix sets)
   #:use-module (guix store)
   #:use-module (guix i18n)
+  #:use-module (guix build utils)
   #:use-module ((guix utils)
                 #:select (source-properties->location
                           &error-location
@@ -56,9 +58,11 @@
   #:autoload   (guix quirks) (%quirks %patches applicable-patch? apply-patch)
   #:use-module (ice-9 format)
   #:use-module (ice-9 match)
+  #:use-module (ice-9 popen)
   #:use-module (ice-9 vlist)
   #:use-module ((ice-9 rdelim) #:select (read-string))
   #:use-module ((rnrs bytevectors) #:select (bytevector=?))
+  #:use-module (rnrs io ports)
   #:export (channel
             channel?
             channel-name
@@ -397,7 +401,16 @@ 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 nearest tag into .version.
+      (with-directory-excursion checkout
+        (let ((version
+               (call-with-port
+                (open-pipe* OPEN_READ "./build-aux/git-version-gen" ".tarball-version")
+                get-string-all)))
+          (call-with-output-file ".version"
+            (cut put-string <> version)))))
 
     (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..8c94efa7de 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 <at> gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -459,16 +460,18 @@ 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* ((tag (call-with-input-file (string-append #$source "/.version")
+                            get-string-all))
+                     (version (substring tag 0 (string-index-right tag #\.))))
                 (format port "
 @set UPDATED 1 January 1970
 @set UPDATED-MONTH January 1970
-- 
2.26.2





This bug report was last modified 5 years and 26 days ago.

Previous Next


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