mirror of
https://github.com/json-c/json-c.git
synced 2026-11-08 06:30:17 +08:00
Add a shellcheck test, fix or ignore all warnings reported by shellcheck.
This commit is contained in:
1 parent
5a79fb68c2
commit
8f191846d5
21 files changed
+163
-94
No files matched your search
@@ -35,18 +35,20 @@ bump_release_ver()
|
||||
{
|
||||
echo "ERROR: bump_release_ver() not yet implemented in $0" 1>&2
|
||||
echo "See RELEASE_CHECKLIST.txt for steps to take" 1>&2
|
||||
trap - EXIT
|
||||
exit 1
|
||||
return 1
|
||||
}
|
||||
|
||||
bump_dev_ver()
|
||||
{
|
||||
# Update the working directory to get it ready for the next release.
|
||||
# This runs just _after_ a release has been done
|
||||
|
||||
# shellcheck disable=SC2143
|
||||
if [ -n "$(git status --porcelain | grep -v reltools/bump_version.sh)" ] ; then
|
||||
usage 1 "local changes in working directory, aborting"
|
||||
fi
|
||||
|
||||
RELVER=$(get_most_recent_relver)
|
||||
DEVVER=${RELVER}.99
|
||||
NEXTVER=$(get_next_relver)
|
||||
|
||||
if ! grep -q "^${NEXTVER}" ChangeLog ; then
|
||||
@@ -75,7 +77,7 @@ EOF
|
||||
|
||||
|
||||
# Use ${release}.99 to indicate a version "newer" than anything on the branch:
|
||||
if ! grep -q ${RELVER}.99 json_c_version.h ; then
|
||||
if ! grep -q "${RELVER}.99" json_c_version.h ; then
|
||||
local MAJOR MINOR
|
||||
MAJOR=${RELVER%%.*}
|
||||
MINOR=${RELVER#*.}
|
||||
@@ -100,11 +102,11 @@ EOF
|
||||
fi
|
||||
|
||||
local RELTAG
|
||||
RELTAG=$(get_most_recent_reltag)
|
||||
RELTAG=$(get_most_recent_reltag "")
|
||||
echo "Extracting VERSION, SOVERSION from ${RELTAG}:CMakeLists.txt"
|
||||
|
||||
local REL_SOVER REL_SOVERNUM
|
||||
REL_SOVER=$(git show ${RELTAG}:CMakeLists.txt | awk '/set_target_prop.*PROJECT_NAME/,/)/')
|
||||
REL_SOVER=$(git show "${RELTAG}:CMakeLists.txt" | awk '/set_target_prop.*PROJECT_NAME/,/)/')
|
||||
REL_VERNUM=$(echo "${REL_SOVER}" | grep " VERSION " | sed -e's/ *VERSION *//' )
|
||||
REL_SOVERNUM=$(echo "${REL_SOVER}" | grep " SOVERSION " | sed -e's/ *SOVERSION *//' -e's/)//' )
|
||||
echo " VERSION=${REL_VERNUM}"
|
||||
@@ -157,7 +159,7 @@ EOF
|
||||
echo "Warning: json-c-sym already has JSONC_${NEXTVER}" 1>&2
|
||||
fi
|
||||
|
||||
git commit -a -m "Update the master branch to version ${release}.99"
|
||||
git commit -a -m "Update the master branch to version ${RELVER}.99"
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ] ; do
|
||||
@@ -177,7 +179,6 @@ while [ $# -gt 0 ] ; do
|
||||
;;
|
||||
*)
|
||||
usage 1 "Unknown args: $*"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -10,6 +10,8 @@ exitval=0
|
||||
|
||||
XMLREPORT="$1"
|
||||
if [[ "${XMLREPORT}" = -* ]] || [ ! -r "${XMLREPORT}" ] ; then
|
||||
echo "Usage: $0 <abireport.xml>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
XSLTPROC=${XSLTPROC:-xsltproc}
|
||||
|
||||
@@ -7,7 +7,8 @@ RUNDIR=$(dirname "$0")
|
||||
|
||||
NEXT_VER=$(get_next_relver)
|
||||
|
||||
MOST_RECENT=$(ls ${RUNDIR}/../issues_closed*md | sort -V | tail -1)
|
||||
# shellcheck disable=SC2012 # Using find is overkill
|
||||
MOST_RECENT=$(ls "${RUNDIR}"/../issues_closed*md | sort -V | tail -1)
|
||||
PREV=$(grep 'NOW=' "${MOST_RECENT}" | sed -e's/.*=//')
|
||||
NOW=$(date +%Y-%m-%d)
|
||||
set -x -v
|
||||
|
||||
@@ -25,8 +25,8 @@ if [ ! -d "json-c-${release}" ] ; then
|
||||
git clone https://github.com/json-c/json-c "json-c-${release}"
|
||||
fi
|
||||
|
||||
cd json-c-${release}
|
||||
git checkout ${reltag}
|
||||
cd "json-c-${release}"
|
||||
git checkout "${reltag}"
|
||||
if [ ! -e doc/html/index.html ] ; then
|
||||
echo "ERROR: unable to find doc/html/index.html on at version ${reltag} in $(pwd)" 1>&2
|
||||
exit 1
|
||||
@@ -38,11 +38,11 @@ if [ ! -d json-c-pages ] ; then
|
||||
git clone -b gh-pages https://github.com/json-c/json-c json-c-pages
|
||||
fi
|
||||
cd json-c-pages
|
||||
mkdir -p json-c-${release}
|
||||
cp -R ../json-c-${release}/doc json-c-${release}/.
|
||||
git add json-c-${release}
|
||||
mkdir -p "json-c-${release}"
|
||||
cp -R "../json-c-${release}/doc" "json-c-${release}/."
|
||||
git add "json-c-${release}"
|
||||
rm json-c-current-release
|
||||
ln -s json-c-${release} json-c-current-release
|
||||
ln -s "json-c-${release}" json-c-current-release
|
||||
git commit -a -m "Add the ${release} docs."
|
||||
|
||||
# TODO: automate changes to index.html
|
||||
@@ -51,13 +51,13 @@ Steps to do:
|
||||
* Add section with links to new json-c-${release} release.
|
||||
* Update versions in the "Current release" section
|
||||
EOF
|
||||
read -p "Press <enter> to run vi index.html: "
|
||||
read -r -p "Press <enter> to run vi index.html: "
|
||||
vi index.html
|
||||
|
||||
git commit -a -m "Update the doc links to point at ${release}"
|
||||
|
||||
cat <<EOF
|
||||
cd $(pwd)
|
||||
cd ${PWD@Q}
|
||||
git log -n1 --name-status
|
||||
git log -n1 -p
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
rt_RUNDIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
rt=RUNDIR=$(realpath "${rt_RUNDIR}")
|
||||
rt_RUNDIR=$(realpath "${rt_RUNDIR}")
|
||||
JSON_C_TOP=${rt_RUNDIR}/..
|
||||
|
||||
get_most_recent_reltag()
|
||||
{
|
||||
local PATTERN="json-c-${1}*"
|
||||
local PATTERN="json-c-${1:-}*"
|
||||
local RELTAG
|
||||
RELTAG=$(git tag --list "${PATTERN}" | tail -1)
|
||||
echo "${RELTAG}"
|
||||
@@ -46,6 +46,7 @@ get_most_recent_relbase()
|
||||
echo "${RELBASE}"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
set_rel_vars()
|
||||
{
|
||||
# Set non-local variables for convenience
|
||||
@@ -59,7 +60,7 @@ set_rel_vars()
|
||||
# Extract the version from either a release tag, or the dev version + abbreviated commit hash
|
||||
get_ver_descr()
|
||||
{
|
||||
local GITDESCR JSON_C_VERS
|
||||
local GIT_DESCR JSON_C_VERS
|
||||
|
||||
GIT_DESCR=$(git describe --tags --always)
|
||||
if [[ "$GIT_DESCR" == json-c-* ]] ; then
|
||||
@@ -75,7 +76,7 @@ get_ver_descr()
|
||||
update_authors()
|
||||
{
|
||||
PREV=$(get_most_recent_reltag)
|
||||
NEW_AUTHORS=$( git log -r ${PREV}..HEAD | grep Author: | sed -e's/Author: //' ; cat "${JSON_C_TOP}/AUTHORS" )
|
||||
NEW_AUTHORS=$(git log -r "${PREV}..HEAD" | grep Author: | sed -e's/Author: //' ; cat "${JSON_C_TOP}/AUTHORS" )
|
||||
echo "${NEW_AUTHORS}" | sort -u > "${JSON_C_TOP}/AUTHORS"
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ TOP=${RUNDIR}/..
|
||||
|
||||
update_authors()
|
||||
{
|
||||
PREV=$(get_most_recent_reltag)
|
||||
NEW_AUTHORS=$( git log -r ${PREV}..HEAD | grep Author: | sed -e's/Author: //' ; cat "${TOP}/AUTHORS" )
|
||||
PREV=$(get_most_recent_reltag "")
|
||||
NEW_AUTHORS=$( git log -r "${PREV}..HEAD" | grep Author: | sed -e's/Author: //' ; cat "${TOP}/AUTHORS" )
|
||||
echo "${NEW_AUTHORS}" | sort -u > "${TOP}/AUTHORS"
|
||||
}
|
||||
Reference in new issue
Block a user