From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id uDlbNageIGZwogAA62LTzQ:P1 (envelope-from ) for ; Wed, 17 Apr 2024 21:10:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id uDlbNageIGZwogAA62LTzQ (envelope-from ) for ; Wed, 17 Apr 2024 21:10:32 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=shxH5dL2; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713381032; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=BANWt6jXRsZNK+PN5l1TDnNkhGoPib4fDKVjOIdwMI4=; b=StshVV8wHmfe5hu/cF5mtzxtWG69AoznSUgom03SpPsHiH7Gxc0qGAamKo+JI/22Cb6Owk uFmrAp0kz+EWyCd2uc1iznrKOCjBV1hGClwGph5YZPLp/O2Ox6XXOdva/98RxJQuzLFRxv WIdVDba7tGX82QnK1lX6wAJkSwQ9Br2DNbfDEKritsd/DUFhznMrmD44e56P1pNNR3x1fO KhleKPYhy0dtKkTow6fQqsbcdsZFEDIHcQO9afVJcI4Yy8fUGUcoolngBZS7FtaDy7SsYp MmOG/jlMTeQeOp3h3aPjSFUdQ+I1RzRCv63VIzkntfXSiJAWPGHqdlL/TD1oGg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=shxH5dL2; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713381032; a=rsa-sha256; cv=none; b=UcHPP1f66HYYAltw2I+Sz6y7MQMv0cqp7IP0EkVzGp/3KzuMXd7PsfNWRx/Z0slXsnqd7Z NKx2oxDMkcM2CzU1HsQOqgfYsERPGPtDxnQ1z6+bkm1ns7aiIfGHayF0udxyhjX6Ovd4Eh l5Gkg8hw8JGNNpMmksLshCegXq/rmnRAaSNLgsVwPUW0nVLa/mHEr3WSZfQisqwMI9BSvd 5UUWHPTfwEaMqiW4aC5EYZM9eKciEkOpVrjolpHYx/I/1S5oC6SE+G2TfKnyzzS4txZmT0 sUQqDlPH1XSE8A/+3H09K10exBJTzEtfR8JGMH7Go40wDh8oVlK+jJsItixSsg== 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 9146A67909 for ; Wed, 17 Apr 2024 21:10:32 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxAfM-0002xr-8A; Wed, 17 Apr 2024 15:09:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxAfK-0002vl-Cd for guix-patches@gnu.org; Wed, 17 Apr 2024 15:09:54 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rxAfK-0003KR-3x for guix-patches@gnu.org; Wed, 17 Apr 2024 15:09:54 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxAfX-0000bA-4Z for guix-patches@gnu.org; Wed, 17 Apr 2024 15:10:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70380] [PATCH v4 4/6] maint: Generate doc/version[-LANG].texi using `mdate-from-git.scm'. Resent-From: Janneke Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Apr 2024 19:10:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70380 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70380@debbugs.gnu.org Received: via spool by 70380-submit@debbugs.gnu.org id=B70380.17133809772013 (code B ref 70380); Wed, 17 Apr 2024 19:10:07 +0000 Received: (at 70380) by debbugs.gnu.org; 17 Apr 2024 19:09:37 +0000 Received: from localhost ([127.0.0.1]:47612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxAf1-0000WA-99 for submit@debbugs.gnu.org; Wed, 17 Apr 2024 15:09:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxAek-0000Sz-ND for 70380@debbugs.gnu.org; Wed, 17 Apr 2024 15:09:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxAeS-0003C2-CW; Wed, 17 Apr 2024 15:09:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=pAj9hpVaz0gWAXN0wOF4Rx0ljjBYCgHbvitdhERiSUY=; b=shxH5dL2ncNeIFJNcQ8L szJGuhGdp+gVrnGyWBv51Zp63KXruhMp/IShoWWFgFOpyPGPUb+MNrsEpjJsKdRnYbq3II4/YxhNO i5GHpkLSt++cHon5VQgt9DqyEc2YN3GQyNUbq4KyJ9GPHacPmnqkt7MvArSN3CxzcO8HkNrCOCBuf VMu2IlFwIu56pgl9VmA0qCiaZXJRenY02Cx9LV+M0USmm5nEwSwdkX7p9ofwKo6AjQsUHF4Im4VC4 ymhsJRZkxYqj+JvA3wEDRemNVy0tw/GApoZh1SZAW+8aCWozXIV88SflJwpw5VlCczOZX//jz8VJM PUN/Fty1SiDu8Q==; From: Janneke Nieuwenhuizen Date: Wed, 17 Apr 2024 21:08:48 +0200 Message-ID: <5ab984e73310715a4b1d8b671c84eddcd5ccd699.1713379858.git.janneke@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.08 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -6.08 X-Migadu-Queue-Id: 9146A67909 X-TUID: xh5+exqdaH4S This replaces Automake's `build-aux/mdate-sh' with our own `build-aux/mdate-from-git.scm' to use reproducible timestamps from Git instead. * build-aux/mdate-from-git.scm: New script. * bootstrap: Use it to replace build-aux/mdate-sh. * Makefile.am (EXTRA_DIST): Add it. Change-Id: I17d0a7de9ffea397129c0db1728f86e28a4e245f --- Makefile.am | 1 + bootstrap | 8 +++- build-aux/mdate-from-git.scm | 87 ++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100755 build-aux/mdate-from-git.scm diff --git a/Makefile.am b/Makefile.am index af08bc546f..92a7a85a01 100644 --- a/Makefile.am +++ b/Makefile.am @@ -724,6 +724,7 @@ EXTRA_DIST += \ build-aux/config.rpath \ build-aux/convert-xref.scm \ build-aux/generate-authors.scm \ + build-aux/mdate-from-git.scm \ build-aux/test-driver.scm \ build-aux/update-NEWS.scm \ build-aux/update-guix-package.scm \ diff --git a/bootstrap b/bootstrap index de024aeaa5..5bf83175e5 100755 --- a/bootstrap +++ b/bootstrap @@ -24,4 +24,10 @@ for lang in ${langs}; do fi done -exec autoreconf -vfi +autoreconf -vfi + +# Replace Automake's build-aux/mdate-sh with build-aux/mdate-from-git, our +# own, reproducible version. +chmod +w build-aux/mdate-sh +rm -f build-aux/mdate-sh +ln -s mdate-from-git.scm build-aux/mdate-sh diff --git a/build-aux/mdate-from-git.scm b/build-aux/mdate-from-git.scm new file mode 100755 index 0000000000..a9e36031b4 --- /dev/null +++ b/build-aux/mdate-from-git.scm @@ -0,0 +1,87 @@ +#! /bin/sh +# -*-scheme-*- +export LANG=C LANGUAGE=C LC_TIME=C +export TZ=UTC0 +exec guile --no-auto-compile -L $srcdir -C $srcdir -e '(mdate-from-git)' -s "$0" "$@" +!# + +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2024 Janneke Nieuwenhuizen +;;; +;;; This file is part of GNU Guix. +;;; +;;; This program is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + +;;;; Commentary: +;;; +;;; Usage: mdate-from-git.scm FILE +;;; +;;; This script is compatible with Automake's `mdate-sh' but uses the timestamp +;;; from Git instead of from the file system. Also, it can be appended to +;;; mdate-sh. + +;;; As a special exception for Guix, it caters for doc/guix.LANG.texi files that +;;; are not stored in Git, by using po/doc/guix-manual.LANG.po for the Git +;;; timestamp. Test doing something like: +;;; +;;; build-aux/mdate-from-git.scm doc/guix.de.texi +;;; +;;;; Code: + +(define-module (mdate-from-git) + #:use-module (ice-9 match) + #:use-module (ice-9 popen) + #:use-module (ice-9 rdelim) + #:use-module (ice-9 regex) + #:export (main)) + +(define (pipe-command command) + (let* ((port (apply open-pipe* OPEN_READ command)) + (output (read-string port))) + (close-port port) + output)) + +(define (guix.LANG.texi->guix-manual.LANG.po file-name) + "Translated manuals doc/guix.LANG.texi are not tracked in Git and are +generated from po/doc/guix-manual.LANG.po. For such an untraced .TEXI file, +return its .PO counterpart." + (let ((m (string-match "doc/guix.([^.]+).texi" file-name))) + (if (not m) file-name + (let ((lang (match:substring m 1))) + (format #f "po/doc/guix-manual.~a.po" lang))))) + + +;;; +;;; Entry point. +;;; +(define (main args) + (match args + ((script file-name) + (let* ((command `("git" "ls-files" "--error-unmatch" "--" ,file-name)) + (tracked? (zero? (with-error-to-port (%make-void-port "w") + (lambda _ (apply system* command))))) + (file-name (if tracked? file-name + (guix.LANG.texi->guix-manual.LANG.po file-name))) + (command `("git" "log" "--pretty=format:%ct" "-n1" "--" ,file-name)) + (timestamp (with-error-to-port (%make-void-port "w") + (lambda _ (pipe-command command)))) + (source-date-epoch (or (getenv "SOURCE_DATE_EPOCH") "1")) + (timestamp (if (string-null? timestamp) source-date-epoch + timestamp)) + (time (gmtime (string->number timestamp))) + (d-m-y (strftime "%-d %B %Y" time))) + (display d-m-y))) + (_ + (format (current-error-port) "Usage: mdate-from-git.scm FILE\n") + (exit 2)))) -- 2.41.0