From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UIMWDJ06El+fcwAA0tVLHw (envelope-from ) for ; Fri, 17 Jul 2020 23:56:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yGzwB506El+WeAAAB5/wlQ (envelope-from ) for ; Fri, 17 Jul 2020 23:56:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 30E219404D3 for ; Fri, 17 Jul 2020 23:56:12 +0000 (UTC) Received: from localhost ([::1]:52314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwaD4-0003ok-EM for larch@yhetil.org; Fri, 17 Jul 2020 19:56:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwaCw-0003oD-7W for bug-guix@gnu.org; Fri, 17 Jul 2020 19:56:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jwaCv-0001bo-Vg for bug-guix@gnu.org; Fri, 17 Jul 2020 19:56:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jwaCv-0001Wa-VB for bug-guix@gnu.org; Fri, 17 Jul 2020 19:56:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#42212: [PATCH 1/1] self: Use nearest tag as the version string in documentation. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 17 Jul 2020 23:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42212 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Efraim Flashner , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 42212-submit@debbugs.gnu.org id=B42212.15950301335808 (code B ref 42212); Fri, 17 Jul 2020 23:56:01 +0000 Received: (at 42212) by debbugs.gnu.org; 17 Jul 2020 23:55:33 +0000 Received: from localhost ([127.0.0.1]:58156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jwaCT-0001Vc-94 for submit@debbugs.gnu.org; Fri, 17 Jul 2020 19:55:33 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:37722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jwaCO-0001VK-6T for 42212@debbugs.gnu.org; Fri, 17 Jul 2020 19:55:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YiahTTMyvoQAmXRSYEFUDbN2r+1R2QrtQ5g9kzCRKL0=; b=nj8Fe6oQnGyQvSyFdr1Vd2lGC4 E6LZp7d6VmV2sA/dM8cCxCxBSgiqlTZQn0Z+TArtsPcnQ+ulKVy+NfQwqc7m8hIyL+Shp6aPcJzie P7OxZqANMLZW6Bz+Oeoe3g7yBs80lcM7mD8X6Uh2Hy1T+CrzcLNcxgSEiY2Dn5J+5i9g=; Received: from [192.168.2.1] (helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1jwaC2-0015Vr-09; Sat, 18 Jul 2020 05:25:06 +0530 From: Arun Isaac Date: Sat, 18 Jul 2020 05:25:03 +0530 Message-Id: <20200717235503.19809-2-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200716193629.GJ10256@E5400> References: <20200716193629.GJ10256@E5400> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 42212@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=systemreboot.net header.s=default header.b=nj8Fe6oQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=systemreboot.net (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 1.09 X-TUID: t8foObVBq8Ld * 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 ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2020 Arun Isaac ;;; ;;; 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 +;;; Copyright © 2020 Arun Isaac ;;; ;;; 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