aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérôme Quelin <jquelin@mandriva.org>2010-02-10 10:52:14 +0000
committerJérôme Quelin <jquelin@mandriva.org>2010-02-10 10:52:14 +0000
commit05219fcc7bb0959289a883db89f3e26e9adb6f45 (patch)
treec9dda4abdc44dff47edeff27834079f97ab3b29a
parent763ed40af37db97c0dabc42986e6d292c4f24ed3 (diff)
downloadrpm-setup-05219fcc7bb0959289a883db89f3e26e9adb6f45.tar
rpm-setup-05219fcc7bb0959289a883db89f3e26e9adb6f45.tar.gz
rpm-setup-05219fcc7bb0959289a883db89f3e26e9adb6f45.tar.bz2
rpm-setup-05219fcc7bb0959289a883db89f3e26e9adb6f45.tar.xz
rpm-setup-05219fcc7bb0959289a883db89f3e26e9adb6f45.zip
new script: perl.req-from-meta
-rw-r--r--Makefile.am1
-rwxr-xr-xperl.req-from-meta33
2 files changed, 34 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 0116577..4ea55e1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,6 +36,7 @@ pkg_scripts = \
kmod.prov \
perl.prov \
perl.req \
+ perl.req-from-meta \
php.prov \
php.req \
pkgconfigdeps.sh
diff --git a/perl.req-from-meta b/perl.req-from-meta
new file mode 100755
index 0000000..fdc149d
--- /dev/null
+++ b/perl.req-from-meta
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use JSON qw{ from_json };
+use YAML qw{ Load };
+
+# slurp the file
+my $path = shift;
+open my $fh, '<', $path or die "can't open $path: $!";
+my $data = do { local $/; <$fh> };
+close $fh;
+
+# parse meta - either yaml or json
+my $meta = $path =~ /\.yml$/
+ ? Load( $data )
+ : from_json( $data );
+
+# dump the requires with their version
+my $requires = $meta->{requires};
+foreach my $module ( sort keys %$requires ) {
+ next if $module eq 'perl'; # minimum perl version
+ my $version = $requires->{$module};
+ if ( $version == 0 ) {
+ print "perl($module)\n";
+ } else {
+ my $v = qx{ rpm --eval '%perl_convert_version $version' };
+ print "perl($module) >= $v";
+ }
+}
+
+exit;