From 85e7d68404f127fbdfede2008a662b1cc00ff9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Thu, 25 Feb 2021 16:43:05 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9termine=20les=20versions=20disponibles?= =?UTF-8?q?=20tout=20seul.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 7 ++----- map-exts.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3cfc257..5b63f43 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,3 @@ -variables: - PHP_VERSIONS: "7.1 7.3 7.4 8.0" - .job: image: ${DISTRO}:${CODENAME} tags: [docker] @@ -10,9 +7,9 @@ variables: DISTRO: ${CI_JOB_NAME} script: - apt-get update -yqq - - apt-get install -yq php8.0-cli + - apt-get install -yq php-cli - mkdir public - - php ./map-exts.php ${PHP_VERSIONS} > public/${DISTRO}-${CODENAME}.yml + - php ./map-exts.php > public/${DISTRO}-${CODENAME}.yml artifacts: name: php_packages-${DISTRO}-${CODENAME} paths: diff --git a/map-exts.php b/map-exts.php index 33e5f79..e4e9661 100755 --- a/map-exts.php +++ b/map-exts.php @@ -2,12 +2,18 @@ <?php error_reporting(-1); -$argv = $_SERVER['argv']; -array_shift($argv); +$versions = []; +exec("apt-cache search php-cli | awk '/^php[0-9]\.[0-9]-/{print $1}'", $versions, $error); +if ($error) { + die("code: $error"); +} +$versions = array_map(function($v) { + return substr($v, 3, 3); +}, $versions); echo "php_packages:"; -foreach($argv as $version) { +foreach($versions as $version) { fputs(STDERR, "\nProcessing PHP ${version}\n"); exec("apt-get install -yq php${version}-cli"); -- GitLab