mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Add support for unstable versions
This commit is contained in:
parent
40944de129
commit
3a473c9a22
@ -3,7 +3,7 @@ import * as extensions from '../src/extensions';
|
|||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
'xdebug, pcov, phalcon4, ast-beta, grpc-1.2.3',
|
'xdebug, pcov, phalcon4, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@ -12,6 +12,7 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||||
expect(win32).toContain('Add-Extension ast beta');
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||||
|
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
||||||
|
|
||||||
win32 = await extensions.addExtension(
|
win32 = await extensions.addExtension(
|
||||||
'phalcon3, does_not_exist',
|
'phalcon3, does_not_exist',
|
||||||
|
34
dist/index.js
vendored
34
dist/index.js
vendored
@ -2679,17 +2679,17 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
const [extension_name, stability] = extension.split('-');
|
const [ext_name, ext_version] = extension.split('-');
|
||||||
const prefix = yield utils.getExtensionPrefix(extension_name);
|
const prefix = yield utils.getExtensionPrefix(ext_name);
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
'\nadd_unstable_extension ' +
|
'\nadd_unstable_extension ' +
|
||||||
extension_name +
|
ext_name +
|
||||||
' ' +
|
' ' +
|
||||||
stability +
|
ext_version +
|
||||||
' ' +
|
' ' +
|
||||||
prefix;
|
prefix;
|
||||||
return;
|
return;
|
||||||
@ -2755,16 +2755,22 @@ function addExtensionWindows(extension_csv, version, pipe) {
|
|||||||
yield utils.asyncForEach(extensions, function (extension) {
|
yield utils.asyncForEach(extensions, function (extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const [extension_name, stability] = extension.split('-');
|
const [ext_name, ext_version] = extension.split('-');
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
|
let matches;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
||||||
break;
|
break;
|
||||||
// match exact versions
|
// match exact versions
|
||||||
case /.*-\d+\.\d+\.\d+/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||||
script += '\nAdd-Extension ' + extension_name + ' stable ' + stability;
|
script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
||||||
|
return;
|
||||||
|
case /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
||||||
|
matches = /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.exec(version_extension);
|
||||||
|
script +=
|
||||||
|
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||||
return;
|
return;
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
@ -2802,23 +2808,23 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
const [extension_name, stability] = extension.split('-');
|
const [ext_name, ext_version] = extension.split('-');
|
||||||
const prefix = yield utils.getExtensionPrefix(extension_name);
|
const prefix = yield utils.getExtensionPrefix(ext_name);
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
'\nadd_unstable_extension ' +
|
'\nadd_unstable_extension ' +
|
||||||
extension_name +
|
ext_name +
|
||||||
' ' +
|
' ' +
|
||||||
stability +
|
ext_version +
|
||||||
' ' +
|
' ' +
|
||||||
prefix;
|
prefix;
|
||||||
return;
|
return;
|
||||||
// match exact versions
|
// match exact versions
|
||||||
case /.*-\d+\.\d+\.\d+/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||||
script += '\nadd_pecl_extension ' + extension_name + ' ' + stability;
|
script += '\nadd_pecl_extension ' + ext_name + ' ' + ext_version;
|
||||||
return;
|
return;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
|
@ -18,17 +18,17 @@ export async function addExtensionDarwin(
|
|||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
const [extension_name, stability]: string[] = extension.split('-');
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||||
const prefix = await utils.getExtensionPrefix(extension_name);
|
const prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
'\nadd_unstable_extension ' +
|
'\nadd_unstable_extension ' +
|
||||||
extension_name +
|
ext_name +
|
||||||
' ' +
|
' ' +
|
||||||
stability +
|
ext_version +
|
||||||
' ' +
|
' ' +
|
||||||
prefix;
|
prefix;
|
||||||
return;
|
return;
|
||||||
@ -94,16 +94,26 @@ export async function addExtensionWindows(
|
|||||||
let script = '\n';
|
let script = '\n';
|
||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const [extension_name, stability]: string[] = extension.split('-');
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
|
let matches: RegExpExecArray;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
||||||
break;
|
break;
|
||||||
// match exact versions
|
// match exact versions
|
||||||
case /.*-\d+\.\d+\.\d+/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||||
script += '\nAdd-Extension ' + extension_name + ' stable ' + stability;
|
script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
||||||
|
return;
|
||||||
|
case /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.test(
|
||||||
|
version_extension
|
||||||
|
):
|
||||||
|
matches = /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.exec(
|
||||||
|
version_extension
|
||||||
|
) as RegExpExecArray;
|
||||||
|
script +=
|
||||||
|
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||||
return;
|
return;
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
@ -141,23 +151,23 @@ export async function addExtensionLinux(
|
|||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
const [extension_name, stability]: string[] = extension.split('-');
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||||
const prefix = await utils.getExtensionPrefix(extension_name);
|
const prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
'\nadd_unstable_extension ' +
|
'\nadd_unstable_extension ' +
|
||||||
extension_name +
|
ext_name +
|
||||||
' ' +
|
' ' +
|
||||||
stability +
|
ext_version +
|
||||||
' ' +
|
' ' +
|
||||||
prefix;
|
prefix;
|
||||||
return;
|
return;
|
||||||
// match exact versions
|
// match exact versions
|
||||||
case /.*-\d+\.\d+\.\d+/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||||
script += '\nadd_pecl_extension ' + extension_name + ' ' + stability;
|
script += '\nadd_pecl_extension ' + ext_name + ' ' + ext_version;
|
||||||
return;
|
return;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
|
@ -187,6 +187,7 @@ version=$1
|
|||||||
nodot_version=${1/./}
|
nodot_version=${1/./}
|
||||||
old_versions="5.[3-5]"
|
old_versions="5.[3-5]"
|
||||||
existing_version=$(php-config --version | cut -c 1-3)
|
existing_version=$(php-config --version | cut -c 1-3)
|
||||||
|
[[ -z "${update}" ]] && update='false' || update="${update}"
|
||||||
|
|
||||||
# Setup PHP
|
# Setup PHP
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
|
@ -98,6 +98,7 @@ remove_extension() {
|
|||||||
add_pecl_extension() {
|
add_pecl_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
|
delete_extension "$extension"
|
||||||
(sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
(sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
||||||
add_log "$tick" "$extension" "Installed and enabled") ||
|
add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||||
@ -251,6 +252,7 @@ old_versions="5.[4-5]"
|
|||||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||||
apt_install="sudo $debconf_fix apt-fast install -y"
|
apt_install="sudo $debconf_fix apt-fast install -y"
|
||||||
existing_version=$(php-config --version | cut -c 1-3)
|
existing_version=$(php-config --version | cut -c 1-3)
|
||||||
|
[[ -z "${update}" ]] && update='false' || update="${update}"
|
||||||
|
|
||||||
# Setup PHP
|
# Setup PHP
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
|
@ -56,9 +56,11 @@ Function Add-Extension {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($extension_version -ne '') {
|
if($extension_version -ne '') {
|
||||||
$extension = "$extension -Version $extension_version"
|
Install-PhpExtension -Extension $extension -Version $extension_version -MinimumStability $mininum_stability -Path $php_dir
|
||||||
}
|
} else {
|
||||||
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
|
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
|
||||||
|
}
|
||||||
|
|
||||||
Add-Log $tick $extension "Installed and enabled"
|
Add-Log $tick $extension "Installed and enabled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user