aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanneke Nieuwenhuizen <janneke@gnu.org>2024-04-17 19:54:05 +0200
committerJanneke Nieuwenhuizen <janneke@gnu.org>2024-04-19 16:45:41 +0200
commitf83b5274c8d67a9bccf8881cc4f87d76a3d172de (patch)
tree75b8ca766c6bdebdc4b34d173f1fb7d8e10141bd
parentbb089f76227666e11e6949038c4fd9e130e047a3 (diff)
downloadguix-f83b5274c8d67a9bccf8881cc4f87d76a3d172de.tar
guix-f83b5274c8d67a9bccf8881cc4f87d76a3d172de.tar.gz
maint: Support `make doc-pot-update' from a tarball.
* build-aux/xgettext.scm: Move setting of environment variables to shell header. (main): Use SOURCE_DATE_EPOCH as fallback for timestamp. This fixes running from a tarball. * Makefile.am (EXTRA_DIST): Add it. Change-Id: Ic487587b22495868fd2a21545a13dc9e3458299c
-rw-r--r--Makefile.am1
-rwxr-xr-xbuild-aux/xgettext.scm10
2 files changed, 6 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index 98008c528d..ca3fa0a693 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -727,6 +727,7 @@ EXTRA_DIST += \
build-aux/test-driver.scm \
build-aux/update-NEWS.scm \
build-aux/update-guix-package.scm \
+ build-aux/xgettext.scm \
doc/build.scm \
etc/disarchive-manifest.scm \
etc/guix-install.sh \
diff --git a/build-aux/xgettext.scm b/build-aux/xgettext.scm
index 44d30b8149..7142336a9d 100755
--- a/build-aux/xgettext.scm
+++ b/build-aux/xgettext.scm
@@ -2,6 +2,8 @@
# -*-scheme-*-
build_aux=$(dirname $0)
srcdir=$build_aux/..
+export LC_ALL=en_US.UTF-8
+export TZ=UTC0
exec guile --no-auto-compile -L $srcdir -C $srcdir -e main -s "$0" "$@"
!#
@@ -59,9 +61,6 @@ exec guile --no-auto-compile -L $srcdir -C $srcdir -e main -s "$0" "$@"
;;; Entry point.
;;;
(define (main args)
- ;; Cater for being run in a container.
- (setenv "LC_ALL" "en_US.UTF-8")
- (setenv "TZ" "UTC0")
(fluid-set! %default-port-encoding #f)
(let* ((files-from (get-option args "--files-from="))
(default-domain (get-option args "--default-domain="))
@@ -82,9 +81,10 @@ exec guile --no-auto-compile -L $srcdir -C $srcdir -e main -s "$0" "$@"
(files (map (cute string-append directory "/" <>) files))
(git-command `("git" "log" "--pretty=format:%ci" "-n1" ,@files))
(timestamp (pipe-command git-command))
+ (source-date-epoch (or (getenv "SOURCE_DATE_EPOCH") "1"))
+ (timestamp (if (string-null? timestamp) source-date-epoch
+ timestamp))
(po-file (string-append default-domain ".po")))
- (when (string-null? timestamp)
- (exit 1))
(substitute* po-file
(("(\"POT-Creation-Date: )[^\\]*" all header)
(string-append header timestamp)))))))