Fix coding style
parent
7748bb159a
commit
1ba29d90cf
|
@ -69,8 +69,7 @@ getPHPInstalledModules () {
|
||||||
for getPHPInstalledModules_module in $(php -m); do
|
for getPHPInstalledModules_module in $(php -m); do
|
||||||
getPHPInstalledModules_moduleNormalized=''
|
getPHPInstalledModules_moduleNormalized=''
|
||||||
case "$getPHPInstalledModules_module" in
|
case "$getPHPInstalledModules_module" in
|
||||||
\[PHP\ Modules\])
|
\[PHP\ Modules\]) ;;
|
||||||
;;
|
|
||||||
\[Zend\ Modules\])
|
\[Zend\ Modules\])
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
@ -688,7 +687,7 @@ getInstalledPackageVersion() {
|
||||||
compareVersions() {
|
compareVersions() {
|
||||||
compareVersions_v1="$1.0.0"
|
compareVersions_v1="$1.0.0"
|
||||||
compareVersions_v2="$2.0.0"
|
compareVersions_v2="$2.0.0"
|
||||||
compareVersions_vMin="$(printf '%s\n%s' "${compareVersions_v1}" "${compareVersions_v2}" | sort -t '.' -n -k1,1 -k2,2 -k3,3 | head -n 1)"
|
compareVersions_vMin="$(printf '%s\n%s' "$compareVersions_v1" "$compareVersions_v2" | sort -t '.' -n -k1,1 -k2,2 -k3,3 | head -n 1)"
|
||||||
if test "$compareVersions_vMin" != "$compareVersions_v1"; then
|
if test "$compareVersions_vMin" != "$compareVersions_v1"; then
|
||||||
echo '1'
|
echo '1'
|
||||||
elif test "$compareVersions_vMin" = "$compareVersions_v2"; then
|
elif test "$compareVersions_vMin" = "$compareVersions_v2"; then
|
||||||
|
@ -1123,10 +1122,10 @@ cleanup () {
|
||||||
resetIFS
|
resetIFS
|
||||||
PHP_MAJMIN_VERSION=$(getPHPMajorMinor)
|
PHP_MAJMIN_VERSION=$(getPHPMajorMinor)
|
||||||
case "$PHP_MAJMIN_VERSION" in
|
case "$PHP_MAJMIN_VERSION" in
|
||||||
506|700|701|702|703|704)
|
506 | 700 | 701 | 702 | 703 | 704) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
printf "### ERROR: Unsupported PHP version: %s.%s ###\n" $((PHP_MAJMIN_VERSION / 100)) $((PHP_MAJMIN_VERSION % 100))
|
printf "### ERROR: Unsupported PHP version: %s.%s ###\n" $((PHP_MAJMIN_VERSION / 100)) $((PHP_MAJMIN_VERSION % 100))
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
UNNEEDED_PACKAGE_LINKS=''
|
UNNEEDED_PACKAGE_LINKS=''
|
||||||
processCommandArguments "$@"
|
processCommandArguments "$@"
|
||||||
|
|
|
@ -17,10 +17,8 @@ resetIFS () {
|
||||||
# 1 (false): if the string is not in the list
|
# 1 (false): if the string is not in the list
|
||||||
stringInList() {
|
stringInList() {
|
||||||
resetIFS
|
resetIFS
|
||||||
for stringInList_listItem in ${2}
|
for stringInList_listItem in $2; do
|
||||||
do
|
if test "$1" = "$stringInList_listItem"; then
|
||||||
if test "${1}" = "${stringInList_listItem}"
|
|
||||||
then
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -38,17 +36,14 @@ stringInList () {
|
||||||
commonElements() {
|
commonElements() {
|
||||||
commonElements_result=''
|
commonElements_result=''
|
||||||
resetIFS
|
resetIFS
|
||||||
for commonElements_inA in ${1}
|
for commonElements_inA in $1; do
|
||||||
do
|
if stringInList "$commonElements_inA" "$2"; then
|
||||||
if stringInList "${commonElements_inA}" "${2}"
|
if test -z "$commonElements_result"; then
|
||||||
then
|
commonElements_result="$commonElements_inA"
|
||||||
if test -z "${commonElements_result}"
|
|
||||||
then
|
|
||||||
commonElements_result="${commonElements_inA}"
|
|
||||||
else
|
else
|
||||||
commonElements_result="${commonElements_result} ${commonElements_inA}"
|
commonElements_result="$commonElements_result $commonElements_inA"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "${commonElements_result}"
|
echo "$commonElements_result"
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,7 @@ getDockerImageName () {
|
||||||
alpine3.4)
|
alpine3.4)
|
||||||
# available for PHP from version 5.6 to version 7.1
|
# available for PHP from version 5.6 to version 7.1
|
||||||
case "$2" in
|
case "$2" in
|
||||||
5.*|7.0|7.1)
|
5.* | 7.0 | 7.1) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
@ -53,8 +52,7 @@ getDockerImageName () {
|
||||||
alpine3.6)
|
alpine3.6)
|
||||||
# available for PHP 7.2
|
# available for PHP 7.2
|
||||||
case "$2" in
|
case "$2" in
|
||||||
7.2)
|
7.2) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
@ -67,8 +65,7 @@ getDockerImageName () {
|
||||||
7.0)
|
7.0)
|
||||||
#getDockerImageName_distro='-alpine'
|
#getDockerImageName_distro='-alpine'
|
||||||
;;
|
;;
|
||||||
5.*|7.1|7.2)
|
5.* | 7.1 | 7.2) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
@ -81,8 +78,7 @@ getDockerImageName () {
|
||||||
5.6)
|
5.6)
|
||||||
#getDockerImageName_distro='-alpine'
|
#getDockerImageName_distro='-alpine'
|
||||||
;;
|
;;
|
||||||
5.*|7.1|7.2|7.3)
|
5.* | 7.1 | 7.2 | 7.3) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
@ -91,8 +87,7 @@ getDockerImageName () {
|
||||||
alpine3.9)
|
alpine3.9)
|
||||||
# available for PHP from version 7.1 to version 7.3
|
# available for PHP from version 7.1 to version 7.3
|
||||||
case "$2" in
|
case "$2" in
|
||||||
7.1|7.2|7.3)
|
7.1 | 7.2 | 7.3) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
@ -113,8 +108,7 @@ getDockerImageName () {
|
||||||
jessie) # Debian 8
|
jessie) # Debian 8
|
||||||
# available for PHP up to version 7.1
|
# available for PHP up to version 7.1
|
||||||
case "$2" in
|
case "$2" in
|
||||||
5.*|7.0|7.1)
|
5.* | 7.0 | 7.1) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
@ -127,8 +121,7 @@ getDockerImageName () {
|
||||||
5.* | 7.0)
|
5.* | 7.0)
|
||||||
#getDockerImageName_distro=''
|
#getDockerImageName_distro=''
|
||||||
;;
|
;;
|
||||||
7.1|7.2|7.3)
|
7.1 | 7.2 | 7.3) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
@ -154,7 +147,6 @@ getDockerImageName () {
|
||||||
printf 'php:%s%s%s' "$getDockerImageName_version" "$getDockerImageName_suffix" "$getDockerImageName_distro"
|
printf 'php:%s%s%s' "$getDockerImageName_version" "$getDockerImageName_suffix" "$getDockerImageName_distro"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Test an extension
|
# Test an extension
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -176,7 +168,7 @@ testExtension () {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
printf ' - Docker image: %s\n' "$testExtension_Image"
|
printf ' - Docker image: %s\n' "$testExtension_Image"
|
||||||
testExtension_out=`mktemp`
|
testExtension_out="$(mktemp)"
|
||||||
if $(docker run --rm --volume "$TRAVIS_BUILD_DIR:/app" --workdir /app "$testExtension_Image" sh -c "./install-php-extensions $1 && php ./scripts/check-installed-extension.php $1" >"$testExtension_out" 2>&1); then
|
if $(docker run --rm --volume "$TRAVIS_BUILD_DIR:/app" --workdir /app "$testExtension_Image" sh -c "./install-php-extensions $1 && php ./scripts/check-installed-extension.php $1" >"$testExtension_out" 2>&1); then
|
||||||
rm -rf "$testExtension_out"
|
rm -rf "$testExtension_out"
|
||||||
printf ' - Passed\n'
|
printf ' - Passed\n'
|
||||||
|
@ -188,7 +180,6 @@ testExtension () {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Test a new extension line
|
# Test a new extension line
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -223,7 +214,6 @@ testNewExtensionLine () {
|
||||||
return $testNewExtensionLine_rc
|
return $testNewExtensionLine_rc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Get the list of all supported PHP versions
|
# Get the list of all supported PHP versions
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -289,7 +279,6 @@ getAllPHPVersionsForExtension () {
|
||||||
printf '%s' "$getAllPHPVersionsForExtension_result"
|
printf '%s' "$getAllPHPVersionsForExtension_result"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Test extensions by reading a commit message
|
# Test extensions by reading a commit message
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -308,7 +297,6 @@ testExtensionsFromMessage () {
|
||||||
testExtensionsFromMessage_message="$(git -C "$TRAVIS_BUILD_DIR" log --pretty='format:%B' -n 1 "$1")"
|
testExtensionsFromMessage_message="$(git -C "$TRAVIS_BUILD_DIR" log --pretty='format:%B' -n 1 "$1")"
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
|
|
||||||
for COMMIT_LINE in $testExtensionsFromMessage_message; do
|
for COMMIT_LINE in $testExtensionsFromMessage_message; do
|
||||||
if test $FIRST_LINE -eq 1; then
|
if test $FIRST_LINE -eq 1; then
|
||||||
FIRST_LINE=0
|
FIRST_LINE=0
|
||||||
|
@ -331,7 +319,7 @@ testExtensionsFromMessage () {
|
||||||
if test $COMMIT_LINE_EXT = '-STOP-'; then
|
if test $COMMIT_LINE_EXT = '-STOP-'; then
|
||||||
STOP_NEXT_COMMITS=1
|
STOP_NEXT_COMMITS=1
|
||||||
elif test -z "$TEST_EXTENSIONS"; then
|
elif test -z "$TEST_EXTENSIONS"; then
|
||||||
TEST_EXTENSIONS=$COMMIT_LINE_EXT;
|
TEST_EXTENSIONS=$COMMIT_LINE_EXT
|
||||||
else
|
else
|
||||||
if ! stringInList "$COMMIT_LINE_EXT" "$TEST_EXTENSIONS"; then
|
if ! stringInList "$COMMIT_LINE_EXT" "$TEST_EXTENSIONS"; then
|
||||||
TEST_EXTENSIONS="$TEST_EXTENSIONS $COMMIT_LINE_EXT"
|
TEST_EXTENSIONS="$TEST_EXTENSIONS $COMMIT_LINE_EXT"
|
||||||
|
@ -380,7 +368,6 @@ for DIFF_LINE in $(git -C "$TRAVIS_BUILD_DIR" diff --no-indent-heuristic --minim
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
for COMMIT_HASH in $(git -C "$TRAVIS_BUILD_DIR" log --pretty='format:%H' "$TRAVIS_COMMIT_RANGE"); do
|
for COMMIT_HASH in $(git -C "$TRAVIS_BUILD_DIR" log --pretty='format:%H' "$TRAVIS_COMMIT_RANGE"); do
|
||||||
|
|
|
@ -9,19 +9,15 @@ UPDATE_README_COMMIT_AUTHOR_EMAIL='michele@locati.it'
|
||||||
UPDATE_README_COMMIT_MESSAGE='[skip ci] Automatically update README.md'
|
UPDATE_README_COMMIT_MESSAGE='[skip ci] Automatically update README.md'
|
||||||
WATCHED_FILES='data/special-requirements data/supported-extensions scripts/common scripts/update-readme scripts/travisci-update-readme'
|
WATCHED_FILES='data/special-requirements data/supported-extensions scripts/common scripts/update-readme scripts/travisci-update-readme'
|
||||||
|
|
||||||
SCRIPTS_DIR="$(CDPATH= cd -- "$(dirname -- "${0}")" && pwd)"
|
SCRIPTS_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||||
. "${SCRIPTS_DIR}/common"
|
. "$SCRIPTS_DIR/common"
|
||||||
|
|
||||||
|
|
||||||
echo 'Checking environment'
|
echo 'Checking environment'
|
||||||
if test -z "${TRAVIS_BUILD_DIR:-}" || test -z "${TRAVIS_BRANCH:-}" || test -z "${TRAVIS_EVENT_TYPE:-}" || test -z "${TRAVIS_REPO_SLUG:-}"
|
if test -z "${TRAVIS_BUILD_DIR:-}" || test -z "${TRAVIS_BRANCH:-}" || test -z "${TRAVIS_EVENT_TYPE:-}" || test -z "${TRAVIS_REPO_SLUG:-}"; then
|
||||||
then
|
|
||||||
echo 'Not in a TravisCI environment' >&2
|
echo 'Not in a TravisCI environment' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if test -z "${GUTHUB_ACCESS_TOKEN:-}"
|
if test -z "${GUTHUB_ACCESS_TOKEN:-}"; then
|
||||||
then
|
|
||||||
|
|
||||||
echo 'GitHub access token not set' >&2
|
echo 'GitHub access token not set' >&2
|
||||||
# To create it:
|
# To create it:
|
||||||
# - go to https://github.com/settings/tokens/new?scopes=repo
|
# - go to https://github.com/settings/tokens/new?scopes=repo
|
||||||
|
@ -35,47 +31,43 @@ then
|
||||||
# - secure: "encrypted string"
|
# - secure: "encrypted string"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if test "${TRAVIS_EVENT_TYPE}" != 'push'
|
if test "$TRAVIS_EVENT_TYPE" != 'push'; then
|
||||||
then
|
|
||||||
echo 'This script should only be run in push builds' >&2
|
echo 'This script should only be run in push builds' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'Checking-out branch %s\n' "${TRAVIS_BRANCH}"
|
printf 'Checking-out branch %s\n' "$TRAVIS_BRANCH"
|
||||||
git checkout --force "${TRAVIS_BRANCH}"
|
git checkout --force "$TRAVIS_BRANCH"
|
||||||
|
|
||||||
LAST_AUTO_UPDATED_IN="$(git -C "${TRAVIS_BUILD_DIR}" rev-list --max-count 1 --author "<${UPDATE_README_COMMIT_AUTHOR_EMAIL}>" --grep "${UPDATE_README_COMMIT_MESSAGE}" "${TRAVIS_BRANCH}")"
|
LAST_AUTO_UPDATED_IN="$(git -C "$TRAVIS_BUILD_DIR" rev-list --max-count 1 --author "<$UPDATE_README_COMMIT_AUTHOR_EMAIL>" --grep "$UPDATE_README_COMMIT_MESSAGE" "$TRAVIS_BRANCH")"
|
||||||
if test -z "${LAST_AUTO_UPDATED_IN}"
|
if test -z "$LAST_AUTO_UPDATED_IN"; then
|
||||||
then
|
printf 'Rebuild of README.md enabled (no previous automatic refresh of it in branch %s)\n' "$TRAVIS_BRANCH"
|
||||||
printf 'Rebuild of README.md enabled (no previous automatic refresh of it in branch %s)\n' "${TRAVIS_BRANCH}"
|
|
||||||
else
|
else
|
||||||
MODIFIED_FILES_SINCE="$(git -C "${TRAVIS_BUILD_DIR}" diff --name-only "${LAST_AUTO_UPDATED_IN}...${TRAVIS_BRANCH}")"
|
MODIFIED_FILES_SINCE="$(git -C "$TRAVIS_BUILD_DIR" diff --name-only "$LAST_AUTO_UPDATED_IN...$TRAVIS_BRANCH")"
|
||||||
if test -z "$(commonElements "${WATCHED_FILES}" "${MODIFIED_FILES_SINCE}")"
|
if test -z "$(commonElements "$WATCHED_FILES" "$MODIFIED_FILES_SINCE")"; then
|
||||||
then
|
printf 'Rebuild of README.md not needed (no relevant files changed in branch %s since commit %s)\n' "$TRAVIS_BRANCH" "$LAST_AUTO_UPDATED_IN"
|
||||||
printf 'Rebuild of README.md not needed (no relevant files changed in branch %s since commit %s)\n' "${TRAVIS_BRANCH}" "${LAST_AUTO_UPDATED_IN}"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
printf 'Rebuild of README.md enabled (relevant files changed in branch %s since commit %s)\n' "${TRAVIS_BRANCH}" "${LAST_AUTO_UPDATED_IN}"
|
printf 'Rebuild of README.md enabled (relevant files changed in branch %s since commit %s)\n' "$TRAVIS_BRANCH" "$LAST_AUTO_UPDATED_IN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'Updating README.md'
|
echo 'Updating README.md'
|
||||||
"${TRAVIS_BUILD_DIR}/scripts/update-readme"
|
"$TRAVIS_BUILD_DIR/scripts/update-readme"
|
||||||
if test -z "$(git -C "${TRAVIS_BUILD_DIR}" ls-files -m | grep -E '^README\.md$')"
|
if test -z "$(git -C "$TRAVIS_BUILD_DIR" ls-files -m | grep -E '^README\.md$')"; then
|
||||||
then
|
|
||||||
echo 'README.md has not been changed'
|
echo 'README.md has not been changed'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'Adding %s remote\n' "${TRAVIS_REPO_SLUG}"
|
printf 'Adding %s remote\n' "$TRAVIS_REPO_SLUG"
|
||||||
git remote add deploy "https://${GUTHUB_ACCESS_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git"
|
git remote add deploy "https://$GUTHUB_ACCESS_TOKEN@github.com/$TRAVIS_REPO_SLUG.git"
|
||||||
|
|
||||||
echo 'Committing changes to README.md'
|
echo 'Committing changes to README.md'
|
||||||
git -C "${TRAVIS_BUILD_DIR}" config user.name "${UPDATE_README_COMMIT_AUTHOR_NAME}"
|
git -C "$TRAVIS_BUILD_DIR" config user.name "$UPDATE_README_COMMIT_AUTHOR_NAME"
|
||||||
git -C "${TRAVIS_BUILD_DIR}" config user.email "${UPDATE_README_COMMIT_AUTHOR_EMAIL}"
|
git -C "$TRAVIS_BUILD_DIR" config user.email "$UPDATE_README_COMMIT_AUTHOR_EMAIL"
|
||||||
git -C "${TRAVIS_BUILD_DIR}" add README.md
|
git -C "$TRAVIS_BUILD_DIR" add README.md
|
||||||
git -C "${TRAVIS_BUILD_DIR}" commit -m "${UPDATE_README_COMMIT_MESSAGE}"
|
git -C "$TRAVIS_BUILD_DIR" commit -m "$UPDATE_README_COMMIT_MESSAGE"
|
||||||
|
|
||||||
printf 'Pushing to %s\n' "${TRAVIS_REPO_SLUG}"
|
printf 'Pushing to %s\n' "$TRAVIS_REPO_SLUG"
|
||||||
git push deploy "${TRAVIS_BRANCH}"
|
git push deploy "$TRAVIS_BRANCH"
|
||||||
|
|
||||||
echo 'Done.'
|
echo 'Done.'
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
|
|
||||||
SCRIPTS_DIR="$(CDPATH= cd -- "$(dirname -- "${0}")" && pwd)"
|
SCRIPTS_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||||
ROOT_DIR="$(dirname -- "${SCRIPTS_DIR}")"
|
ROOT_DIR="$(dirname -- "$SCRIPTS_DIR")"
|
||||||
DATA_DIR="${ROOT_DIR}/data"
|
DATA_DIR="$ROOT_DIR/data"
|
||||||
|
|
||||||
. "${SCRIPTS_DIR}/common"
|
|
||||||
|
|
||||||
|
. "$SCRIPTS_DIR/common"
|
||||||
|
|
||||||
# Get the list of PHP extensions from the data file
|
# Get the list of PHP extensions from the data file
|
||||||
#
|
#
|
||||||
|
@ -21,22 +20,21 @@ getExtensionList () {
|
||||||
getExtensionList_extensions=''
|
getExtensionList_extensions=''
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
for getExtensionList_line in $(cat -- "${1}" | sort); do
|
for getExtensionList_line in $(cat -- "$1" | sort); do
|
||||||
getExtensionList_extension=''
|
getExtensionList_extension=''
|
||||||
IFS=' '
|
IFS=' '
|
||||||
for getExtensionList_chunk in ${getExtensionList_line}; do
|
for getExtensionList_chunk in $getExtensionList_line; do
|
||||||
if test -z "${getExtensionList_extensions}"; then
|
if test -z "$getExtensionList_extensions"; then
|
||||||
getExtensionList_extensions="${getExtensionList_chunk}"
|
getExtensionList_extensions="$getExtensionList_chunk"
|
||||||
else
|
else
|
||||||
getExtensionList_extensions="${getExtensionList_extensions} ${getExtensionList_chunk}"
|
getExtensionList_extensions="$getExtensionList_extensions $getExtensionList_chunk"
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
printf '%s' "${getExtensionList_extensions}"
|
printf '%s' "$getExtensionList_extensions"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Get the list of PHP versions from the data file
|
# Get the list of PHP versions from the data file
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -48,23 +46,22 @@ getVersionList () {
|
||||||
getVersionList_versions=''
|
getVersionList_versions=''
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
for getVersionList_line in $(cat -- "${1}" | sort); do
|
for getVersionList_line in $(cat -- "$1" | sort); do
|
||||||
getVersionList_extension=''
|
getVersionList_extension=''
|
||||||
IFS=' '
|
IFS=' '
|
||||||
for getVersionList_chunk in ${getVersionList_line}; do
|
for getVersionList_chunk in $getVersionList_line; do
|
||||||
if test -z "${getVersionList_extension}"; then
|
if test -z "$getVersionList_extension"; then
|
||||||
getVersionList_extension="${getVersionList_chunk}"
|
getVersionList_extension="$getVersionList_chunk"
|
||||||
elif test -z "${getVersionList_versions}"; then
|
elif test -z "$getVersionList_versions"; then
|
||||||
getVersionList_versions="${getVersionList_chunk}"
|
getVersionList_versions="$getVersionList_chunk"
|
||||||
elif ! stringInList "${getVersionList_chunk}" "${getVersionList_versions}"; then
|
elif ! stringInList "$getVersionList_chunk" "$getVersionList_versions"; then
|
||||||
getVersionList_versions="${getVersionList_versions} ${getVersionList_chunk}"
|
getVersionList_versions="$getVersionList_versions $getVersionList_chunk"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
sortVersionList "${getVersionList_versions}"
|
sortVersionList "$getVersionList_versions"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Sort the list of PHP versions
|
# Sort the list of PHP versions
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -76,17 +73,16 @@ sortVersionList () {
|
||||||
sortVersionList_list=''
|
sortVersionList_list=''
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
for sortVersionList_version in $(printf '%s' "${1}" | tr ' ' '\n' | sort -t '.' -k 1,1n -k 2,2n -k 3,3n); do
|
for sortVersionList_version in $(printf '%s' "$1" | tr ' ' '\n' | sort -t '.' -k 1,1n -k 2,2n -k 3,3n); do
|
||||||
if test -z "${sortVersionList_list}"; then
|
if test -z "$sortVersionList_list"; then
|
||||||
sortVersionList_list="${sortVersionList_version}"
|
sortVersionList_list="$sortVersionList_version"
|
||||||
else
|
else
|
||||||
sortVersionList_list="${sortVersionList_list} ${sortVersionList_version}"
|
sortVersionList_list="$sortVersionList_list $sortVersionList_version"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf '%s' "${sortVersionList_list}"
|
printf '%s' "$sortVersionList_list"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Generate the markdown table with the supported PHP extensions
|
# Generate the markdown table with the supported PHP extensions
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -95,40 +91,40 @@ sortVersionList () {
|
||||||
# Output:
|
# Output:
|
||||||
# the markdown table
|
# the markdown table
|
||||||
generateExtensionsTable() {
|
generateExtensionsTable() {
|
||||||
generateExtensionsTable_data=$(cat "${1}")
|
generateExtensionsTable_data=$(cat "$1")
|
||||||
generateExtensionsTable_extensions="$(getExtensionList "${1}")"
|
generateExtensionsTable_extensions="$(getExtensionList "$1")"
|
||||||
generateExtensionsTable_versions="$(getVersionList "${1}")"
|
generateExtensionsTable_versions="$(getVersionList "$1")"
|
||||||
generateExtensionsTable_count=0
|
generateExtensionsTable_count=0
|
||||||
printf '| Extension |'
|
printf '| Extension |'
|
||||||
IFS=' '
|
IFS=' '
|
||||||
for generateExtensionsTable_version in ${generateExtensionsTable_versions}; do
|
for generateExtensionsTable_version in $generateExtensionsTable_versions; do
|
||||||
printf ' PHP %s |' "${generateExtensionsTable_version}"
|
printf ' PHP %s |' "$generateExtensionsTable_version"
|
||||||
done
|
done
|
||||||
printf '\n'
|
printf '\n'
|
||||||
printf '|:---:|'
|
printf '|:---:|'
|
||||||
for generateExtensionsTable_version in ${generateExtensionsTable_versions}; do
|
for generateExtensionsTable_version in $generateExtensionsTable_versions; do
|
||||||
printf -- ':---:|'
|
printf -- ':---:|'
|
||||||
done
|
done
|
||||||
printf '\n'
|
printf '\n'
|
||||||
IFS=' '
|
IFS=' '
|
||||||
for generateExtensionsTable_extension in ${generateExtensionsTable_extensions}; do
|
for generateExtensionsTable_extension in $generateExtensionsTable_extensions; do
|
||||||
generateExtensionsTable_count=$((generateExtensionsTable_count + 1))
|
generateExtensionsTable_count=$((generateExtensionsTable_count + 1))
|
||||||
printf '| %s |' "${generateExtensionsTable_extension}"
|
printf '| %s |' "$generateExtensionsTable_extension"
|
||||||
IFS=' '
|
IFS=' '
|
||||||
for generateExtensionsTable_version in ${generateExtensionsTable_versions}; do
|
for generateExtensionsTable_version in $generateExtensionsTable_versions; do
|
||||||
printf ' '
|
printf ' '
|
||||||
generateExtensionsTable_versionOk=''
|
generateExtensionsTable_versionOk=''
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
for generateExtensionsTable_dataLine in ${generateExtensionsTable_data}; do
|
for generateExtensionsTable_dataLine in $generateExtensionsTable_data; do
|
||||||
if stringInList "${generateExtensionsTable_extension}" "${generateExtensionsTable_dataLine}"; then
|
if stringInList "$generateExtensionsTable_extension" "$generateExtensionsTable_dataLine"; then
|
||||||
if stringInList "${generateExtensionsTable_version}" "${generateExtensionsTable_dataLine}"; then
|
if stringInList "$generateExtensionsTable_version" "$generateExtensionsTable_dataLine"; then
|
||||||
generateExtensionsTable_versionOk='y'
|
generateExtensionsTable_versionOk='y'
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if test -n "${generateExtensionsTable_versionOk}"; then
|
if test -n "$generateExtensionsTable_versionOk"; then
|
||||||
printf 'V'
|
printf 'V'
|
||||||
fi
|
fi
|
||||||
printf ' |'
|
printf ' |'
|
||||||
|
@ -139,7 +135,6 @@ generateExtensionsTable () {
|
||||||
printf '*Number of supported extensions: %s*\n' $generateExtensionsTable_count
|
printf '*Number of supported extensions: %s*\n' $generateExtensionsTable_count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Generate the markdown table with the special requirements for the PHP extensions
|
# Generate the markdown table with the special requirements for the PHP extensions
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -151,26 +146,25 @@ generateSpecialRequirementsTable () {
|
||||||
generateSpecialRequirementsTable_started=''
|
generateSpecialRequirementsTable_started=''
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
for generateSpecialRequirementsTable_line in $(cat -- "${1}" | sort); do
|
for generateSpecialRequirementsTable_line in $(cat -- "$1" | sort); do
|
||||||
if test -z "${generateSpecialRequirementsTable_started}"; then
|
if test -z "$generateSpecialRequirementsTable_started"; then
|
||||||
printf '| Extension | Requirements |\n'
|
printf '| Extension | Requirements |\n'
|
||||||
printf '|:---:|:---:|\n'
|
printf '|:---:|:---:|\n'
|
||||||
generateSpecialRequirementsTable_started='y'
|
generateSpecialRequirementsTable_started='y'
|
||||||
fi
|
fi
|
||||||
resetIFS
|
resetIFS
|
||||||
generateSpecialRequirementsTable_requirement="$(echo "${generateSpecialRequirementsTable_line}" | sed -E 's/^\s*\w+\s+//')"
|
generateSpecialRequirementsTable_requirement="$(echo "$generateSpecialRequirementsTable_line" | sed -E 's/^\s*\w+\s+//')"
|
||||||
case "${generateSpecialRequirementsTable_requirement}" in
|
case "$generateSpecialRequirementsTable_requirement" in
|
||||||
zts)
|
zts)
|
||||||
generateSpecialRequirementsTable_requirement='Requires images with PHP compiled with thread-safety enabled (`zts`).'
|
generateSpecialRequirementsTable_requirement='Requires images with PHP compiled with thread-safety enabled (`zts`).'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
printf '| %s | %s |\n' \
|
printf '| %s | %s |\n' \
|
||||||
"$(echo "${generateSpecialRequirementsTable_line}" | awk '{print $1;}')" \
|
"$(echo "$generateSpecialRequirementsTable_line" | awk '{print $1;}')" \
|
||||||
"${generateSpecialRequirementsTable_requirement}"
|
"$generateSpecialRequirementsTable_requirement"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Generate the contents of README.md
|
# Generate the contents of README.md
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
@ -187,13 +181,13 @@ generateReadme () {
|
||||||
generateReadme_ph_SpecialEnd='<!-- END OF SPECIAL REQUIREMENTS -->'
|
generateReadme_ph_SpecialEnd='<!-- END OF SPECIAL REQUIREMENTS -->'
|
||||||
generateReadme_skip=''
|
generateReadme_skip=''
|
||||||
while IFS= read -r generateReadme_line; do
|
while IFS= read -r generateReadme_line; do
|
||||||
if test "${generateReadme_line}" = "${generateReadme_ph_ExtensionsEnd}" || test "${generateReadme_line}" = "${generateReadme_ph_SpecialEnd}"; then
|
if test "$generateReadme_line" = "$generateReadme_ph_ExtensionsEnd" || test "$generateReadme_line" = "$generateReadme_ph_SpecialEnd"; then
|
||||||
generateReadme_skip=''
|
generateReadme_skip=''
|
||||||
fi
|
fi
|
||||||
if test -z "${generateReadme_skip}"; then
|
if test -z "$generateReadme_skip"; then
|
||||||
printf '%s\n' "${generateReadme_line}"
|
printf '%s\n' "$generateReadme_line"
|
||||||
fi
|
fi
|
||||||
if test "${generateReadme_line}" = "${generateReadme_ph_ExtensionsStart}"; then
|
if test "$generateReadme_line" = "$generateReadme_ph_ExtensionsStart"; then
|
||||||
generateReadme_skip='y'
|
generateReadme_skip='y'
|
||||||
printf '<!-- ########################################################### -->\n'
|
printf '<!-- ########################################################### -->\n'
|
||||||
printf '<!-- # # -->\n'
|
printf '<!-- # # -->\n'
|
||||||
|
@ -202,8 +196,8 @@ generateReadme () {
|
||||||
printf '<!-- # EDIT THE data/supported-extensions FILE INSTEAD # -->\n'
|
printf '<!-- # EDIT THE data/supported-extensions FILE INSTEAD # -->\n'
|
||||||
printf '<!-- # # -->\n'
|
printf '<!-- # # -->\n'
|
||||||
printf '<!-- ########################################################### -->\n'
|
printf '<!-- ########################################################### -->\n'
|
||||||
generateExtensionsTable "${2}"
|
generateExtensionsTable "$2"
|
||||||
elif test "${generateReadme_line}" = "${generateReadme_ph_SpecialStart}"; then
|
elif test "$generateReadme_line" = "$generateReadme_ph_SpecialStart"; then
|
||||||
generateReadme_skip='y'
|
generateReadme_skip='y'
|
||||||
printf '<!-- ########################################################### -->\n'
|
printf '<!-- ########################################################### -->\n'
|
||||||
printf '<!-- # # -->\n'
|
printf '<!-- # # -->\n'
|
||||||
|
@ -212,11 +206,11 @@ generateReadme () {
|
||||||
printf '<!-- # EDIT THE data/special-requirements FILE INSTEAD # -->\n'
|
printf '<!-- # EDIT THE data/special-requirements FILE INSTEAD # -->\n'
|
||||||
printf '<!-- # # -->\n'
|
printf '<!-- # # -->\n'
|
||||||
printf '<!-- ########################################################### -->\n'
|
printf '<!-- ########################################################### -->\n'
|
||||||
generateSpecialRequirementsTable "${3}"
|
generateSpecialRequirementsTable "$3"
|
||||||
fi
|
fi
|
||||||
done < "${1}"
|
done <"$1"
|
||||||
printf '%s' "${generateReadme_line}"
|
printf '%s' "$generateReadme_line"
|
||||||
}
|
}
|
||||||
|
|
||||||
NEW_README="$(generateReadme "${ROOT_DIR}/README.md" "${DATA_DIR}/supported-extensions" "${DATA_DIR}/special-requirements")"
|
NEW_README="$(generateReadme "$ROOT_DIR/README.md" "$DATA_DIR/supported-extensions" "$DATA_DIR/special-requirements")"
|
||||||
printf '%s\n' "${NEW_README}" > "${ROOT_DIR}/README.md"
|
printf '%s\n' "$NEW_README" >"$ROOT_DIR/README.md"
|
||||||
|
|
Loading…
Reference in New Issue