mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Improve PECL support
This commit is contained in:
parent
5a40a5875d
commit
8dbd6b7684
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -2882,7 +2882,7 @@ async function addExtensionDarwin(extension_csv, version) {
|
||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(version_extension):
|
||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||
return;
|
||||
// match semver
|
||||
@ -2948,8 +2948,8 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version);
|
||||
case /.*-(stable|beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version.replace('stable', ''));
|
||||
break;
|
||||
// match semver without state
|
||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||
@ -3029,7 +3029,7 @@ async function addExtensionLinux(extension_csv, version) {
|
||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(version_extension):
|
||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||
return;
|
||||
// match semver versions
|
||||
|
@ -43,7 +43,9 @@ export async function addExtensionDarwin(
|
||||
);
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
||||
version_extension
|
||||
):
|
||||
add_script += await utils.joins(
|
||||
'\nadd_unstable_extension',
|
||||
ext_name,
|
||||
@ -135,11 +137,11 @@ export async function addExtensionWindows(
|
||||
);
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
case /.*-(stable|beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\nAdd-Extension',
|
||||
ext_name,
|
||||
ext_version
|
||||
ext_version.replace('stable', '')
|
||||
);
|
||||
break;
|
||||
// match semver without state
|
||||
@ -246,7 +248,9 @@ export async function addExtensionLinux(
|
||||
);
|
||||
return;
|
||||
// match pre-release versions. For example - xdebug-beta
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
||||
version_extension
|
||||
):
|
||||
add_script += await utils.joins(
|
||||
'\nadd_unstable_extension',
|
||||
ext_name,
|
||||
|
@ -112,7 +112,7 @@ enable_extension() {
|
||||
|
||||
# Function to configure PECL.
|
||||
configure_pecl() {
|
||||
if ! [ -e /tmp/pecl_config ] && command -v pecl >/dev/null; then
|
||||
if ! [ -e /tmp/pecl_config ] && command -v pecl >/dev/null && command -v pear >/dev/null; then
|
||||
for script in pear pecl; do
|
||||
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}"
|
||||
sudo "$script" channel-update "$script".php.net
|
||||
@ -124,7 +124,7 @@ configure_pecl() {
|
||||
# Function to get the PECL version of an extension.
|
||||
get_pecl_version() {
|
||||
extension=$1
|
||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
||||
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
||||
pecl_rest='https://pecl.php.net/rest/r/'
|
||||
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
||||
pecl_version=$(echo "$response" | grep -m 1 -Eio "([0-9]+\.[0-9]+\.[0-9]+${stability}[0-9]+)")
|
||||
@ -137,6 +137,7 @@ get_pecl_version() {
|
||||
# Function to install PECL extensions and accept default options
|
||||
pecl_install() {
|
||||
local extension=$1
|
||||
configure_pecl >/dev/null 2>&1
|
||||
yes '' 2>/dev/null | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,6 @@ setup_php() {
|
||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
|
||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||
add_log "$tick" "PHP" "$status PHP $semver"
|
||||
}
|
||||
|
@ -160,9 +160,7 @@ add_devtools() {
|
||||
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
|
||||
if command -v pecl >/dev/null; then
|
||||
configure_pecl >/dev/null 2>&1
|
||||
fi
|
||||
configure_pecl >/dev/null 2>&1
|
||||
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
||||
}
|
||||
|
||||
@ -174,7 +172,6 @@ setup_nightly() {
|
||||
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
||||
setup_old_versions() {
|
||||
run_script "php5-ubuntu" "$version"
|
||||
configure_pecl
|
||||
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user