From 13c508b18d348ea39a7e3e291adadc38e198f9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Charaoui?= Date: Mon, 15 May 2023 15:04:04 -0400 Subject: [PATCH] Add support for Debian 12 (bookworm) Not much is changed for PHP in this upcoming release, except for the version of PHP shipped which is now 8.2 --- manifests/globals.pp | 4 ++++ manifests/repo/debian.pp | 4 ++-- metadata.json | 3 ++- spec/acceptance/php_spec.rb | 4 ++++ spec/classes/php_repo_debian_spec.rb | 5 ++--- spec/classes/php_spec.rb | 14 +++++++++++++- spec/defines/extension_spec.rb | 2 ++ spec/defines/fpm_pool_spec.rb | 2 ++ 8 files changed, 31 insertions(+), 7 deletions(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index 7affa455..2f729703 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -35,6 +35,7 @@ 'Debian' => $facts['os']['release']['major'] ? { '10' => '7.3', '11' => '7.4', + '12' => '8.2', default => fail("Unsupported Debian release: ${fact('os.release.major')}"), }, 'Ubuntu' => $facts['os']['release']['major'] ? { @@ -84,6 +85,9 @@ } } } else { + if $flavor == 'zend' and versioncmp($facts['os']['release']['major'], '11') > 0 { + fail("Zend PHP is unsupported on this Debian release: ${fact('os.release.major')}") + } case $globals_php_version { /^5\.6/, /^7\.[0-9]/, diff --git a/manifests/repo/debian.pp b/manifests/repo/debian.pp index 2ba8b1ae..53e4ef4b 100644 --- a/manifests/repo/debian.pp +++ b/manifests/repo/debian.pp @@ -38,7 +38,7 @@ } include 'apt' - if ($dotdeb and $facts['os']['release']['major'] in ['6', '7', '8']) { + if ($dotdeb and versioncmp($facts['os']['release']['major'], '9') < 1) { apt::source { 'source_php_dotdeb': location => $location, repos => $repos, @@ -50,7 +50,7 @@ } } - if ($sury and $facts['os']['release']['major'] in ['9', '10', '11']) { + if ($sury and versioncmp($facts['os']['release']['major'], '9') >= 0) { apt::source { 'source_php_sury': location => 'https://packages.sury.org/php/', repos => 'main', diff --git a/metadata.json b/metadata.json index 4a2d3018..dc76cad4 100644 --- a/metadata.json +++ b/metadata.json @@ -49,7 +49,8 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "10", - "11" + "11", + "12" ] }, { diff --git a/spec/acceptance/php_spec.rb b/spec/acceptance/php_spec.rb index 79e08841..07bc278b 100644 --- a/spec/acceptance/php_spec.rb +++ b/spec/acceptance/php_spec.rb @@ -20,6 +20,8 @@ 'php7.2-fpm' when %r{debian-10} 'php7.3-fpm' + when %r{debian-12} + 'php8.2-fpm' else 'php-fpm' end @@ -88,6 +90,8 @@ 'php7.2-fpm' when %r{debian-10} 'php7.3-fpm' + when %r{debian-12} + 'php8.2-fpm' else 'php-fpm' end diff --git a/spec/classes/php_repo_debian_spec.rb b/spec/classes/php_repo_debian_spec.rb index e778ff16..b74e86cb 100644 --- a/spec/classes/php_repo_debian_spec.rb +++ b/spec/classes/php_repo_debian_spec.rb @@ -23,11 +23,10 @@ if facts[:os]['name'] == 'Debian' it { is_expected.to compile.with_all_deps } - case facts[:os]['release']['major'] - when '6', '7', '8' + if facts[:os]['release']['major'].to_i < 9 it { is_expected.to contain_apt__source('source_php_dotdeb') } it { is_expected.not_to contain_apt__source('source_php_sury') } - when '9', '10', '11' + elsif facts[:os]['release']['major'].to_i >= 9 it { is_expected.not_to contain_apt__source('source_php_dotdeb') } it { is_expected.to contain_apt__source('source_php_sury') } end diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index 825f5b6b..9b4585ba 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -12,6 +12,8 @@ php_cli_package = case facts[:os]['name'] when 'Debian' case facts[:os]['release']['major'] + when '12' + 'php8.2-cli' when '11' 'php7.4-cli' when '10' @@ -34,6 +36,8 @@ php_fpm_package = case facts[:os]['name'] when 'Debian' case facts[:os]['release']['major'] + when '12' + 'php8.2-fpm' when '11' 'php7.4-fpm' when '10' @@ -56,6 +60,8 @@ php_dev_package = case facts[:os]['name'] when 'Debian' case facts[:os]['release']['major'] + when '12' + 'php8.2-dev' when '11' 'php7.4-dev' when '10' @@ -178,6 +184,8 @@ case facts[:os]['name'] when 'Debian' case facts[:os]['release']['major'] + when '12' + '/etc/php/8.2/fpm/pool.d/www.conf' when '11' '/etc/php/7.4/fpm/pool.d/www.conf' when '10' @@ -221,6 +229,8 @@ case facts[:os]['name'] when 'Debian' case facts[:os]['release']['major'] + when '12' + '/etc/php/8.2/fpm/pool.d/www.conf' when '11' '/etc/php/7.4/fpm/pool.d/www.conf' when '10' @@ -271,6 +281,8 @@ case facts[:os]['name'] when 'Debian' case facts[:os]['release']['major'] + when '12' + '/etc/php/8.2/fpm/pool.d/www.conf' when '11' '/etc/php/7.4/fpm/pool.d/www.conf' when '10' @@ -315,7 +327,7 @@ it { is_expected.not_to contain_class('php::composer') } end - if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'CentOS' || facts[:osfamily] == 'Debian' + if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'CentOS' || facts[:os]['name'] == 'Ubuntu' || (facts[:os]['name'] == 'Debian' && facts[:os]['release']['major'].to_i < 12) describe 'when called with flavor zend' do zendphp_cli_package = case facts[:os]['name'] when 'Debian', 'Ubuntu' diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 97e35217..3668ff4f 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -14,6 +14,8 @@ etcdir = case facts[:os]['name'] when 'Debian' case facts[:os]['release']['major'] + when '12' + '/etc/php/8.2/mods-available' when '11' '/etc/php/7.4/mods-available' when '10' diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index f0ec8ff9..ec0226f4 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -17,6 +17,8 @@ let(:params) { {} } case facts[:os]['release']['major'] + when '12' + it { is_expected.to contain_file('/etc/php/8.2/fpm/pool.d/unique-name.conf') } when '11' it { is_expected.to contain_file('/etc/php/7.4/fpm/pool.d/unique-name.conf') } when '10'