From bd214a2dca2b3955e49b1d97edb59fcb52043c68 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 14 Jan 2020 06:57:04 +0530 Subject: [PATCH] Update old Xdebug version for coverage: xdebug --- __tests__/extensions.test.ts | 5 +---- dist/index.js | 4 ++++ src/extensions.ts | 4 ++++ src/scripts/linux.sh | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/__tests__/extensions.test.ts b/__tests__/extensions.test.ts index 9a676cb9..cb165150 100644 --- a/__tests__/extensions.test.ts +++ b/__tests__/extensions.test.ts @@ -30,10 +30,7 @@ describe('Extension tests', () => { '7.4', 'linux' ); - expect(linux).toContain( - 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-xdebug' - ); - expect(linux).toContain('pecl install xdebug'); + expect(linux).toContain('update_extension xdebug 2.9.0'); expect(linux).toContain( 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov' ); diff --git a/dist/index.js b/dist/index.js index 8204f7dc..c336d8c7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2631,6 +2631,10 @@ function addExtensionLinux(extension_csv, version, pipe) { version + pipe; break; + // match 7.0xdebug..7.4xdebug + case /^7\.[0-4]xdebug$/.test(version_extension): + script = '\nupdate_extension xdebug 2.9.0' + pipe; + return; // match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4 case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): install_command = diff --git a/src/extensions.ts b/src/extensions.ts index 35ea232b..835df00f 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -118,6 +118,10 @@ export async function addExtensionLinux( version + pipe; break; + // match 7.0xdebug..7.4xdebug + case /^7\.[0-4]xdebug$/.test(version_extension): + script = '\nupdate_extension xdebug 2.9.0' + pipe; + return; // match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4 case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): install_command = diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 8307ec29..695facde 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -51,6 +51,21 @@ remove_extension() { sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1 } +# Function to update extension +update_extension() { + extension=$1 + latest_version=$2 + current_version=$(php -r "echo phpversion('$extension');") + final_version=$(printf "%s\n%s" "$current_version" "$latest_version" | sort | tail -n 1) + if [ "$final_version" != "$current_version" ]; then + version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version") + if [ -z "$version_exists" ]; then + update_ppa + fi + $apt_install php"$version"-"$extension" + fi +} + # Function to setup a remote tool add_tool() { url=$1