diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | composer-generators.spec | 5 | ||||
-rwxr-xr-x | composer.prov | 23 |
3 files changed, 21 insertions, 11 deletions
@@ -1,6 +1,10 @@ composer-generators Release Notes ================================= +# Version 0.1.1 - 2024-12-30 + +* remove 'v' in version number + # Version 0.1.0 - 2024-10-11 * find main project name and provide it diff --git a/composer-generators.spec b/composer-generators.spec index e57a14d..8e6d5b8 100644 --- a/composer-generators.spec +++ b/composer-generators.spec @@ -8,7 +8,7 @@ # Name: composer-generators -Version: 0.1.0 +Version: 0.1.1 Release: 1%{?dist} # Use same license than RPM License: GPL-2.0-or-later @@ -59,5 +59,8 @@ install -Dpm 644 composer.attr %{buildroot}%{_fileattrsdir}/composer.attr %changelog +* Mon Dec 30 2024 Remi Collet <remi@remirepo.net> - 0.1.1-1 +- version 0.1.1 + * Fri Oct 11 2024 Remi Collet <remi@remirepo.net> - 0.1.0-1 - Initial package diff --git a/composer.prov b/composer.prov index d866711..d8bb84d 100755 --- a/composer.prov +++ b/composer.prov @@ -16,32 +16,35 @@ */ // Check if composer "pretty_version" is usable in RPM -function isValid($version) { - if (empty($version) - || strpos($version, '-') +function isValid(Array $package) { + if (!isset($package['pretty_version']) + || empty($package['pretty_version']) + || strpos($package['pretty_version'], '-') ) { return false; } return true; } +// Clean"pretty_version" +function getVersion(Array $package) { + return ltrim($package['pretty_version'], 'v'); +} + // Parse an installed.php file function run($file) { fputs(STDERR, "Search bundled libraries installed, parsing $file\n"); $installed = include $file; $main = false; if (isset($installed['root']['name']) - && isset($installed['root']['pretty_version']) - && isValid($installed['root']['pretty_version'])) { + && isValid($installed['root'])) { $main = $installed['root']['name']; - printf("php-composer(%s) = %s\n", $installed['root']['name'], $installed['root']['pretty_version']); + printf("php-composer(%s) = %s\n", $installed['root']['name'], getVersion($installed['root'])); } if (isset($installed['versions'])) foreach($installed['versions'] as $name => $v) { - if ($name !== $main - && isset($v['pretty_version']) - && isValid($v['pretty_version'])) { - printf("bundled(php-composer(%s)) = %s\n", $name, $v['pretty_version']); + if ($name !== $main && isValid($v)) { + printf("bundled(php-composer(%s)) = %s\n", $name, getVersion($v)); } } } |