tzdata/backport-Use-better-fallback-for-unknown-VERSION.patch
2020-10-27 11:27:13 +08:00

43 lines
1.4 KiB
Diff

From 78422f077abeb56e2be8fd6852eb95361398c008 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 22 Oct 2020 13:39:01 -0700
Subject: [PATCH 3/6] Use better fallback for unknown $(VERSION)
Problem reported by Carlos Jimenez in:
https://mm.icann.org/pipermail/tz/2020-October/029380.html
* Makefile (version): If $(VERSION) is unknown, reuse contents
of existing version file and append "-dirty" if they do not
already end in "-dirty".
---
Makefile | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 3b9d59e..a0b6aeb 100644
--- a/Makefile
+++ b/Makefile
@@ -583,11 +583,19 @@ INSTALL: ALL install date.1
cp date '$(DESTDIR)$(BINDIR)/.'
cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
+# Calculate version number from git, if available.
+# Otherwise, use $(VERSION) unless it is "unknown" and there is already
+# a 'version' file, in which case reuse the existing 'version' contents
+# and append "-dirty" if the contents do not already end in "-dirty".
version: $(VERSION_DEPS)
{ (type git) >/dev/null 2>&1 && \
V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
--abbrev=7 --dirty` || \
- V='$(VERSION)'; } && \
+ if test '$(VERSION)' = unknown && V=`cat $@`; then \
+ case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
+ else \
+ V='$(VERSION)'; \
+ fi; } && \
printf '%s\n' "$$V" >$@.out
mv $@.out $@
--
1.8.3.1