Release v1-verbose

This commit is contained in:
Shivam Mathur 2022-04-10 03:10:28 +05:30
parent 28c92ba4ee
commit bc71c880ee
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
8 changed files with 68 additions and 68 deletions

View File

@ -207,9 +207,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'
);

4
dist/index.js vendored
View File

@ -1023,10 +1023,10 @@ exports.getExtensionPrefix = getExtensionPrefix;
async function suppressOutput(os_version) {
switch (os_version) {
case 'win32':
return ' >$null 2>&1';
return ' ';
case 'linux':
case 'darwin':
return ' >/dev/null 2>&1';
return ' ';
default:
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
}

View File

@ -20,8 +20,8 @@ add_log() {
remove_extension() {
local extension=$1
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
sudo rm -rf "$scan_dir"/*"$extension"*
sudo rm -rf "$ext_dir"/"$extension".so
}
# Function to test if extension is loaded
@ -37,7 +37,7 @@ check_extension() {
# Function to install PECL extensions and accept default options
pecl_install() {
local extension=$1
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
yes '' | sudo pecl install -f "$extension"
}
# Function to get the PECL version
@ -70,7 +70,7 @@ add_pecl_extension() {
else
remove_extension "$extension"
(
pecl_install "$extension-$pecl_version" >/dev/null 2>&1 &&
pecl_install "$extension-$pecl_version" &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
@ -93,9 +93,9 @@ fetch_brew_tap() {
add_brew_tap() {
tap=$1
if ! [ -d "$tap_dir/$tap" ]; then
fetch_brew_tap "$tap" >/dev/null 2>&1
fetch_brew_tap "$tap"
if ! [ -d "$tap_dir/$tap" ]; then
brew tap "$tap" >/dev/null 2>&1
brew tap "$tap"
fi
fi
}
@ -123,7 +123,7 @@ add_extension() {
add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then
(
eval "$install_command" >/dev/null 2>&1 &&
eval "$install_command" &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
@ -188,15 +188,15 @@ add_tool() {
if [ "$tool" = "composer" ]; then
configure_composer "$tool_path"
elif [ "$tool" = "phan" ]; then
add_extension fileinfo "pecl_install fileinfo" extension >/dev/null 2>&1
add_extension ast "pecl_install ast" extension >/dev/null 2>&1
add_extension fileinfo "pecl_install fileinfo" extension
add_extension ast "pecl_install ast" extension
elif [ "$tool" = "phive" ]; then
add_extension curl "pecl_install curl" extension >/dev/null 2>&1
add_extension mbstring "pecl_install mbstring" extension >/dev/null 2>&1
add_extension xml "pecl_install xml" extension >/dev/null 2>&1
add_extension curl "pecl_install curl" extension
add_extension mbstring "pecl_install mbstring" extension
add_extension xml "pecl_install xml" extension
elif [ "$tool" = "cs2pr" ]; then
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" && sudo mv "$tool_path.tmp" "$tool_path"
sudo chmod a+x "$tool_path"
fi
add_log "$tick" "$tool" "Added"
@ -211,8 +211,8 @@ add_composertool() {
release=$2
prefix=$3
(
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
composer global require "$prefix$release" >/dev/null 2>&1 &&
sudo rm -f "$composer_lock" || true
composer global require "$prefix$release" &&
add_log "$tick" "$tool" "Added"
) || add_log "$cross" "$tool" "Could not setup $tool"
if [ -e "$composer_bin/composer" ]; then
@ -226,8 +226,8 @@ add_composertool() {
# Function to configure PECL
configure_pecl() {
for tool in pear pecl; do
sudo "$tool" config-set php_ini "$ini_file" >/dev/null 2>&1
sudo "$tool" channel-update "$tool".php.net >/dev/null 2>&1
sudo "$tool" config-set php_ini "$ini_file"
sudo "$tool" channel-update "$tool".php.net
done
}
@ -273,7 +273,7 @@ update_dependencies() {
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
wait "${to_wait[@]}"
fi
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
echo '' | sudo tee /tmp/update_dependencies
fi
}
@ -328,7 +328,7 @@ export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
# Setup PHP
step_log "Setup PHP"
if [ "$existing_version" != "$version" ]; then
setup_php >/dev/null 2>&1
setup_php
status="Installed"
else
status="Found"

View File

@ -13,7 +13,7 @@ add_gearman_helper() {
# Function to add gearman extension.
add_gearman() {
status="Enabled"
add_gearman_helper >/dev/null 2>&1
add_gearman_helper
if check_extension gearman; then
add_log "${tick:?}" "gearman" "$status"
fi

View File

@ -13,7 +13,7 @@ add_log() {
# Function to update php ppa
update_ppa() {
if [ "$ppa_updated" = "false" ]; then
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::Etc::sourcelist="{}" ';'
ppa_updated="true"
fi
}
@ -22,7 +22,7 @@ update_ppa() {
install_phalcon() {
local extension=$1
version=$2
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
}
@ -36,7 +36,7 @@ cross="✗"
if [ "$extension_major_version" = "4" ]; then
if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
echo "extension=psr.so" | sudo tee -a "$ini_file"
fi
if [ -e "$ext_dir/phalcon.so" ]; then
@ -45,7 +45,7 @@ if [ "$extension_major_version" = "4" ]; then
if [ "$phalcon_version" != "$extension_major_version" ]; then
install_phalcon "$1" "$2"
else
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
echo "extension=phalcon.so" | sudo tee -a "$ini_file"
add_log "$tick" "$1" "Enabled"
fi
else
@ -62,7 +62,7 @@ if [ "$extension_major_version" = "3" ]; then
if [ "$phalcon_version" != "$extension_major_version" ]; then
install_phalcon "$1" "$2"
else
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
echo "extension=phalcon.so" | sudo tee -a "$ini_file"
add_log "$tick" "$1" "Enabled"
fi
else

View File

@ -39,10 +39,10 @@ add_ppa() {
# Function to update the package lists.
update_lists() {
if [ ! -e /tmp/setup_php ]; then
add_ppa ondrej/php >/dev/null 2>&1
add_ppa ondrej/php
cleanup_lists
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
echo '' | sudo tee /tmp/setup_php >/dev/null 2>&1
sudo "$debconf_fix" apt-get update
echo '' | sudo tee /tmp/setup_php
fi
}
@ -50,13 +50,13 @@ update_lists() {
configure_pecl() {
if ! [ -e /tmp/pecl_config ]; then
if ! command -v pecl >/dev/null || ! command -v pear >/dev/null; then
add_pecl >/dev/null 2>&1
add_pecl
fi
for script in pear pecl; do
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}" >/dev/null 2>&1
sudo "$script" channel-update "$script".php.net >/dev/null 2>&1
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}"
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
}
@ -76,7 +76,7 @@ get_pecl_version() {
# Function to install PECL extensions and accept default options
pecl_install() {
local extension=$1
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
yes '' | sudo pecl install -f "$extension"
}
# Function to enable existing extensions.
@ -102,8 +102,8 @@ delete_extension() {
local extension=$1
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
sudo rm -rf "$scan_dir"/*"$extension"*
sudo rm -rf "$ext_dir"/"$extension".so
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
}
@ -125,8 +125,8 @@ add_extension() {
if check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then
eval "$install_command" >/dev/null 2>&1 ||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
eval "$install_command" ||
(update_lists && eval "$install_command" ) || pecl_install "$extension"
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
@ -149,7 +149,7 @@ add_pecl_extension() {
else
delete_extension "$extension"
(
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
sudo pecl install -f "$extension-$pecl_version" &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
@ -216,9 +216,9 @@ add_tool() {
elif [ "$tool" = "cs2pr" ]; then
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
elif [ "$tool" = "phive" ]; then
add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1
add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
add_extension curl "$apt_install php$version-curl" extension
add_extension mbstring "$apt_install php$version-mbstring" extension
add_extension xml "$apt_install php$version-xml" extension
fi
add_log "$tick" "$tool" "Added"
else
@ -233,8 +233,8 @@ add_composertool() {
release=$2
prefix=$3
(
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
composer global require "$prefix$release" >/dev/null 2>&1 &&
sudo rm -f "$composer_lock" || true
composer global require "$prefix$release" &&
add_log "$tick" "$tool" "Added"
) || add_log "$cross" "$tool" "Could not setup $tool"
if [ -e "$composer_bin/composer" ]; then
@ -248,10 +248,10 @@ add_composertool() {
# Function to setup phpize and php-config
add_devtools() {
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
update_lists && $apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
update_lists && $apt_install php"$version"-dev php"$version"-xml
fi
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
configure_pecl
}
@ -274,7 +274,7 @@ add_packaged_php() {
add_pecl() {
add_devtools
if [ ! -e /usr/bin/pecl ]; then
$apt_install php-pear >/dev/null 2>&1
$apt_install php-pear
fi
configure_pecl
add_log "$tick" "PECL" "Added"
@ -330,16 +330,16 @@ sudo mkdir -m 777 -p "$HOME/.composer" /var/run /run/php
if [ "$existing_version" != "$version" ]; then
if [ ! -e "/usr/bin/php$version" ]; then
if [ "$version" = "8.0" ]; then
setup_master >/dev/null 2>&1
setup_master
else
add_packaged_php >/dev/null 2>&1
add_packaged_php
fi
status="Installed"
else
status="Switched to"
fi
switch_version >/dev/null 2>&1
switch_version
else
status="Found"
fi
@ -353,9 +353,9 @@ scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
pecl_file="$scan_dir"/99-pecl.ini
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
echo '' | sudo tee "$pecl_file"
configure_php
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
sudo rm -rf /usr/local/bin/phpunit
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -188,7 +188,7 @@ Function Add-Tool() {
if($url.Count -gt 1) { $url = $url[0] }
if ($tool -eq "symfony") {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe" >$null 2>&1
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe"
} else {
try {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
@ -208,16 +208,16 @@ Function Add-Tool() {
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
$bat_content += "php %BIN_TARGET% %*"
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat"
if($tool -eq "composer") {
Edit-ComposerConfig $php_dir\$tool
} elseif($tool -eq "cs2pr") {
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
} elseif($tool -eq "phan") {
Add-Extension fileinfo >$null 2>&1
Add-Extension ast >$null 2>&1
Add-Extension fileinfo
Add-Extension ast
} elseif($tool -eq "phive") {
Add-Extension xml >$null 2>&1
Add-Extension xml
} elseif($tool -eq "wp-cli") {
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
}
@ -286,12 +286,12 @@ if($env:PHPTS -ne 'ts') {
$env:PHPTS = 'nts'
}
if(-not(Test-Path -LiteralPath $current_profile)) {
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
New-Item -Path $current_profile -ItemType "file" -Force
}
Add-Printf >$null 2>&1
Add-Printf
Step-Log "Setup PhpManager"
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php
Add-Log $tick "PhpManager" "Installed"
Step-Log "Setup PHP"
@ -304,7 +304,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
$status = "Installed"
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList
}
try {
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1

View File

@ -305,10 +305,10 @@ export async function getExtensionPrefix(extension: string): Promise<string> {
export async function suppressOutput(os_version: string): Promise<string> {
switch (os_version) {
case 'win32':
return ' >$null 2>&1';
return ' ';
case 'linux':
case 'darwin':
return ' >/dev/null 2>&1';
return ' ';
default:
return await log(
'Platform ' + os_version + ' is not supported',