Commit 9cea5f13 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Première version.

parents
No related merge requests found
Showing with 96 additions and 0 deletions
+96 -0
.git
Dockerfile 0 → 100644
ARG UPSTREAM=debian:buster
FROM ${UPSTREAM}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq
RUN . /etc/os-release \
&& apt-get install -yq apt-transport-https ca-certificates curl \
&& curl -sSL -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \
&& echo "deb https://packages.sury.org/php/ $VERSION_CODENAME main" > /etc/apt/sources.list.d/php.list \
&& apt-get update -yqq
RUN apt-get install -yq php8.0-cli
COPY map-exts.php /usr/local/bin/map-exts.php
ENTRYPOINT ["/usr/local/bin/map-exts.php"]
map-exts.php 0 → 100755
#!/usr/bin/env php
<?php
error_reporting(-1);
$argv = $_SERVER['argv'];
array_shift($argv);
system('. /etc/os-release && echo "$ID-$VERSION_CODENAME":');
foreach($argv as $version) {
fputs(STDERR, "\nProcessing PHP ${version}\n");
exec("apt-get install -yq php${version}-cli");
exec("apt-cache search ^php${version}- | awk '/^php${version}-/&&!/-dbg/{print$1}'", $packages, $error);
if ($error) {
die("code: $error");
}
$lines = [];
exec("apt-cache show " . implode(" ", $packages) . " | egrep '^(Package|Provides):'", $lines, $error);
if ($error) {
die("code: $error");
}
$map = [];
$package = null;
foreach ($lines as $line) {
[$header, $content] = explode(': ', $line, 2);
switch ($header) {
case 'Package':
$package = $content;
break;
case 'Provides':
if (!$package) {
fputs(STDERR, "ignoring Provides without Package: $line\n");
continue 2;
}
$thispackage = $package;
$package = null;
if (strpos($thispackage, "php${version}-") !== 0) {
continue 2;
}
$matches = [];
preg_match_all("/\\bphp(?:\\Q${version}\\E)?\\-([^ ,]+)/", $content, $matches, PREG_PATTERN_ORDER);
if (!$matches) {
continue 2;
}
$exts = array_unique($matches[1]);
if (!$exts) {
continue 2;
}
foreach ($exts as $ext) {
$map[$ext] = $thispackage;
}
break;
default:
fputs(STDERR, "ignoring: $line\n");
}
}
$builtins = [];
exec("php${version} -n -m | egrep -v '^(\\[|$)'", $builtins, $error);
if ($error) {
die("code: $error");
}
foreach($builtins as $builtin) {
$map[strtolower($builtin)] = 'builtin';
}
ksort($map);
printf(" \"%s\":\n", $version);
foreach ($map as $ext => $package) {
printf(" %s: %s\n", $ext, $package);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment