GHA: add shellcheck job and fix warnings, shell tidy-ups

Reviewed-by: Daniel Stenberg
Closes #13307
This commit is contained in:
Viktor Szakats 2024-04-07 10:02:49 +00:00
parent 2c4f836f70
commit fa69b41c77
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
12 changed files with 441 additions and 415 deletions

View file

@ -29,21 +29,21 @@
# RELEASE-NOTES.
#
start=$1
set -eu
start="${1:-}"
if test "$start" = "-h"; then
echo "Usage: $0 <since this tag/hash> [--releasenotes]"
exit
echo "Usage: $0 <since this tag/hash> [--releasenotes]"
exit
fi
if test -z "$start"; then
start=`git tag --sort=taggerdate | grep "^curl-" | tail -1`;
echo "Since $start:"
start=$(git tag --sort=taggerdate | grep "^curl-" | tail -1)
echo "Since $start:"
fi
# We also include curl-www if possible. Override by setting CURLWWW
if [ -z "$CURLWWW" ] ; then
CURLWWW=../curl-www
fi
CURLWWW="${CURLWWW:-../curl-www}"
# filter out Author:, Commit: and *by: lines
# cut off the email parts
@ -55,31 +55,30 @@ fi
# sort all unique names
# awk them into RELEASE-NOTES format
(
(
git log --pretty=full --use-mailmap $start..HEAD
if [ -d "$CURLWWW" ]
then
git -C "$CURLWWW" log --pretty=full --use-mailmap $start..HEAD
fi
) | \
grep -Eai '(^Author|^Commit|by):' | \
cut -d: -f2- | \
cut '-d(' -f1 | \
cut '-d<' -f1 | \
tr , '\012' | \
sed 's/ at github/ on github/' | \
sed 's/ and /\n/' | \
sed -e 's/^ *//' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
{
{
git log --pretty=full --use-mailmap "$start..HEAD"
if [ -d "$CURLWWW" ]; then
git -C "$CURLWWW" log --pretty=full --use-mailmap "$start..HEAD"
fi
} | \
grep -Eai '(^Author|^Commit|by):' | \
cut -d: -f2- | \
cut '-d(' -f1 | \
cut '-d<' -f1 | \
tr , '\012' | \
sed 's/ at github/ on github/' | \
sed 's/ and /\n/' | \
sed -e 's/^ *//' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
grep -a "^ [^ \(]" RELEASE-NOTES| \
sed 's/, */\n/g'| \
sed 's/^ *//'
)| \
grep -a "^ [^ \(]" RELEASE-NOTES| \
sed 's/, */\n/g'| \
sed 's/^ *//'
} | \
sed -f ./docs/THANKS-filter | \
sort -fu | \
awk '{
awk '
{
if(length($0)) {
num++;
n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
@ -92,10 +91,9 @@ awk '{
}
}
END {
pp=substr(p,1,length(p)-1);
printf(" %s\n", pp);
printf(" (%d contributors)\n", num);
}
END {
pp=substr(p,1,length(p)-1);
printf(" %s\n", pp);
printf(" (%d contributors)\n", num);
}
'

View file

@ -28,50 +28,46 @@
# puts them at the end of the THANKS document on stdout
#
start=$1
set -eu
start="${1:-}"
if test "$start" = "-h"; then
echo "Usage: $0 <since this tag/hash>"
exit
fi
if test -z "$start"; then
start=`git tag --sort=taggerdate | grep "^curl-" | tail -1`;
start=$(git tag --sort=taggerdate | grep "^curl-" | tail -1)
fi
# We also include curl-www if possible. Override by setting CURLWWW
if [ -z "$CURLWWW" ] ; then
CURLWWW=../curl-www
fi
CURLWWW="${CURLWWW:-../curl-www}"
cat ./docs/THANKS
(
(
git log --use-mailmap $start..HEAD
if [ -d "$CURLWWW" ]
then
git -C ../curl-www log --use-mailmap $start..HEAD
fi
) | \
{
{
git log --use-mailmap "$start..HEAD"
if [ -d "$CURLWWW" ]; then
git -C ../curl-www log --use-mailmap "$start..HEAD"
fi
} | \
grep -Eai '(^Author|^Commit|by):' | \
cut -d: -f2- | \
cut '-d(' -f1 | \
cut '-d<' -f1 | \
tr , '\012' | \
sed 's/ at github/ on github/' | \
sed 's/ and /\n/' | \
sed -e 's/^ //' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
grep -Eai '(^Author|^Commit|by):' | \
cut -d: -f2- | \
cut '-d(' -f1 | \
cut '-d<' -f1 | \
tr , '\012' | \
sed 's/ at github/ on github/' | \
sed 's/ and /\n/' | \
sed -e 's/^ //' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
# grep out the list of names from RELEASE-NOTES
# split on ", "
# remove leading whitespace
grep -a "^ [^ (]" RELEASE-NOTES| \
sed 's/, */\n/g'| \
sed 's/^ *//'
)| \
# grep out the list of names from RELEASE-NOTES
# split on ", "
# remove leading whitespace
grep -a "^ [^ (]" RELEASE-NOTES| \
sed 's/, */\n/g'| \
sed 's/^ *//'
} | \
sed -f ./docs/THANKS-filter | \
sort -fu | \
grep -aixvf ./docs/THANKS

View file

@ -23,6 +23,8 @@
#
###########################################################################
set -eu
autoreconf -fi
mkdir -p cvr
cd cvr

View file

@ -26,8 +26,11 @@
# It extracts all ca certs it finds in the local Firefox database and converts
# them all into PEM format.
#
db=$(ls -1d $HOME/.mozilla/firefox/*default*)
out=$1
set -eu
db=$(ls -1d "$HOME"/.mozilla/firefox/*default*)
out="${1:-}"
if test -z "$out"; then
out="ca-bundle.crt" # use a sensible default
@ -35,7 +38,7 @@ fi
currentdate=$(date)
cat >$out <<EOF
cat > "$out" <<EOF
##
## Bundle of CA Root Certificates
##
@ -52,4 +55,4 @@ sort | \
while read -r nickname; \
do echo "$nickname" | sed -e "s/Builtin Object Token://g"; \
eval certutil -d "$db" -L -n "$nickname" -a ; \
done >> $out
done >> "$out"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
@ -23,28 +23,30 @@
#
###########################################################################
PREFIX=$1
set -eu
PREFIX="${1:-}"
# Run this script in the root of the git clone. Point out the install prefix
# where 'make install' has already installed curl.
if test -z "$1"; then
echo "scripts/installcheck.sh [PREFIX]"
exit
if test -z "$PREFIX"; then
echo "scripts/installcheck.sh [PREFIX]"
exit
fi
diff -u <(find docs/libcurl/ -name "*.3" -printf "%f\n" | grep -v template| sort) <(find $PREFIX/share/man/ -name "*.3" -printf "%f\n" | sort)
diff -u <(find docs/libcurl/ -name "*.3" -printf "%f\n" | grep -v template | sort) <(find "$PREFIX/share/man/" -name "*.3" -printf "%f\n" | sort)
if test "$?" -ne "0"; then
echo "ERROR: installed libcurl docs mismatch"
exit 2
echo "ERROR: installed libcurl docs mismatch"
exit 2
fi
diff -u <(find include/ -name "*.h" -printf "%f\n" | sort) <(find $PREFIX/include/ -name "*.h" -printf "%f\n" | sort)
diff -u <(find include/ -name "*.h" -printf "%f\n" | sort) <(find "$PREFIX/include/" -name "*.h" -printf "%f\n" | sort)
if test "$?" -ne "0"; then
echo "ERROR: installed include files mismatch"
exit 1
echo "ERROR: installed include files mismatch"
exit 1
fi
echo "installcheck: installed libcurl docs and include files look good"

View file

@ -23,6 +23,8 @@
#
###########################################################################
set -eu
cat <<MOO
# Release tools
@ -31,14 +33,14 @@ produce this release tarball.
MOO
exists=`which dpkg`;
exists=$(command -v dpkg 2>/dev/null)
if test ! -e "$exists"; then
echo "(unknown, could not find dpkg)"
exit
echo "(unknown, could not find dpkg)"
exit
fi
debian() {
echo - $1: `dpkg -l $1 | grep ^ii | awk '{print $3}'`
echo "- $1: $(dpkg -l "$1" | grep ^ii | awk '{print $3}')"
}
debian autoconf
debian automake