summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-12-30 09:10:20 +0100
committerRemi Collet <remi@php.net>2024-12-30 09:10:20 +0100
commit139345d0093e3677a2a0fe862cdf02b83c043dab (patch)
treee3e0a5b5206ed12110e8bf6ec462aa60d57ecf18
parentbe6d564551cc9d63812cd4e2bf6b1313e0b3661e (diff)
remove 'v' in version numberHEADv0.1.1master
-rw-r--r--NEWS4
-rw-r--r--composer-generators.spec5
-rwxr-xr-xcomposer.prov23
3 files changed, 21 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index 49beac0..72b5fc3 100644
--- a/NEWS
+++ b/NEWS
@@ -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));
}
}
}