Add thread-safe setup support

This commit is contained in:
Flavio Heleno 2022-10-05 19:31:52 -03:00
parent a49dfe8457
commit f99a9d4624
No known key found for this signature in database
GPG Key ID: 8DE5B81C51FFA733
5 changed files with 12 additions and 10 deletions

View File

@ -173,7 +173,7 @@ add_php() {
existing_version=$2 existing_version=$2
add_brew_tap "$php_tap" add_brew_tap "$php_tap"
update_dependencies update_dependencies
[ "${debug:?}" = "debug" ] && php_formula="$php_formula-debug" [ "${build:?}" = "debug" ] && php_formula="$php_formula-debug"
if [ "$existing_version" != "false" ]; then if [ "$existing_version" != "false" ]; then
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula" ([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
else else

View File

@ -146,7 +146,7 @@ add_extension_from_source() {
add_log "${cross:?}" "$source" "$source does not have a PHP extension" add_log "${cross:?}" "$source" "$source does not have a PHP extension"
else else
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries" [[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug" [ "${build:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
patch_extension "$extension" >/dev/null 2>&1 patch_extension "$extension" >/dev/null 2>&1
run_group "phpize" "phpize" run_group "phpize" "phpize"
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"

View File

@ -76,7 +76,7 @@ check_package() {
add_extension_helper() { add_extension_helper() {
local extension=$1 local extension=$1
packages=(php"$version"-"$extension") packages=(php"$version"-"$extension")
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym) [ "${build:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension" (check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
add_extension_log "$extension" "Installed and enabled" add_extension_log "$extension" "Installed and enabled"
@ -96,7 +96,7 @@ add_devtools() {
# Function to setup the nightly build from shivammathur/php-builder # Function to setup the nightly build from shivammathur/php-builder
setup_nightly() { setup_nightly() {
run_script "php-builder" "${runner:?}" "$version" "${debug:?}" run_script "php-builder" "${runner:?}" "$version" "${build:?}"
} }
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5. # Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
@ -137,7 +137,7 @@ switch_version() {
# Function to get packages to install # Function to get packages to install
get_php_packages() { get_php_packages() {
sed "s/[^ ]*/php$version-&/g" "$src"/configs/php_packages | tr '\n' ' ' sed "s/[^ ]*/php$version-&/g" "$src"/configs/php_packages | tr '\n' ' '
if [ "${debug:?}" = "debug" ]; then if [ "${build:?}" = "debug" ]; then
sed "s/[^ ]*/php$version-&-dbgsym/g" "$src"/configs/php_debug_packages | tr '\n' ' ' sed "s/[^ ]*/php$version-&-dbgsym/g" "$src"/configs/php_debug_packages | tr '\n' ' '
fi fi
} }
@ -149,7 +149,7 @@ add_packaged_php() {
IFS=' ' read -r -a packages <<<"$(get_php_packages)" IFS=' ' read -r -a packages <<<"$(get_php_packages)"
install_packages "${packages[@]}" install_packages "${packages[@]}"
else else
run_script "php-ubuntu" "$version" "${debug:?}" run_script "php-ubuntu" "$version" "${build:?}"
fi fi
} }
@ -167,7 +167,7 @@ update_php() {
# Function to install PHP. # Function to install PHP.
add_php() { add_php() {
if [[ "$version" =~ ${nightly_versions:?} ]]; then if [[ "$version" =~ ${nightly_versions:?} ]] || [[ "${build:?}" = "thread-safe" ]]; then
setup_nightly setup_nightly
elif [[ "$version" =~ ${old_versions:?} ]]; then elif [[ "$version" =~ ${old_versions:?} ]]; then
setup_old_versions setup_old_versions

View File

@ -154,10 +154,10 @@ add_ppa() {
ppa=${1:-ondrej/php} ppa=${1:-ondrej/php}
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
add_list "$ppa" add_list "$ppa"
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug" [ "${build:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug" [ "${build:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
else else
add_list "$ppa" add_list "$ppa"
fi fi

View File

@ -50,7 +50,9 @@ set_output() {
# Function to read env inputs. # Function to read env inputs.
read_env() { read_env() {
update="${update:-${UPDATE:-false}}" update="${update:-${UPDATE:-false}}"
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release build=release
[ "${debug:-${DEBUG:-false}}" = "true" ] && build=debug && update=true
[ "${phpts:-${PHPTS:-nts}}" = "ts" ] && build="thread-safe" && update=true
fail_fast="${fail_fast:-${FAIL_FAST:-false}}" fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
[[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github [[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github
runner="${runner:-${RUNNER:-$_runner}}" runner="${runner:-${RUNNER:-$_runner}}"