diff options
Diffstat (limited to 'maint')
-rw-r--r-- | maint/Makefile.am | 44 | ||||
-rw-r--r-- | maint/bumplibs.in | 57 |
2 files changed, 58 insertions, 43 deletions
diff --git a/maint/Makefile.am b/maint/Makefile.am index 788dd46..bfdbfaf 100644 --- a/maint/Makefile.am +++ b/maint/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2019-2022 the Pacemaker project contributors +# Copyright 2019-2023 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -18,14 +18,18 @@ EXTRA_DIST = README # # Count changes in these directories -CHANGELOG_DIRS = ../include ../lib ../daemons ../tools ../xml +CHANGELOG_DIRS = ../include \ + ../lib \ + ../daemons \ + ../tools \ + ../xml .PHONY: require_last_release require_last_release: @if [ -z "$(CHECKOUT)" ]; then \ echo "This target must be run from a git checkout"; \ exit 1; \ - elif ! git rev-parse $(LAST_RELEASE) >/dev/null 2>&1; then \ + elif ! "$(GIT)" rev-parse $(LAST_RELEASE) >/dev/null 2>&1; then \ echo "LAST_RELEASE must be set to a valid git tag"; \ exit 1; \ fi @@ -33,22 +37,23 @@ require_last_release: .PHONY: summary summary: require_last_release @printf "* %s %s <%s> %s\n" "$$(date +'%a %b %d %Y')" \ - "$$(git config user.name)" "$$(git config user.email)" \ + "$$("$(GIT)" config user.name)" \ + "$$("$(GIT)" config user.email)" \ "$(NEXT_RELEASE)" @printf "\055 %d commits with%s\n" \ - "$$(git log --pretty=oneline --no-merges \ + "$$("$(GIT)" log --pretty=oneline --no-merges \ $(LAST_RELEASE)..HEAD | wc -l)" \ - "$$(git diff $(LAST_RELEASE)..HEAD --shortstat \ + "$$("$(GIT)" diff $(LAST_RELEASE)..HEAD --shortstat \ $(CHANGELOG_DIRS))" .PHONY: changes changes: summary @printf "\n- Features added since $(LAST_RELEASE)\n" - @git log --pretty=format:'%s' --no-merges \ + @"$(GIT)" log --pretty=format:'%s' --no-merges \ --abbrev-commit $(LAST_RELEASE)..HEAD \ | sed -n -e 's/^ *Feature: */ + /p' | sort -uf @printf "\n- Fixes since $(LAST_RELEASE)\n" - @git log --pretty=format:'%s' --no-merges \ + @"$(GIT)" log --pretty=format:'%s' --no-merges \ --abbrev-commit $(LAST_RELEASE)..HEAD \ | sed -n -e 's/^ *\(Fix\|High\|Bug\): */ + /p' | sed \ -e 's/\(cib\|pacemaker-based\|based\):/CIB:/' \ @@ -58,7 +63,7 @@ changes: summary -e 's/\(PE\|pengine\|pacemaker-schedulerd\|schedulerd\):/scheduler:/' \ | sort -uf @printf "\n- Public API changes since $(LAST_RELEASE)\n" - @git log --pretty=format:'%s' --no-merges \ + @"$(GIT)" log --pretty=format:'%s' --no-merges \ --abbrev-commit $(LAST_RELEASE)..HEAD \ | sed -n -e 's/^ *API: */ + /p' | sort -uf @@ -71,7 +76,7 @@ changelog: require_last_release .PHONY: authors authors: require_last_release - git log $(LAST_RELEASE)..$(COMMIT) --format='%an' | sort -u + "$(GIT)" log $(LAST_RELEASE)..$(COMMIT) --format='%an' | sort -u # # gnulib updates @@ -91,17 +96,22 @@ gnulib-update: @echo 'Pacemaker cannot update until minimum supported automake is 1.14' @exit 1 if test -e gnulib; then \ - cd gnulib && git pull; \ + cd gnulib && "$(GIT)" pull; \ else \ - git clone https://git.savannah.gnu.org/git/gnulib.git gnulib \ - && cd gnulib && git config pull.rebase false; \ + "$(GIT)" clone https://git.savannah.gnu.org/git/gnulib.git \ + gnulib \ + && cd gnulib && "$(GIT)" config pull.rebase false; \ fi cd $(top_srcdir) && maint/gnulib/gnulib-tool --source-base=lib/gnu \ --lgpl=2 --no-vc-files --no-conditional-dependencies --libtool \ $(GNU_MODS_AVOID:%=--avoid %) --import $(GNU_MODS) - sed -i -e "s/bundled(gnulib).*/bundled(gnulib) = `date +'%Y%m%d'`/" \ - ../rpm/pacemaker.spec.in - sed -i -e "s/_GL_EXTERN_INLINE/_GL_INLINE/" \ + cp -p ../rpm/pacemaker.spec.in ../rpm/pacemaker.spec.in.$$ + sed -e "s/bundled(gnulib).*/bundled(gnulib) = `date +'%Y%m%d'`/" \ + ../rpm/pacemaker.spec.in > ../rpm/pacemaker.spec.in.$$ + mv ../rpm/pacemaker.spec.in.$$ ../rpm/pacemaker.spec.in + cp -p ../lib/gnu/md5.c ../lib/gnu/md5.c.$$ + sed -e "s/_GL_EXTERN_INLINE/_GL_INLINE/" \ -e "s#left_over -= 64;#left_over \&= 63; /* helps static analysis */#" \ -e "s#&ctx->buffer\[16\]#\&(((char *) ctx->buffer)[64]) /* helps static analysis */#" \ - ../lib/gnu/md5.c + ../lib/gnu/md5.c > ../lib/gnu/md5.c.$$ + mv ../lib/gnu/md5.c.$$ ../lib/gnu/md5.c diff --git a/maint/bumplibs.in b/maint/bumplibs.in index a142660..ddaa1a9 100644 --- a/maint/bumplibs.in +++ b/maint/bumplibs.in @@ -1,6 +1,6 @@ #!@BASH_PATH@ # -# Copyright 2012-2021 the Pacemaker project contributors +# Copyright 2012-2023 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -27,7 +27,7 @@ yesno() { local RESPONSE read -p "$1 " RESPONSE - case $(echo "$RESPONSE" | tr A-Z a-z) in + case $(echo "$RESPONSE" | tr '[:upper:]' '[:lower:]') in y|yes|ano|ja|si|oui) return 0 ;; *) return 1 ;; esac @@ -37,8 +37,14 @@ prompt_to_continue() { yesno "Continue?" || exit 0 } +sed_in_place() { + cp -p "$1" "$1.$$" + sed -e "$2" "$1" > "$1.$$" + mv "$1.$$" "$1" +} + find_last_release() { - if [ ! -z "$1" ]; then + if [ -n "$1" ]; then echo "$1" else git tag -l | grep Pacemaker | grep -v rc | sort -Vr | head -n 1 @@ -63,7 +69,7 @@ find_sources() { # than backslashed continuation lines, to allow this script to detect # source files correctly. Warn if that's not the case. if - grep "lib${LIB}_la_SOURCES.*\\\\" $AMFILE + grep "lib${LIB}_la_SOURCES.*\\\\" "$AMFILE" then echo -e "\033[1;35m -- Sources list for lib$LIB is probably truncated! --\033[0m" echo "Edit to use '+=' rather than backslashed continuation lines" @@ -75,11 +81,11 @@ find_sources() { for SOURCE in $SOURCES; do if - echo $SOURCE | grep -q "/" + echo "$SOURCE" | grep -q "/" then echo "$SOURCE" else - echo "$(dirname $AMFILE)/$SOURCE" + echo "$(dirname "$AMFILE")/$SOURCE" fi done } @@ -111,7 +117,7 @@ shared_lib_name() { local LIB="$1" local VERSION="$2" - echo "lib${LIB}.so.$(echo $VERSION | cut -d: -f 1)" + echo "lib${LIB}.so.$(echo "$VERSION" | cut -d: -f 1)" } process_lib() { @@ -135,11 +141,10 @@ process_lib() { AMFILE="$(find_makefile "$LIB")" # Get current shared library version - VER_NOW=$(cat $AMFILE | extract_version $LIB) + VER_NOW=$(extract_version "$LIB" < "$AMFILE") # Check whether library existed at last release - git cat-file -e $LAST_RELEASE:$AMFILE 2>/dev/null - if [ $? -ne 0 ]; then + if ! git cat-file -e "$LAST_RELEASE:$AMFILE" 2>/dev/null; then echo "lib$LIB is new, not changing version ($VER_NOW)" prompt_to_continue echo "" @@ -158,7 +163,7 @@ process_lib() { DEFAULT_CHANGE="i" # Removed public header is incompatible change elif [ -n "$HEADERS_ADDED" ]; then DEFAULT_CHANGE="c" # Additions are likely compatible - elif git diff --quiet -w $LAST_RELEASE..HEAD $HEADERS_HEAD $SOURCES ; then + elif git diff --quiet -w "$LAST_RELEASE..HEAD" $HEADERS_HEAD $SOURCES ; then echo "No changes to $LIB interface" prompt_to_continue echo "" @@ -179,12 +184,12 @@ process_lib() { echo "++ $HEADER is new" done fi - git --no-pager diff --color -w $LAST_RELEASE..HEAD $HEADERS_HEAD + git --no-pager diff --color -w "$LAST_RELEASE..HEAD" $HEADERS_HEAD echo "" if yesno "Show commits (minus refactor/build/merge) touching lib$LIB since $LAST_RELEASE [y/N]?" then - git log --color $LAST_RELEASE..HEAD -z $HEADERS_HEAD $SOURCES $AMFILE \ + git log --color "$LAST_RELEASE..HEAD" -z $HEADERS_HEAD $SOURCES "$AMFILE" \ | grep -vzE "Refactor:|Build:|Merge pull request" echo prompt_to_continue @@ -203,7 +208,7 @@ process_lib() { echo "" echo "- Headers: $HEADERS_HEAD" echo "- Changed sources since $LAST_RELEASE:" - git --no-pager diff --color -w $LAST_RELEASE..HEAD --stat $SOURCES + git --no-pager diff --color -w "$LAST_RELEASE..HEAD" --stat $SOURCES echo "" # Ask for human guidance @@ -212,14 +217,14 @@ process_lib() { [ -z "$CHANGE" ] && CHANGE="$DEFAULT_CHANGE" # Get (and show) shared library version at last release - VER=$(git show $LAST_RELEASE:$AMFILE | extract_version $LIB) - VER_1=$(echo $VER | awk -F: '{print $1}') - VER_2=$(echo $VER | awk -F: '{print $2}') - VER_3=$(echo $VER | awk -F: '{print $3}') + VER=$(git show "$LAST_RELEASE:$AMFILE" | extract_version "$LIB") + VER_1=$(echo "$VER" | awk -F: '{print $1}') + VER_2=$(echo "$VER" | awk -F: '{print $2}') + VER_3=$(echo "$VER" | awk -F: '{print $3}') echo "lib$LIB version at $LAST_RELEASE: $VER" # Show current shared library version if changed - if [ $VER_NOW != $VER ]; then + if [ "$VER_NOW" != "$VER" ]; then echo "lib$LIB version currently: $VER_NOW" fi @@ -227,25 +232,25 @@ process_lib() { case $CHANGE in i|I) echo "New backwards-incompatible version: x+1:0:0" - VER_1=$(expr $VER_1 + 1) + (( VER_1++ )) VER_2=0 VER_3=0 # Some headers define constants for shared library names, # update them if the name changed for H in $HEADERS_HEAD; do - sed -i -e "s/$(shared_lib_name "$LIB" "$VER_NOW")/$(shared_lib_name "$LIB" "$VER_1:0:0")/" $H + sed_in_place "$H" "s/$(shared_lib_name "$LIB" "$VER_NOW")/$(shared_lib_name "$LIB" "$VER_1:0:0")/" done ;; c|C) echo "New version with backwards-compatible extensions: x+1:0:z+1" - VER_1=$(expr $VER_1 + 1) + (( VER_1++ )) VER_2=0 - VER_3=$(expr $VER_3 + 1) + (( VER_3++ )) ;; F|f) echo "Code changed though interfaces didn't: x:y+1:z" - VER_2=$(expr $VER_2 + 1) + (( VER_2++ )) ;; *) echo "Not updating lib$LIB version" @@ -255,11 +260,11 @@ process_lib() { esac VER_NEW=$VER_1:$VER_2:$VER_3 - if [ ! -z $CHANGE ]; then + if [ -n "$CHANGE" ]; then if [ "$VER_NEW" != "$VER_NOW" ]; then echo "Updating lib$LIB version from $VER_NOW to $VER_NEW" prompt_to_continue - sed -i "s/version-info\s*$VER_NOW/version-info $VER_NEW/" $AMFILE + sed_in_place "$AMFILE" "s/version-info\s*$VER_NOW/version-info $VER_NEW/" else echo "No version change needed for lib$LIB" prompt_to_continue |