[ubuntu] Rework php installation (#3272)

This commit is contained in:
Leonid Lapshin
2021-04-29 17:29:51 +03:00
committed by GitHub
parent 4a134cd3e5
commit b1f202e5f0
2 changed files with 11 additions and 10 deletions

View File

@@ -211,10 +211,11 @@ function Get-SbtVersion {
function Get-PHPVersions { function Get-PHPVersions {
$result = Get-CommandResult "apt list --installed" -Multiline $result = Get-CommandResult "apt list --installed" -Multiline
return $result.Output | Where-Object { $_ -match "^php\d+\.\d+/"} | ForEach-Object { $aptSourceRepo = Get-AptSourceRepository -PackageName "php"
$versionsList = $result.Output | Where-Object { $_ -match "^php\d+\.\d+/"} | ForEach-Object {
$_ -match "now (?<version>\d+\.\d+\.\d+)-" | Out-Null $_ -match "now (?<version>\d+\.\d+\.\d+)-" | Out-Null
$Matches.version $Matches.version }
} return $versionsList + "(apt source repository: $aptSourceRepo)"
} }
function Get-ComposerVersion { function Get-ComposerVersion {

View File

@@ -10,7 +10,8 @@ source $HELPER_SCRIPTS/os.sh
source $HELPER_SCRIPTS/install.sh source $HELPER_SCRIPTS/install.sh
# add repository # add repository
apt-add-repository ppa:ondrej/php -y REPO_URL="ppa:ondrej/php"
apt-add-repository $REPO_URL -y
apt-get update apt-get update
# Install PHP # Install PHP
@@ -98,11 +99,10 @@ wget -q -O phpunit https://phar.phpunit.de/phpunit-8.phar
chmod +x phpunit chmod +x phpunit
mv phpunit /usr/local/bin/phpunit mv phpunit /usr/local/bin/phpunit
# ubuntu 20.04 libzip-dev is libzip5 based and is not compatible libzip-dev of ppa:ondrej/php # remove repository after successfull installation
# see https://github.com/actions/virtual-environments/issues/1084 rm -r /etc/apt/sources.list.d/ondrej-ubuntu-php-*
if isUbuntu20 ; then
rm /etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list echo "php $REPO_URL" >> $HELPER_SCRIPTS/apt-sources.txt
apt-get update apt-get update
fi
invoke_tests "Common" "PHP" invoke_tests "Common" "PHP"