Ticket #4266: mc-4266-version_sh-short-version-for-config_h.patch

File mc-4266-version_sh-short-version-for-config_h.patch, 2.0 KB (added by and, 3 years ago)
  • version.sh

    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(){ 
    4242#endif 
    4343EOF 
    4444    fi 
    45     echo "${CURR_MC_VERSION}" 
     45    echo "${SHOR_MC_VERSION}" 
    4646    exit 
    4747} 
    4848 
    src_top_dir="$1" 
    5959VERSION_FILE="${src_top_dir}/mc-version.h" 
    6060PREV_MC_VERSION="unknown" 
    6161CURR_MC_VERSION="${PREV_MC_VERSION}" 
     62SHOR_MC_VERSION="${PREV_MC_VERSION}" 
    6263 
    6364if [ -r "${VERSION_FILE}" ] 
    6465  then 
    6566    PREV_MC_VERSION=`sed -n 's/^#define MC_CURRENT_VERSION "\(.*\)"$/\1/p' "${VERSION_FILE}"` 
    6667    CURR_MC_VERSION="${PREV_MC_VERSION}" 
     68    SHOR_MC_VERSION="${PREV_MC_VERSION}" 
    6769fi 
    6870 
    6971git_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 
    7173 
    7274# try to store sha1 
    7375CURR_MC_VERSION="${git_head}" 
     76SHOR_MC_VERSION="${CURR_MC_VERSION}" 
    7477 
    7578new_version=`git --git-dir "${src_top_dir}/.git" describe --always 2>/dev/null` 
    7679[ -z "${new_version}" ] && mc_print_version 
    7780 
    7881# store pretty tagged version 
    7982CURR_MC_VERSION="${new_version}" 
     83SHOR_MC_VERSION="${CURR_MC_VERSION}" 
     84 
     85# stop full rebuild by using not-exact git version string in config.h, see #2252, #4266 
     86SHOR_MC_VERSION=`git --git-dir "${src_top_dir}/.git" describe --always --abbrev=0 2>/dev/null`-git 
     87 
    8088mc_print_version