blob: fdc149dae828f6929c09753f579dc5acae05b9eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
|