diff options
author | Remi Collet <remi@remirepo.net> | 2019-09-06 16:09:48 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2019-09-06 16:09:48 +0200 |
commit | e2d31ebbefb8f621e1173804dc98004038556c1d (patch) | |
tree | 59aa94b956ed85f7e567f624f1bbee609bc44209 | |
parent | ae96d5ff541fc615e0e6df9b7cfb921bf6cfe0ab (diff) |
simplify modular metadata, 1 default per stream
-rwxr-xr-x | mkmodular | 79 |
1 files changed, 32 insertions, 47 deletions
@@ -67,6 +67,17 @@ data: - php-fpm artifacts: rpms: +@RPMS@ +... +--- +document: modulemd-defaults +version: 1 +data: + module: php + stream: remi-@VERSION@ + profiles: + remi-@VERSION@: [common] +... EOT; @@ -108,6 +119,17 @@ data: - redis artifacts: rpms: +@RPMS@ +... +--- +document: modulemd-defaults +version: 1 +data: + module: redis + stream: remi-@VERSION@ + profiles: + remi-@VERSION@: [common] +... EOT; @@ -146,42 +168,21 @@ data: - glpi artifacts: rpms: - -EOT; - -$defaults = <<< EOT ---- -document: modulemd-defaults -version: 1 -data: - module: php - profiles: - remi-7.1: [common] - remi-7.2: [common] - remi-7.3: [common] - remi-7.4: [common] +@RPMS@ ... --- document: modulemd-defaults version: 1 data: module: glpi + stream: @VERSION@ profiles: - 9.2: [common] - 9.3: [common] - 9.4: [common] -... ---- -document: modulemd-defaults -version: 1 -data: - module: redis - profiles: - remi-5.0: [common] + @VERSION@: [common] ... EOT; + function findPackages($from, $dest, $pat) { global $oldrpms; $rpms = []; @@ -218,15 +219,15 @@ function genModule($srce, $dest, $pats, $ver, $arch, $deps, $template) { foreach($deps as $n => $v) { $deptxt .= ($deptxt ? "\n" : '') . " $n: [$v]"; } + $rpmstxt = ''; + foreach($rpms as $rpm) { + $rpmstxt .= ($rpmstxt ? "\n" : '') . " - $rpm"; + } $mod = str_replace( - ['@VERSION@', '@ARCH@', "@DATE@", "@DIST@", "@DEPS@"], - [$ver, $arch, date("YmdHis"), $deps['platform'], $deptxt], + ['@VERSION@', '@ARCH@', "@DATE@", "@DIST@", "@DEPS@", '@RPMS@'], + [$ver, $arch, date("YmdHis"), $deps['platform'], $deptxt, $rpmstxt], $template ); - foreach($rpms as $rpm) { - $mod .= " - $rpm\n"; - } - $mod .= "...\n"; return $mod; } @@ -266,7 +267,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f29', $_SERVER['argv'])) { $mod .= genModule('fedora/29/glpi92/x86_64', $dest, '*.rpm', '9.2', 'x86_64', $deps, $template_glpi); $mod .= genModule('fedora/29/glpi93/x86_64', $dest, '*.rpm', '9.3', 'x86_64', $deps, $template_glpi); $mod .= genModule('fedora/29/glpi94/x86_64', $dest, '*.rpm', '9.4', 'x86_64', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/29/modular-test/x86_64'; @@ -276,7 +276,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f29', $_SERVER['argv'])) { $mod = genModule('fedora/29/test/x86_64', $dest, ['unit-php*rpm', 'php-*7.2*.rpm'], '7.2', 'x86_64', $deps, $template_php); $mod .= genModule('fedora/29/test73/x86_64', $dest, '*.rpm', '7.3', 'x86_64', $deps, $template_php); $mod .= genModule('fedora/29/test74/x86_64', $dest, '*.rpm', '7.4', 'x86_64', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/29/modular/i386'; @@ -289,7 +288,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f29', $_SERVER['argv'])) { $mod .= genModule('fedora/29/glpi92/i386', $dest, '*.rpm', '9.2', 'i386', $deps, $template_glpi); $mod .= genModule('fedora/29/glpi93/i386', $dest, '*.rpm', '9.3', 'i386', $deps, $template_glpi); $mod .= genModule('fedora/29/glpi94/i386', $dest, '*.rpm', '9.4', 'i386', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/29/modular-test/i386'; @@ -299,7 +297,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f29', $_SERVER['argv'])) { $mod = genModule('fedora/29/test/i386', $dest, ['unit-php*rpm', 'php-*7.2*.rpm'], '7.2', 'i386', $deps, $template_php); $mod .= genModule('fedora/29/test73/i386', $dest, '*.rpm', '7.3', 'i386', $deps, $template_php); $mod .= genModule('fedora/29/test74/i386', $dest, '*.rpm', '7.4', 'i386', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); } @@ -312,7 +309,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f30', $_SERVER['argv'])) { $mod .= genModule('fedora/30/php74/x86_64', $dest, '*.rpm', '7.4', 'x86_64', $deps, $template_php); $mod .= genModule('fedora/30/glpi93/x86_64', $dest, '*.rpm', '9.3', 'x86_64', $deps, $template_glpi); $mod .= genModule('fedora/30/glpi94/x86_64', $dest, '*.rpm', '9.4', 'x86_64', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/30/modular-test/x86_64'; @@ -321,7 +317,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f30', $_SERVER['argv'])) { $deps = ['platform' => 'f30']; $mod = genModule('fedora/30/test/x86_64', $dest, ['unit-php*rpm', 'php-*7.3*.rpm'], '7.3', 'x86_64', $deps, $template_php); $mod .= genModule('fedora/30/test74/x86_64', $dest, '*.rpm', '7.4', 'x86_64', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/30/modular/i386'; @@ -332,7 +327,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f30', $_SERVER['argv'])) { $mod .= genModule('fedora/30/php74/i386', $dest, '*.rpm', '7.4', 'i386', $deps, $template_php); $mod .= genModule('fedora/30/glpi93/i386', $dest, '*.rpm', '9.3', 'i386', $deps, $template_glpi); $mod .= genModule('fedora/30/glpi94/i386', $dest, '*.rpm', '9.4', 'i386', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/30/modular-test/i386'; @@ -341,7 +335,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f30', $_SERVER['argv'])) { $deps = ['platform' => 'f30']; $mod = genModule('fedora/30/test/i386', $dest, ['unit-php*rpm', 'php-*7.3*.rpm'], '7.3', 'i386', $deps, $template_php); $mod .= genModule('fedora/30/test74/i386', $dest, '*.rpm', '7.4', 'i386', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); } @@ -354,7 +347,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f31', $_SERVER['argv'])) { $mod .= genModule('fedora/31/php74/x86_64', $dest, '*.rpm', '7.4', 'x86_64', $deps, $template_php); $mod .= genModule('fedora/31/glpi93/x86_64', $dest, '*.rpm', '9.3', 'x86_64', $deps, $template_glpi); $mod .= genModule('fedora/31/glpi94/x86_64', $dest, '*.rpm', '9.4', 'x86_64', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/31/modular-test/x86_64'; @@ -363,7 +355,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f31', $_SERVER['argv'])) { $deps = ['platform' => 'f31']; $mod = genModule('fedora/31/test/x86_64', $dest, ['unit-php*rpm', 'php-*7.3*.rpm'], '7.3', 'x86_64', $deps, $template_php); $mod .= genModule('fedora/31/test74/x86_64', $dest, '*.rpm', '7.4', 'x86_64', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/31/modular/i386'; @@ -374,7 +365,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f31', $_SERVER['argv'])) { $mod .= genModule('fedora/31/php74/i386', $dest, '*.rpm', '7.4', 'i386', $deps, $template_php); $mod .= genModule('fedora/31/glpi93/i386', $dest, '*.rpm', '9.3', 'i386', $deps, $template_glpi); $mod .= genModule('fedora/31/glpi94/i386', $dest, '*.rpm', '9.4', 'i386', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'fedora/31/modular-test/i386'; @@ -383,7 +373,6 @@ if (count($_SERVER['argv']) < 2 || in_array('f31', $_SERVER['argv'])) { $deps = ['platform' => 'f31']; $mod = genModule('fedora/31/test/i386', $dest, ['unit-php*rpm', 'php-*7.3*.rpm'], '7.3', 'i386', $deps, $template_php); $mod .= genModule('fedora/31/test74/i386', $dest, '*.rpm', '7.4', 'i386', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); } @@ -395,7 +384,6 @@ if (count($_SERVER['argv']) < 2 || in_array('el8', $_SERVER['argv'])) { $mod = genModule('enterprise/8/test72/x86_64', $dest, '*.rpm', '7.2', 'x86_64', $deps, $template_php); $mod .= genModule('enterprise/8/test73/x86_64', $dest, '*.rpm', '7.3', 'x86_64', $deps, $template_php); $mod .= genModule('enterprise/8/test74/x86_64', $dest, '*.rpm', '7.4', 'x86_64', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'enterprise/8/modular/x86_64'; @@ -409,7 +397,6 @@ if (count($_SERVER['argv']) < 2 || in_array('el8', $_SERVER['argv'])) { $deps = ['platform' => 'el8', 'php' => '']; $mod .= genModule('enterprise/8/glpi93/x86_64', $dest, '*.rpm', '9.3', 'x86_64', $deps, $template_glpi); $mod .= genModule('enterprise/8/glpi94/x86_64', $dest, '*.rpm', '9.4', 'x86_64', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); } @@ -422,7 +409,6 @@ if (count($_SERVER['argv']) < 2 || in_array('el7', $_SERVER['argv'])) { $mod = genModule('enterprise/7/test72/x86_64', $dest, '*.rpm', '7.2', 'x86_64', $deps, $template_php); $mod .= genModule('enterprise/7/test73/x86_64', $dest, '*.rpm', '7.3', 'x86_64', $deps, $template_php); $mod .= genModule('enterprise/7/test74/x86_64', $dest, '*.rpm', '7.4', 'x86_64', $deps, $template_php); - $mod .= $defaults; createRepo($dest, $mod); $dest = 'enterprise/7/modular/x86_64'; @@ -438,7 +424,6 @@ if (count($_SERVER['argv']) < 2 || in_array('el7', $_SERVER['argv'])) { $mod .= genModule('enterprise/7/glpi92/x86_64', $dest, '*.rpm', '9.2', 'x86_64', $deps, $template_glpi); $mod .= genModule('enterprise/7/glpi93/x86_64', $dest, '*.rpm', '9.3', 'x86_64', $deps, $template_glpi); $mod .= genModule('enterprise/7/glpi94/x86_64', $dest, '*.rpm', '9.4', 'x86_64', $deps, $template_glpi); - $mod .= $defaults; createRepo($dest, $mod); } echo "Done\n"; |