Improve regexes for pre-release extensions

This commit is contained in:
Shivam Mathur 2020-11-16 02:55:14 +05:30
parent 5865982519
commit fa211a9d07
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ pecl_install() {
# Function to get the PECL version # Function to get the PECL version
get_pecl_version() { get_pecl_version() {
extension=$1 extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")" stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
pecl_rest='https://pecl.php.net/rest/r/' pecl_rest='https://pecl.php.net/rest/r/'
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml) response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)") pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)")
@ -58,7 +58,7 @@ add_pecl_extension() {
extension=$1 extension=$1
pecl_version=$2 pecl_version=$2
prefix=$3 prefix=$3
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
pecl_version=$(get_pecl_version "$extension" "$pecl_version") pecl_version=$(get_pecl_version "$extension" "$pecl_version")
fi fi
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then

View File

@ -49,7 +49,7 @@ configure_pecl() {
# Function to get the PECL version # Function to get the PECL version
get_pecl_version() { get_pecl_version() {
extension=$1 extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")" stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
pecl_rest='https://pecl.php.net/rest/r/' pecl_rest='https://pecl.php.net/rest/r/'
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml) response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)") pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
@ -120,7 +120,7 @@ add_pecl_extension() {
extension=$1 extension=$1
pecl_version=$2 pecl_version=$2
prefix=$3 prefix=$3
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
pecl_version=$(get_pecl_version "$extension" "$pecl_version") pecl_version=$(get_pecl_version "$extension" "$pecl_version")
fi fi
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then