From ce6e9d4d5bcadfb4f65f5bd4e13a1068ed611dfe Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Mon, 2 Aug 2021 13:15:29 +0000
Subject: [PATCH] version.sh: output short mc git version to prevent full rebuild
When using exact git version in AC_INIT, every git commit result in different AC_PACKAGE_VERSION and AC_PACKAGE_STRING macros at config.h
hence this will cause a full rebuild see #2252
4.8.26-217-ge819ed742 -> 4.8.26-git
4.8.27-pre1-1-gcbc214da8 -> 4.8.27-pre1-git
TODO tests needed for final version release workflow!
Signed-off-by: Andreas Mohr <and@gmx.li>
---
version.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/version.sh b/version.sh
index 5d7aa1615..0565b7448 100755
a
|
b
|
mc_print_version(){ |
42 | 42 | #endif |
43 | 43 | EOF |
44 | 44 | fi |
45 | | echo "${CURR_MC_VERSION}" |
| 45 | echo "${SHOR_MC_VERSION}" |
46 | 46 | exit |
47 | 47 | } |
48 | 48 | |
… |
… |
src_top_dir="$1" |
59 | 59 | VERSION_FILE="${src_top_dir}/mc-version.h" |
60 | 60 | PREV_MC_VERSION="unknown" |
61 | 61 | CURR_MC_VERSION="${PREV_MC_VERSION}" |
| 62 | SHOR_MC_VERSION="${PREV_MC_VERSION}" |
62 | 63 | |
63 | 64 | if [ -r "${VERSION_FILE}" ] |
64 | 65 | then |
65 | 66 | PREV_MC_VERSION=`sed -n 's/^#define MC_CURRENT_VERSION "\(.*\)"$/\1/p' "${VERSION_FILE}"` |
66 | 67 | CURR_MC_VERSION="${PREV_MC_VERSION}" |
| 68 | SHOR_MC_VERSION="${PREV_MC_VERSION}" |
67 | 69 | fi |
68 | 70 | |
69 | 71 | git_head=`git --git-dir "${src_top_dir}/.git" rev-parse --verify HEAD 2>/dev/null` |
… |
… |
git_head=`git --git-dir "${src_top_dir}/.git" rev-parse --verify HEAD 2>/dev/nul |
71 | 73 | |
72 | 74 | # try to store sha1 |
73 | 75 | CURR_MC_VERSION="${git_head}" |
| 76 | SHOR_MC_VERSION="${CURR_MC_VERSION}" |
74 | 77 | |
75 | 78 | new_version=`git --git-dir "${src_top_dir}/.git" describe --always 2>/dev/null` |
76 | 79 | [ -z "${new_version}" ] && mc_print_version |
77 | 80 | |
78 | 81 | # store pretty tagged version |
79 | 82 | CURR_MC_VERSION="${new_version}" |
| 83 | SHOR_MC_VERSION="${CURR_MC_VERSION}" |
| 84 | |
| 85 | # stop full rebuild by using not-exact git version string in config.h, see #2252, #4266 |
| 86 | SHOR_MC_VERSION=`git --git-dir "${src_top_dir}/.git" describe --always --abbrev=0 2>/dev/null`-git |
| 87 | |
80 | 88 | mc_print_version |