Fix maintenance scripts to pass shellcheck

- discover_trees.sh: Set compile-command and indentation instructions for Emacs
- discover_trees.sh: shellcheck: Do not use -o (SC2166)
- discover_trees.sh: shellcheck: Remove x-prefixes since we use Bash (SC2268)
- discover_trees.sh: shellcheck: Double-quote variable references (SC2086)
- generate_source_tarball.sh: Add authorship
- icedtea_sync.sh: Set compile-command and indentation instructions for Emacs
- icedtea_sync.sh: shellcheck: Double-quote variable references (SC2086)
- icedtea_sync.sh: shellcheck: Remove x-prefixes since we use Bash (SC2268)
- openjdk_news.sh: Set compile-command and indentation instructions for Emacs
- openjdk_news.sh: shellcheck: Double-quote variable references (SC2086)
- openjdk_news.sh: shellcheck: Remove x-prefixes since we use Bash (SC2268)
- openjdk_news.sh: shellcheck: Remove deprecated egrep usage (SC2196)

Related: RHEL-30946
This commit is contained in:
Andrew Hughes 2024-03-21 02:25:25 +00:00
parent af5f67c762
commit 5a64784bdd
5 changed files with 99 additions and 62 deletions

View File

@ -2541,6 +2541,18 @@ cjc.mainProgram(args)
- generate_source_tarball.sh: Create directory in TMPDIR when using WITH_TEMP - generate_source_tarball.sh: Create directory in TMPDIR when using WITH_TEMP
- generate_source_tarball.sh: Only add --depth=1 on non-local repositories - generate_source_tarball.sh: Only add --depth=1 on non-local repositories
- Move maintenance scripts to a scripts subdirectory - Move maintenance scripts to a scripts subdirectory
- discover_trees.sh: Set compile-command and indentation instructions for Emacs
- discover_trees.sh: shellcheck: Do not use -o (SC2166)
- discover_trees.sh: shellcheck: Remove x-prefixes since we use Bash (SC2268)
- discover_trees.sh: shellcheck: Double-quote variable references (SC2086)
- generate_source_tarball.sh: Add authorship
- icedtea_sync.sh: Set compile-command and indentation instructions for Emacs
- icedtea_sync.sh: shellcheck: Double-quote variable references (SC2086)
- icedtea_sync.sh: shellcheck: Remove x-prefixes since we use Bash (SC2268)
- openjdk_news.sh: Set compile-command and indentation instructions for Emacs
- openjdk_news.sh: shellcheck: Double-quote variable references (SC2086)
- openjdk_news.sh: shellcheck: Remove x-prefixes since we use Bash (SC2268)
- openjdk_news.sh: shellcheck: Remove deprecated egrep usage (SC2196)
- Related: RHEL-30946 - Related: RHEL-30946
* Sun Apr 14 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:21.0.3.0.1-0.1.ea * Sun Apr 14 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:21.0.3.0.1-0.1.ea

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2020 Red Hat, Inc. # Copyright (C) 2024 Red Hat, Inc.
# Written by Andrew John Hughes <gnu.andrew@redhat.com>. # Written by Andrew John Hughes <gnu.andrew@redhat.com>.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -18,37 +18,44 @@
TREE=${1} TREE=${1}
if test "x${TREE}" = "x"; then if test "${TREE}" = ""; then
TREE=${PWD} TREE=${PWD}
fi fi
if [ -e ${TREE}/nashorn/.hg -o -e ${TREE}/nashorn/merge.changeset ] ; then if [ -e "${TREE}"/nashorn/.hg ] || [ -e "${TREE}"/nashorn/merge.changeset ] ; then
NASHORN="nashorn" ; NASHORN="nashorn" ;
fi fi
if [ -e ${TREE}/corba/.hg -o -e ${TREE}/corba/merge.changeset ] ; then if [ -e "${TREE}"/corba/.hg ] || [ -e "${TREE}"/corba/merge.changeset ] ; then
CORBA="corba"; CORBA="corba";
fi fi
if [ -e ${TREE}/jaxp/.hg -o -e ${TREE}/jaxp/merge.changeset ] ; then if [ -e "${TREE}"/jaxp/.hg ] || [ -e "${TREE}"/jaxp/merge.changeset ] ; then
JAXP="jaxp"; JAXP="jaxp";
fi fi
if [ -e ${TREE}/jaxws/.hg -o -e ${TREE}/jaxws/merge.changeset ] ; then if [ -e "${TREE}"/jaxws/.hg ] || [ -e "${TREE}"/jaxws/merge.changeset ] ; then
JAXWS="jaxws"; JAXWS="jaxws";
fi fi
if [ -e ${TREE}/langtools/.hg -o -e ${TREE}/langtools/merge.changeset ] ; then if [ -e "${TREE}"/langtools/.hg ] || [ -e "${TREE}"/langtools/merge.changeset ] ; then
LANGTOOLS="langtools"; LANGTOOLS="langtools";
fi fi
if [ -e ${TREE}/jdk/.hg -o -e ${TREE}/jdk/merge.changeset ] ; then if [ -e "${TREE}"/jdk/.hg ] || [ -e "${TREE}"/jdk/merge.changeset ] ; then
JDK="jdk"; JDK="jdk";
fi fi
if [ -e ${TREE}/hotspot/.hg -o -e ${TREE}/hotspot/merge.changeset ] ; then if [ -e "${TREE}"/hotspot/.hg ] || [ -e "${TREE}"/hotspot/merge.changeset ] ; then
HOTSPOT="hotspot"; HOTSPOT="hotspot";
fi fi
SUBTREES="${CORBA} ${JAXP} ${JAXWS} ${LANGTOOLS} ${NASHORN} ${JDK} ${HOTSPOT}"; SUBTREES="${CORBA} ${JAXP} ${JAXWS} ${LANGTOOLS} ${NASHORN} ${JDK} ${HOTSPOT}";
echo ${SUBTREES} echo "${SUBTREES}"
# Local Variables:
# compile-command: "shellcheck discover_trees.sh"
# fill-column: 80
# indent-tabs-mode: nil
# sh-basic-offset: 4
# End:

View File

@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
# Copyright (C) 2024 Red Hat, Inc. # Copyright (C) 2024 Red Hat, Inc.
# Written by:
# Andrew John Hughes <gnu.andrew@redhat.com>
# Thomas Fitzsimmons <fitzsim@redhat.com>
# Jiri Vanek <jvanek@redhat.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (C) 2019 Red Hat, Inc. # Copyright (C) 2024 Red Hat, Inc.
# Written by Andrew John Hughes <gnu.andrew@redhat.com>. # Written by Andrew John Hughes <gnu.andrew@redhat.com>.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -26,31 +26,31 @@ ICEDTEA_HG_URL=https://icedtea.classpath.org/hg/icedtea11
set -e set -e
RPM_DIR=${PWD} RPM_DIR=${PWD}
if [ ! -f ${RPM_DIR}/jconsole.desktop.in ] ; then if [ ! -f "${RPM_DIR}/jconsole.desktop.in" ] ; then
echo "Not in RPM source tree."; echo "Not in RPM source tree.";
exit 1; exit 1;
fi fi
if test "x${TMPDIR}" = "x"; then if test "${TMPDIR}" = ""; then
TMPDIR=/tmp; TMPDIR=/tmp;
fi fi
WORKDIR=${TMPDIR}/it.sync WORKDIR=${TMPDIR}/it.sync
echo "Using working directory ${WORKDIR}" echo "Using working directory ${WORKDIR}"
mkdir ${WORKDIR} mkdir "${WORKDIR}"
pushd ${WORKDIR} pushd "${WORKDIR}"
if test "x${WGET}" = "x"; then if test "${WGET}" = ""; then
WGET=$(which wget); WGET=$(which wget);
if test "x${WGET}" = "x"; then if test "${WGET}" = ""; then
echo "wget not found"; echo "wget not found";
exit 1; exit 1;
fi fi
fi fi
if test "x${TAR}" = "x"; then if test "${TAR}" = ""; then
TAR=$(which tar) TAR=$(which tar)
if test "x${TAR}" = "x"; then if test "${TAR}" = ""; then
echo "tar not found"; echo "tar not found";
exit 2; exit 2;
fi fi
@ -60,36 +60,36 @@ echo "Dependencies:";
echo -e "\tWGET: ${WGET}"; echo -e "\tWGET: ${WGET}";
echo -e "\tTAR: ${TAR}\n"; echo -e "\tTAR: ${TAR}\n";
if test "x${ICEDTEA_USE_VCS}" = "xtrue"; then if test "${ICEDTEA_USE_VCS}" = "true"; then
echo "Mode: Using VCS"; echo "Mode: Using VCS";
if test "x${GREP}" = "x"; then if test "${GREP}" = ""; then
GREP=$(which grep); GREP=$(which grep);
if test "x${GREP}" = "x"; then if test "${GREP}" = ""; then
echo "grep not found"; echo "grep not found";
exit 3; exit 3;
fi fi
fi fi
if test "x${CUT}" = "x"; then if test "${CUT}" = ""; then
CUT=$(which cut); CUT=$(which cut);
if test "x${CUT}" = "x"; then if test "${CUT}" = ""; then
echo "cut not found"; echo "cut not found";
exit 4; exit 4;
fi fi
fi fi
if test "x${TR}" = "x"; then if test "${TR}" = ""; then
TR=$(which tr); TR=$(which tr);
if test "x${TR}" = "x"; then if test "${TR}" = ""; then
echo "tr not found"; echo "tr not found";
exit 5; exit 5;
fi fi
fi fi
if test "x${HG}" = "x"; then if test "${HG}" = ""; then
HG=$(which hg); HG=$(which hg);
if test "x${HG}" = "x"; then if test "${HG}" = ""; then
echo "hg not found"; echo "hg not found";
exit 6; exit 6;
fi fi
@ -113,33 +113,33 @@ if test "x${ICEDTEA_USE_VCS}" = "xtrue"; then
ICEDTEA_VERSION="${ROOT_VER}-${VCS_REV}" ICEDTEA_VERSION="${ROOT_VER}-${VCS_REV}"
echo "Creating icedtea-${ICEDTEA_VERSION}"; echo "Creating icedtea-${ICEDTEA_VERSION}";
mkdir icedtea-${ICEDTEA_VERSION} mkdir "icedtea-${ICEDTEA_VERSION}"
echo "Copying required files from checkout to icedtea-${ICEDTEA_VERSION}"; echo "Copying required files from checkout to icedtea-${ICEDTEA_VERSION}";
# Commented out for now as IcedTea 6's jconsole.desktop.in is outdated # Commented out for now as IcedTea 6's jconsole.desktop.in is outdated
#cp -a icedtea/jconsole.desktop.in ../icedtea-${ICEDTEA_VERSION} #cp -a icedtea/jconsole.desktop.in ../icedtea-${ICEDTEA_VERSION}
cp -a ${RPM_DIR}/jconsole.desktop.in icedtea-${ICEDTEA_VERSION} cp -a "${RPM_DIR}/jconsole.desktop.in" "icedtea-${ICEDTEA_VERSION}"
cp -a icedtea/tapset icedtea-${ICEDTEA_VERSION} cp -a icedtea/tapset "icedtea-${ICEDTEA_VERSION}"
rm -rf icedtea rm -rf icedtea
else else
echo "Mode: Using tarball"; echo "Mode: Using tarball";
if test "x${ICEDTEA_VERSION}" = "x"; then if test "${ICEDTEA_VERSION}" = ""; then
echo "No IcedTea version specified for tarball download."; echo "No IcedTea version specified for tarball download.";
exit 3; exit 3;
fi fi
if test "x${CHECKSUM}" = "x"; then if test "${CHECKSUM}" = ""; then
CHECKSUM=$(which sha256sum) CHECKSUM=$(which sha256sum)
if test "x${CHECKSUM}" = "x"; then if test "${CHECKSUM}" = ""; then
echo "sha256sum not found"; echo "sha256sum not found";
exit 4; exit 4;
fi fi
fi fi
if test "x${PGP}" = "x"; then if test "${PGP}" = ""; then
PGP=$(which gpg) PGP=$(which gpg)
if test "x${PGP}" = "x"; then if test "${PGP}" = ""; then
echo "gpg not found"; echo "gpg not found";
exit 5; exit 5;
fi fi
@ -179,13 +179,20 @@ else
fi fi
echo "Replacing desktop files..."; echo "Replacing desktop files...";
mv -v icedtea-${ICEDTEA_VERSION}/jconsole.desktop.in ${RPM_DIR} mv -v "icedtea-${ICEDTEA_VERSION}/jconsole.desktop.in" "${RPM_DIR}"
echo "Creating new tapset tarball..."; echo "Creating new tapset tarball...";
mv -v icedtea-${ICEDTEA_VERSION} openjdk mv -v "icedtea-${ICEDTEA_VERSION}" openjdk
${TAR} cJf ${RPM_DIR}/tapsets-icedtea-${ICEDTEA_VERSION}.tar.xz openjdk ${TAR} cJf "${RPM_DIR}/tapsets-icedtea-${ICEDTEA_VERSION}.tar.xz" openjdk
rm -rvf openjdk rm -rvf openjdk
popd popd
rm -rf ${WORKDIR} rm -rf "${WORKDIR}"
# Local Variables:
# compile-command: "shellcheck icedtea_sync.sh"
# fill-column: 80
# indent-tabs-mode: nil
# sh-basic-offset: 4
# End:

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (C) 2022 Red Hat, Inc. # Copyright (C) 2024 Red Hat, Inc.
# Written by Andrew John Hughes <gnu.andrew@redhat.com>, 2012-2022 # Written by Andrew John Hughes <gnu.andrew@redhat.com>, 2012-2022
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -20,57 +20,64 @@ OLD_RELEASE=$1
NEW_RELEASE=$2 NEW_RELEASE=$2
REPO=$3 REPO=$3
SUBDIR=$4 SUBDIR=$4
SCRIPT_DIR=$(dirname ${0}) SCRIPT_DIR=$(dirname "${0}")
if test "x${SUBDIR}" = "x"; then if test "${SUBDIR}" = ""; then
echo "No subdirectory specified; using ."; echo "No subdirectory specified; using .";
SUBDIR="."; SUBDIR=".";
fi fi
if test "x$REPO" = "x"; then if test "$REPO" = ""; then
echo "No repository specified; using ${PWD}" echo "No repository specified; using ${PWD}"
REPO=${PWD} REPO=${PWD}
fi fi
if test x${TMPDIR} = x; then if test "${TMPDIR}" = ""; then
TMPDIR=/tmp; TMPDIR=/tmp;
fi fi
echo "Repository: ${REPO}" echo "Repository: ${REPO}"
if [ -e ${REPO}/.git ] ; then if [ -e "${REPO}/.git" ] ; then
TYPE=git; TYPE=git;
elif [ -e ${REPO}/.hg ] ; then elif [ -e "${REPO}/.hg" ] ; then
TYPE=hg; TYPE=hg;
else else
echo "No Mercurial or Git repository detected."; echo "No Mercurial or Git repository detected.";
exit 1; exit 1;
fi fi
if test "x$OLD_RELEASE" = "x" || test "x$NEW_RELEASE" = "x"; then if test "$OLD_RELEASE" = "" || test "$NEW_RELEASE" = ""; then
echo "ERROR: Need to specify old and new release"; echo "ERROR: Need to specify old and new release";
exit 2; exit 2;
fi fi
echo "Listing fixes between $OLD_RELEASE and $NEW_RELEASE in $REPO" echo "Listing fixes between $OLD_RELEASE and $NEW_RELEASE in $REPO"
rm -f ${TMPDIR}/fixes2 ${TMPDIR}/fixes3 ${TMPDIR}/fixes rm -f "${TMPDIR}/fixes2" "${TMPDIR}/fixes3" "${TMPDIR}/fixes"
for repos in . $(${SCRIPT_DIR}/discover_trees.sh ${REPO}); for repos in . $("${SCRIPT_DIR}/discover_trees.sh" "${REPO}");
do do
if test "x$TYPE" = "xhg"; then if test "$TYPE" = "hg"; then
hg log -r "tag('$NEW_RELEASE'):tag('$OLD_RELEASE') - tag('$OLD_RELEASE')" -R $REPO/$repos -G -M ${REPO}/${SUBDIR} | \ hg log -r "tag('$NEW_RELEASE'):tag('$OLD_RELEASE') - tag('$OLD_RELEASE')" -R "$REPO/$repos" -G -M "${REPO}/${SUBDIR}" | \
egrep '^[o:| ]*summary'|grep -v 'Added tag'|sed -r 's#^[o:| ]*summary:\W*([0-9])# - JDK-\1#'| \ grep -E '^[o:| ]*summary'|grep -v 'Added tag'|sed -r 's#^[o:| ]*summary:\W*([0-9])# - JDK-\1#'| \
sed 's#^[o:| ]*summary:\W*# - #' >> ${TMPDIR}/fixes2; sed 's#^[o:| ]*summary:\W*# - #' >> "${TMPDIR}/fixes2";
hg log -v -r "tag('$NEW_RELEASE'):tag('$OLD_RELEASE') - tag('$OLD_RELEASE')" -R $REPO/$repos -G -M ${REPO}/${SUBDIR} | \ hg log -v -r "tag('$NEW_RELEASE'):tag('$OLD_RELEASE') - tag('$OLD_RELEASE')" -R "$REPO/$repos" -G -M "${REPO}/${SUBDIR}" | \
egrep '^[o:| ]*[0-9]{7}'|sed -r 's#^[o:| ]*([0-9]{7})# - JDK-\1#' >> ${TMPDIR}/fixes3; grep -E '^[o:| ]*[0-9]{7}'|sed -r 's#^[o:| ]*([0-9]{7})# - JDK-\1#' >> "${TMPDIR}/fixes3";
else else
git -C ${REPO} log --no-merges --pretty=format:%B ${NEW_RELEASE}...${OLD_RELEASE} -- ${SUBDIR} |egrep '^[0-9]{7}' | \ git -C "${REPO}" log --no-merges --pretty=format:%B "${NEW_RELEASE}...${OLD_RELEASE}" -- "${SUBDIR}" |grep -E '^[0-9]{7}' | \
sed -r 's#^([0-9])# - JDK-\1#' >> ${TMPDIR}/fixes2; sed -r 's#^([0-9])# - JDK-\1#' >> "${TMPDIR}/fixes2";
touch ${TMPDIR}/fixes3 ; # unused touch "${TMPDIR}/fixes3" ; # unused
fi fi
done done
sort ${TMPDIR}/fixes2 ${TMPDIR}/fixes3 | uniq > ${TMPDIR}/fixes sort "${TMPDIR}/fixes2" "${TMPDIR}/fixes3" | uniq > "${TMPDIR}/fixes"
rm -f ${TMPDIR}/fixes2 ${TMPDIR}/fixes3 rm -f "${TMPDIR}/fixes2" "${TMPDIR}/fixes3"
echo "In ${TMPDIR}/fixes:" echo "In ${TMPDIR}/fixes:"
cat ${TMPDIR}/fixes cat "${TMPDIR}/fixes"
# Local Variables:
# compile-command: "shellcheck openjdk_news.sh"
# fill-column: 80
# indent-tabs-mode: nil
# sh-basic-offset: 4
# End: