Skip to content

Commit

Permalink
Release v2-verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Jul 9, 2024
1 parent c541c15 commit 4e1a461
Show file tree
Hide file tree
Showing 38 changed files with 161 additions and 161 deletions.
6 changes: 3 additions & 3 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ describe('Utils tests', () => {
});

it('checking suppressOutput', async () => {
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
expect(await utils.suppressOutput('win32')).toEqual(' ');
expect(await utils.suppressOutput('linux')).toEqual(' ');
expect(await utils.suppressOutput('darwin')).toEqual(' ');
expect(await utils.suppressOutput('openbsd')).toContain(
'Platform openbsd is not supported'
);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function addINIValuesUnix(
return (
'echo "' +
ini_values.join('\n') +
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" ' +
script
);
}
Expand Down
34 changes: 17 additions & 17 deletions src/scripts/darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ handle_dependency_extensions() {
suffix="$(get_php_formula_suffix)"
if [[ -n "$suffix" ]]; then
brew_opts=(-sf)
patch_abstract_file >/dev/null 2>&1
patch_abstract_file
for dependency_extension in "${dependency_extensions[@]}"; do
brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 && copy_brew_extensions "$dependency_extension"
brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" && copy_brew_extensions "$dependency_extension"
done
fi
}
Expand All @@ -31,7 +31,7 @@ disable_extension_helper() {
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
mkdir -p /tmp/extdisabled/"$version"
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
}

# Function to get extension name from brew formula.
Expand Down Expand Up @@ -70,9 +70,9 @@ add_brew_extension() {
add_brew_tap "$php_tap"
add_brew_tap "$ext_tap"
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "${core_repo:?}/Formula/" 2>/dev/null || true
update_dependencies >/dev/null 2>&1
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
update_dependencies
handle_dependency_extensions "$formula" "$extension"
(brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" && copy_brew_extensions "$formula") || pecl_install "$extension"
add_extension_log "$extension" "Installed and enabled"
fi
}
Expand All @@ -81,7 +81,7 @@ add_brew_extension() {
patch_abstract_file() {
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
echo '' | sudo tee /tmp/abstract_patch
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
fi
}
Expand All @@ -91,9 +91,9 @@ add_extension_helper() {
local extension=$1
prefix=$2
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
run_script "php5-darwin" "${version/./}" "$extension" >/dev/null 2>&1
run_script "php5-darwin" "${version/./}" "$extension"
else
pecl_install "$extension" >/dev/null 2>&1 &&
pecl_install "$extension" &&
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
fi
add_extension_log "$extension" "Installed and enabled"
Expand All @@ -107,8 +107,8 @@ add_devtools() {

# Function to handle request to add PECL.
add_pecl() {
enable_extension xml extension >/dev/null 2>&1
configure_pecl >/dev/null 2>&1
enable_extension xml extension
configure_pecl
pear_version=$(get_tool_version "pecl" "version")
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
}
Expand Down Expand Up @@ -138,7 +138,7 @@ update_dependencies() {
for repo in "$brew_repo" "$core_repo"; do
git_retry -C "$repo" fetch origin master && git -C "$repo" reset --hard origin/master
done
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
echo '' | sudo tee /tmp/update_dependencies
fi
}

Expand Down Expand Up @@ -196,7 +196,7 @@ add_php_config() {
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
elif [ "$ini" = "none" ]; then
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
echo '' | sudo tee "${ini_file[@]}"
fi
}

Expand All @@ -215,16 +215,16 @@ setup_php() {
php_config="$(command -v php-config 2>/dev/null)"
existing_version=$(get_brewed_php)
if [[ "$version" =~ ${old_versions:?} ]]; then
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
run_script "php5-darwin" "${version/./}"
status="Installed"
elif [ "$existing_version" != "$version" ]; then
add_php "install" "$existing_version" >/dev/null 2>&1
add_php "install" "$existing_version"
status="Installed"
elif [ "$existing_version" = "$version" ] && [ "${update:?}" = "true" ]; then
add_php "upgrade" "$existing_version" >/dev/null 2>&1
add_php "upgrade" "$existing_version"
status="Updated to"
else
add_php "upgrade" "$existing_version" >/dev/null 2>&1
add_php "upgrade" "$existing_version"
status="Updated to"
fi
php_config="$(command -v php-config)"
Expand Down
24 changes: 12 additions & 12 deletions src/scripts/extensions/add_extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enable_extension() {
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
enable_extension_dependencies "$1" "$2"
enable_cache_extension_dependencies "$1" "$2"
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod ; then
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
mod="${ini_dir:?}"/../mods-available/"$1".ini
if ! [ -e "$mod" ]; then
Expand All @@ -57,7 +57,7 @@ enable_extension() {
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
fi
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
sudo phpenmod -v "$version" "$1"
else
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
fi
Expand All @@ -69,15 +69,15 @@ enable_extensions() {
local extensions=("$@")
to_wait=()
for ext in "${extensions[@]}"; do
enable_extension "$ext" extension >/dev/null 2>&1 &
enable_extension "$ext" extension &
to_wait+=($!)
done
wait "${to_wait[@]}"
}

# Function to get a map of extensions and their dependent shared extensions.
get_extension_map() {
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig >/dev/null 2>&1
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig
}

# Function to enable extension dependencies which are also extensions.
Expand Down Expand Up @@ -123,7 +123,7 @@ disable_extension() {
disable_all_shared() {
get_extension_map
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
mkdir -p /tmp/extdisabled/"$version"
sudo rm -f /tmp/php"$version"_extensions
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
Expand All @@ -137,7 +137,7 @@ configure_pecl() {
for script in pear pecl; do
sudo "$script" channel-update "$script".php.net
done
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
echo '' | sudo tee /tmp/pecl_config
fi
}

Expand Down Expand Up @@ -175,8 +175,8 @@ get_pecl_version() {
pecl_install() {
local extension=$1
local prefix=${2:-extension}
add_pecl >/dev/null 2>&1
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
add_pecl
disable_extension_helper "${extension%-*}"
# Compare version with 8.3 so it runs only on 8.4 and above
# Install using the source interface as it allows for patching.
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
Expand All @@ -189,11 +189,11 @@ pecl_install() {
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
(( ${#libraries[@]} )) && add_libs "${libraries[@]}"
if [ "$version" = "5.3" ]; then
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension"
else
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension"
fi
local exit_code=$?
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
Expand All @@ -216,7 +216,7 @@ add_pecl_extension() {
add_log "${tick:?}" "$extension" "Enabled"
else
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1
pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")"
extension_version="$(php -r "echo phpversion('$extension');")"
[ -n "$extension_version" ] && extension_version="-$extension_version"
add_extension_log "$extension$extension_version" "Installed and enabled"
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/extensions/blackfire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ add_blackfire() {
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
fi
fi
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so >/dev/null 2>&1
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so
fi
if [ -e "${ext_dir:?}/blackfire.so" ]; then
disable_extension xdebug >/dev/null 2>&1
disable_extension pcov >/dev/null 2>&1
disable_extension xdebug
disable_extension pcov
enable_extension blackfire extension
add_extension_log blackfire "$status"
else
Expand Down
8 changes: 4 additions & 4 deletions src/scripts/extensions/couchbase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ add_couchbase() {
ext=$(get_couchbase_version)
fi
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
add_couchbase_clibs "$ext" >/dev/null 2>&1
add_couchbase_clibs "$ext"
else
add_couchbase_cxxlibs >/dev/null 2>&1
add_couchbase_cxxlibs
fi
enable_extension "couchbase" "extension"
if check_extension "couchbase"; then
Expand All @@ -72,9 +72,9 @@ add_couchbase() {
n_proc="$(nproc)"
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl
else
pecl_install "${ext}" >/dev/null 2>&1
pecl_install "${ext}"
fi
add_extension_log "couchbase" "Installed and enabled"
fi
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/extensions/cubrid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ add_cubrid_helper() {
add_cubrid() {
ext=$1
status='Enabled'
add_cubrid_helper "$ext" >/dev/null 2>&1
add_cubrid_helper "$ext"
add_extension_log "$ext" "$status"
check_extension "$ext" && add_license_log
}
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/extensions/event.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ add_event() {
add_log "${tick:?}" "event" "Enabled"
else
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
add_brew_extension event extension >/dev/null 2>&1
add_brew_extension event extension
else
add_event_helper "$ext" >/dev/null 2>&1
add_event_helper "$ext"
fi
add_extension_log "event" "Installed and enabled"
fi
Expand Down
8 changes: 4 additions & 4 deletions src/scripts/extensions/firebird.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ add_firebird_helper() {

add_firebird() {
if [ "$(uname -s )" = "Darwin" ]; then
add_firebird_client_darwin >/dev/null 2>&1
add_firebird_client_darwin
fi
enable_extension pdo_firebird extension
status="Enabled"
if ! check_extension pdo_firebird; then
status="Installed and enabled"
if [ "$(uname -s)" = "Linux" ]; then
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
add_firebird_helper /usr >/dev/null 2>&1
add_firebird_helper /usr
else
add_pdo_extension firebird >/dev/null 2>&1
add_pdo_extension firebird
fi
else
add_firebird_helper /opt/firebird >/dev/null 2>&1
add_firebird_helper /opt/firebird
fi
fi
add_extension_log pdo_firebird "$status"
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/extensions/gearman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_gearman_helper() {
add_gearman() {
status="Enabled"
if [ "$(uname -s)" = 'Linux' ]; then
add_gearman_helper >/dev/null 2>&1
add_gearman_helper
add_extension_log "gearman" "$status"
else
add_brew_extension gearman extension
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/extensions/geos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_geos() {
if check_extension "geos"; then
add_log "${tick:?}" "geos" "Enabled"
else
add_geos_helper >/dev/null 2>&1
add_geos_helper
add_extension_log "geos" "Installed and enabled"
fi
}
8 changes: 4 additions & 4 deletions src/scripts/extensions/http.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ Function Repair-ICU() {
}

Function Add-Http() {
Add-Extension iconv >$null 2>&1
Add-Extension raphf >$null 2>&1
Add-Extension iconv
Add-Extension raphf
if($version -lt '8.0') {
Add-Extension propro >$null 2>&1
Add-Extension propro
}
Add-Extension pecl_http >$null 2>&1
Add-Extension pecl_http
Repair-ICU
Add-ExtensionLog http "Installed and enabled"
}
6 changes: 3 additions & 3 deletions src/scripts/extensions/http.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ add_http_latest() {
if [ "$os" = "Linux" ]; then
add_http_dependencies
package="php$version-http"
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
add_ppa ondrej/php || update_ppa ondrej/php
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
else
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
Expand Down Expand Up @@ -103,9 +103,9 @@ add_http() {
ext=$1
status="Enabled"
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
add_http_latest >/dev/null 2>&1
add_http_latest
else
add_http_version "$ext" >/dev/null 2>&1
add_http_version "$ext"
fi
add_extension_log "http" "$status"
}
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/extensions/intl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ add_intl() {
add_log "${cross:?}" "intl" "ICU $icu is not supported"
else
[ "${ts:?}" = 'zts' ] && suffix='-zts'
install_icu "$icu" >/dev/null 2>&1
install_icu "$icu"
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix.so"
enable_extension intl extension
add_extension_log intl "Installed and enabled with ICU $icu"
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/extensions/ioncube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ add_ioncube() {
if [ -e "$loader_file" ]; then
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
fi
else
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
fi
add_extension_log "ioncube" "$status"
check_extension "ioncube" && add_license_log
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/extensions/oci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ add_oci() {
oracle_home='/opt/oracle'
oracle_client=$oracle_home/instantclient
os=$(uname -s)
add_client >/dev/null 2>&1
add_oci_helper >/dev/null 2>&1
add_client
add_oci_helper
add_extension_log "$ext" "$status"
check_extension "$ext" && add_license_log
}
Expand Down
Loading

0 comments on commit 4e1a461

Please sign in to comment.