all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: "Efraim Flashner" <efraim@flashner.co.il>,
	"Ludovic Courtès" <ludo@gnu.org>
Cc: 42212@debbugs.gnu.org
Subject: bug#42212: [PATCH 1/1] self: Use nearest tag as the version string in documentation.
Date: Sat, 18 Jul 2020 05:25:03 +0530	[thread overview]
Message-ID: <20200717235503.19809-2-arunisaac@systemreboot.net> (raw)
In-Reply-To: <20200716193629.GJ10256@E5400>

* 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@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.
 ;;;
@@ -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@gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@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





  parent reply	other threads:[~2020-07-17 23:56 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     ` Arun Isaac [this message]
2020-07-20  8:13       ` bug#42212: [PATCH 1/1] self: " 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             ` bug#42212: [PATCH v2 1/1] " Arun Isaac

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200717235503.19809-2-arunisaac@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=42212@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.