[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#70380] [PATCH v3 1/4] maint: Cater for running `make dist' from tar
From: |
Janneke Nieuwenhuizen |
Subject: |
[bug#70380] [PATCH v3 1/4] maint: Cater for running `make dist' from tarball. |
Date: |
Wed, 17 Apr 2024 11:53:28 +0200 |
* Makefile.am (in_git_p): New variable. Use it to disable Autotools'
cache consistency assert and removal when bulding from tarball.
(dist): Depend on doc-pot-update again when building from tarball.
(dist-hook): Remove dependencies on gen-ChangeLog and gen-AUTHORS when
building from tarball.
(gen-ChangeLog, gen-AUTHORS): Remove guarding for building from tarball.
Use set -e to avoid silently failing.
(gen-tarball-version): Use $(SOURCE_DATE_EPOCH) instead of re-generating it
using git; this also works running from a tarball.
Change-Id: I9ebdd28a70837f6a4db610c4816bb283d176e2d9
---
Makefile.am | 61 +++++++++++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 25 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 147767ece4..39cf4b4b17 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -953,9 +953,24 @@ guix-binary.%.tar.xz:
guix` ; \
cp "$$tarball" "$@.tmp" ; mv "$@.tmp" "$@"
+# The `dist' target has other dependencies when building from Git
+# to assert and achieve reproducibility. Indented to get past Automake.
+in_git_p = $(shell test -e .git && echo true)
+ ifeq ($(in_git_p),true)
+
+# The dependency on dist-doc-pot-update is to clean possibly stale doc and po
+# files and only then generate the .pot files, which are not checked in.
+dist: dist-doc-pot-update
+dist-doc-pot-update: auto-clean
+ $(MAKE) guile$(EXEEXT)
+ $(MAKE) -C po/guix all
+ $(MAKE) -C po/packages all
+ $(MAKE) doc-pot-update
+
+dist-hook: gen-ChangeLog gen-AUTHORS
# Assert that Autotools cache is up to date with Git, by checking
-# PACKAGE_VERSION against HEAD. Indented to get past Automake.
+# PACKAGE_VERSION against HEAD.
ifeq ($(MAKECMDGOALS),dist)
git_version = $(shell build-aux/git-version-gen .tarball-version)
ifneq ($(PACKAGE_VERSION),$(git_version))
@@ -967,20 +982,18 @@ guix-binary.%.tar.xz:
$(error Cannot create reproducible tarball)
else
$(warning Tarball will be irreproducible; distdir will not get removed!)
- endif
- endif
- endif
+ endif # !GUIX_ALLOW_IRREPRODUCIBLE_TARBALL
+ endif # PACKAGE_VERSION != git_version
+ endif # MAKECMDGOALS dist
-# The dependency on dist-doc-pot-update is to clean possibly stale doc and po
-# files and only then generate the .pot files, which are not checked in.
-dist: dist-doc-pot-update
-dist-doc-pot-update: auto-clean
- $(MAKE) guile$(EXEEXT)
- $(MAKE) -C po/guix all
- $(MAKE) -C po/packages all
- $(MAKE) doc-pot-update
+ else # !in_git_p
-dist-hook: gen-ChangeLog gen-AUTHORS gen-tarball-version
+dist: doc-pot-update
+$(warning Not using Git, tarball will likely be irreproducible!)
+
+ endif # !in_git_p
+
+dist-hook: gen-tarball-version
dist-hook: assert-no-store-file-names
distcheck-hook: assert-binaries-available assert-final-inputs-self-contained
@@ -992,27 +1005,25 @@ $(top_srcdir)/.version: config.status
gen-tarball-version:
echo $(VERSION) > "$(distdir)/.tarball-version"
- git show HEAD --format=%ct --no-patch > $(distdir)/.tarball-timestamp
+ echo $(SOURCE_DATE_EPOCH) > $(distdir)/.tarball-timestamp
gen-ChangeLog:
- $(AM_V_GEN)if test -e .git; then \
- export LC_ALL=en_US.UTF-8; \
- export TZ=UTC0; \
- $(top_srcdir)/build-aux/gitlog-to-changelog \
- > $(distdir)/ChangeLog.tmp; \
- rm -f $(distdir)/ChangeLog; \
- mv $(distdir)/ChangeLog.tmp $(distdir)/ChangeLog; \
- fi
+ $(AM_V_GEN)set -e; \
+ export LC_ALL=en_US.UTF-8; \
+ export TZ=UTC0; \
+ $(top_srcdir)/build-aux/gitlog-to-changelog \
+ > $(distdir)/ChangeLog.tmp; \
+ rm -f $(distdir)/ChangeLog; \
+ mv $(distdir)/ChangeLog.tmp $(distdir)/ChangeLog;
gen-AUTHORS:
- $(AM_V_GEN)if test -e .git; then \
+ $(AM_V_GEN)set -e; \
rm -f "$(distdir)/AUTHORS"; \
export LC_ALL=en_US.UTF-8; \
export TZ=UTC0; \
$(top_builddir)/pre-inst-env "$(GUILE)" \
"$(top_srcdir)/build-aux/generate-authors.scm" \
- "$(top_srcdir)" "$(distdir)/AUTHORS"; \
- fi
+ "$(top_srcdir)" "$(distdir)/AUTHORS";
# Like 'dist', but regenerate 'configure' so we get an up-to-date
# 'PACKAGE_VERSION' string. (In Gnulib, 'GNUmakefile' has a special trick to
--
2.41.0
- [bug#70380] [PATCH 3/3] Revert "maint: Generate 'doc/version.texi' reproducibly.", (continued)
- [bug#70380] [PATCH v3 0/4] Reproducible `make dist' tarball: Avoid override stamp-N warnings., Janneke Nieuwenhuizen, 2024/04/17
- [bug#70380] [PATCH v3 1/4] maint: Cater for running `make dist' from tarball.,
Janneke Nieuwenhuizen <=
- [bug#70380] [PATCH v3 4/4] Revert "maint: Generate 'doc/version.texi' reproducibly.", Janneke Nieuwenhuizen, 2024/04/17
- [bug#70380] [PATCH v3 3/4] Revert "maint: Generate 'doc/version-LANG.texi' reproducibly.", Janneke Nieuwenhuizen, 2024/04/17
- [bug#70380] [PATCH v3 2/4] maint: Generate doc/version[-LANG].texi using `mdate-from-git.scm'., Janneke Nieuwenhuizen, 2024/04/17
[bug#70380] [PATCH v4 0/6] Reproducible `make dist' tarball: Avoid override stamp-N warnings., Janneke Nieuwenhuizen, 2024/04/17