mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Use EXTENSION_PATH to specify subdirectory in add_extension_from_source
This commit is contained in:
parent
909090903e
commit
fe944a16b5
@ -154,7 +154,7 @@ describe('Extension tests', () => {
|
||||
'linux'
|
||||
);
|
||||
expect(linux).toContain(
|
||||
'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver . master extension'
|
||||
'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'
|
||||
);
|
||||
});
|
||||
|
||||
@ -252,7 +252,7 @@ describe('Extension tests', () => {
|
||||
'darwin'
|
||||
);
|
||||
expect(darwin).toContain(
|
||||
'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver . master extension'
|
||||
'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -267,7 +267,7 @@ describe('Utils tests', () => {
|
||||
'extension'
|
||||
)
|
||||
).toContain(
|
||||
'\nadd_extension_from_source ext https://github.com org-name repo-name . release extension'
|
||||
'\nadd_extension_from_source ext https://github.com org-name repo-name release extension'
|
||||
);
|
||||
expect(
|
||||
await utils.parseExtensionSource(
|
||||
@ -275,15 +275,15 @@ describe('Utils tests', () => {
|
||||
'extension'
|
||||
)
|
||||
).toContain(
|
||||
'\nadd_extension_from_source ext https://sub.domain.tld org repo . release extension'
|
||||
'\nadd_extension_from_source ext https://sub.domain.tld org repo release extension'
|
||||
);
|
||||
expect(
|
||||
await utils.parseExtensionSource(
|
||||
'ext-https://sub.domain.XN--tld/org/repo/sub/dir@release',
|
||||
'ext-https://sub.domain.XN--tld/org/repo@release',
|
||||
'extension'
|
||||
)
|
||||
).toContain(
|
||||
'\nadd_extension_from_source ext https://sub.domain.XN--tld org repo sub/dir release extension'
|
||||
'\nadd_extension_from_source ext https://sub.domain.XN--tld org repo release extension'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
9
dist/index.js
vendored
9
dist/index.js
vendored
@ -2978,13 +2978,10 @@ exports.customPackage = customPackage;
|
||||
* @param extension
|
||||
*/
|
||||
async function parseExtensionSource(extension, prefix) {
|
||||
var _a, _b;
|
||||
// Groups: extension, domain url, org, repo, subdirectory, release
|
||||
// https://regex101.com/r/P3rJiy/1
|
||||
const regex = /(\w+)-(.+:\/\/.+(?:[.:][^/]+)+)?(?:\/)?([^/]+)\/([^/]+)(?:\/)?(.+)*@(.+)/;
|
||||
// Groups: extension, domain url, org, repo, release
|
||||
const regex = /(\w+)-(.+:\/\/.+(?:[.:].+)+(?:\/))?([\w.-]+)\/([\w.-]+)@(.+)/;
|
||||
const matches = regex.exec(extension);
|
||||
matches[2] = (_a = matches[2]) !== null && _a !== void 0 ? _a : 'https://github.com';
|
||||
matches[5] = (_b = matches[5]) !== null && _b !== void 0 ? _b : '.';
|
||||
matches[2] = matches[2] ? matches[2].slice(0, -1) : 'https://github.com';
|
||||
return await joins('\nadd_extension_from_source', ...matches.splice(1, matches.length), prefix);
|
||||
}
|
||||
exports.parseExtensionSource = parseExtensionSource;
|
||||
|
@ -43,7 +43,7 @@ add_cubrid_helper() {
|
||||
patch_phpize
|
||||
read -r "${ext}_PREFIX_CONFIGURE_OPTS" <<< "CFLAGS=-Wno-implicit-function-declaration"
|
||||
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config)"
|
||||
add_extension_from_source "$ext" https://github.com CUBRID "$cubrid_repo" . "$cubrid_branch" extension
|
||||
add_extension_from_source "$ext" https://github.com CUBRID "$cubrid_repo" "$cubrid_branch" extension
|
||||
restore_phpize
|
||||
fi
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ add_firebird_helper() {
|
||||
tag="$(php_src_tag)"
|
||||
export PDO_FIREBIRD_CONFIGURE_OPTS="--with-pdo-firebird=$firebird_dir"
|
||||
export PDO_FIREBIRD_LINUX_LIBS="firebird-dev"
|
||||
add_extension_from_source pdo_firebird https://github.com php php-src ext/pdo_firebird "$tag" extension get
|
||||
export PDO_FIREBIRD_PATH="ext/pdo_firebird"
|
||||
add_extension_from_source pdo_firebird https://github.com php php-src "$tag" extension get
|
||||
}
|
||||
|
||||
add_firebird() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
add_geos_helper() {
|
||||
export GEOS_LINUX_LIBS='libgeos-dev'
|
||||
export GEOS_DARWIN_LIBS='geos'
|
||||
add_extension_from_source geos https://github.com libgeos php-geos . 1.0.0 extension get
|
||||
add_extension_from_source geos https://github.com libgeos php-geos 1.0.0 extension get
|
||||
}
|
||||
|
||||
# Function to add geos
|
||||
|
@ -68,9 +68,9 @@ add_http_helper() {
|
||||
export HTTP_LINUX_LIBS="zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev"
|
||||
export HTTP_DARWIN_LIBS="brotli curl icu4c libevent libidn2"
|
||||
if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
|
||||
add_extension_from_source http https://github.com m6w6 ext-http . master extension
|
||||
add_extension_from_source http https://github.com m6w6 ext-http master extension
|
||||
else
|
||||
add_extension_from_source pecl_http https://pecl.php.net http http . "${ext##*-}" extension pecl
|
||||
add_extension_from_source pecl_http https://pecl.php.net http http "${ext##*-}" extension pecl
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,9 @@ add_oci_helper() {
|
||||
status='Installed and enabled'
|
||||
read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
|
||||
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
|
||||
read -r "${ext}_PATH" <<< "ext/$ext"
|
||||
patch_phpize
|
||||
add_extension_from_source "$ext" https://github.com php php-src ext/"$ext" "$(php_src_tag)" extension get
|
||||
add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
|
||||
restore_phpize
|
||||
fi
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ parse_args() {
|
||||
up_ext_name=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
|
||||
var="${extension}_${suffix}"
|
||||
up_var="${up_ext_name}_${suffix}"
|
||||
! [[ "$suffix" =~ .*PREFIX|LIBS.* ]] && hyp='-'
|
||||
! [[ "$suffix" =~ .*PREFIX|LIBS|PATH.* ]] && hyp='-'
|
||||
output=$(echo "${!var} ${!up_var}" | sed "s/, *$hyp/ $hyp/g" | sed -E "s/^,|,$//g")
|
||||
echo "$output" | xargs -n 1 | sort | uniq | xargs
|
||||
}
|
||||
@ -114,16 +114,16 @@ add_extension_from_source() {
|
||||
url=$2
|
||||
org=$3
|
||||
repo=$4
|
||||
sub_dir=$5
|
||||
release=$6
|
||||
prefix=$7
|
||||
fetch=${8:-clone}
|
||||
release=$5
|
||||
prefix=$6
|
||||
fetch=${7:-clone}
|
||||
slug="$extension-$release"
|
||||
source="$url/$org/$repo"
|
||||
libraries="$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
||||
opts="$(parse_args "$extension" CONFIGURE_OPTS)"
|
||||
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
|
||||
suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
||||
sub_dir="$(parse_args "$extension" PATH)"
|
||||
step_log "Setup $slug"
|
||||
(
|
||||
add_devtools phpize >/dev/null 2>&1
|
||||
|
@ -448,12 +448,10 @@ export async function parseExtensionSource(
|
||||
extension: string,
|
||||
prefix: string
|
||||
): Promise<string> {
|
||||
// Groups: extension, domain url, org, repo, subdirectory, release
|
||||
// https://regex101.com/r/P3rJiy/1
|
||||
const regex = /(\w+)-(.+:\/\/.+(?:[.:][^/]+)+)?(?:\/)?([^/]+)\/([^/]+)(?:\/)?(.+)*@(.+)/;
|
||||
// Groups: extension, domain url, org, repo, release
|
||||
const regex = /(\w+)-(.+:\/\/.+(?:[.:].+)+(?:\/))?([\w.-]+)\/([\w.-]+)@(.+)/;
|
||||
const matches = regex.exec(extension) as RegExpExecArray;
|
||||
matches[2] = matches[2] ?? 'https://github.com';
|
||||
matches[5] = matches[5] ?? '.';
|
||||
matches[2] = matches[2] ? matches[2].slice(0, -1) : 'https://github.com';
|
||||
return await joins(
|
||||
'\nadd_extension_from_source',
|
||||
...matches.splice(1, matches.length),
|
||||
|
Loading…
Reference in New Issue
Block a user