summaryrefslogtreecommitdiffstats
path: root/roundcubemail-bundled.php
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-04-20 15:50:24 +0200
committerRemi Collet <remi@php.net>2022-04-20 15:50:24 +0200
commit2d5383ea147530fb42f371226b90e4fdb5eb692b (patch)
treeb56740e643d40587061e3d60da7945f34fb5b0b6 /roundcubemail-bundled.php
parent8290b52748f2c395a22997d16c88df67dad659ac (diff)
sort bundled libraries list by license
Diffstat (limited to 'roundcubemail-bundled.php')
-rw-r--r--roundcubemail-bundled.php29
1 files changed, 19 insertions, 10 deletions
diff --git a/roundcubemail-bundled.php b/roundcubemail-bundled.php
index 2acae7b..c963e9e 100644
--- a/roundcubemail-bundled.php
+++ b/roundcubemail-bundled.php
@@ -16,24 +16,33 @@ if (!is_array($pkgs)) {
exit(3);
}
-$lic = [];
if (isset($pkgs['packages'])) {
- foreach($pkgs['packages'] as $pkg) {
- printf("Provides: bundled(php-%s) = %s\n", str_replace(['/', '_'], ['-', '-'], $pkg['name']), $pkg['version']);
- $lic = array_merge($lic, $pkg['license']);
+ $res = [];
+ foreach($pkgs["packages"] as $pkg) {
+ $lic = implode(" and ", $pkg["license"]);
+ if (!isset($res[$lic])) $res[$lic] = [];
+ $res[$lic][] = sprintf("Provides: bundled(php-%s) = %s", str_replace(["/", "_"], ["-", "-"], $pkg["name"]), $pkg["version"]);
+ }
+ ksort($res);
+ foreach($res as $lic => $lib) {
+ sort($lib);
+ printf("# License %s\n%s\n", $lic, implode("\n", $lib));
}
} else if (isset($pkgs['dependencies'])) {
+ $res = [];
foreach($pkgs['dependencies'] as $pkg) {
$n = strtolower($pkg['name'] ?? $pkg['lib']);
$n = str_replace('.js', '', $n);
- printf("Provides: bundled(js-%s) = %s\n", $n, $pkg['version']);
- if (isset($pkg['license'])) {
- $lic[] = $pkg['license'];
- }
+ $lic = ($pkg['license'] ?? "Unkown");
+ if (!isset($res[$lic])) $res[$lic] = [];
+ $res[$lic][] = sprintf("Provides: bundled(js-%s) = %s", $n, $pkg['version']);
+ }
+ ksort($res);
+ foreach($res as $lic => $lib) {
+ sort($lib);
+ printf("# License %s\n%s\n", $lic, implode("\n", $lib));
}
} else {
echo "unkown content\n";
exit(4);
}
-sort($lic);
-printf("\nLicense: %s\n", implode(' and ', array_unique($lic)));