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