3 # Make a bundle file from an RPM
7 $ENV{PATH} = '/bin:/usr/bin/';
11 # These are Perl dependencies that should be ignored/suppressed
14 foreach (qw/strict subs vars base lib warnings FS/) {
18 # These are Perl modules corresponding to RPM names.
19 # Add entries when the mapping isn't simply "remove leading 'perl-' and replace - with ::"
21 'DBD-MySQL' => 'DBD::mysql',
24 ## These are root packages that shouldn't be cited multiple times
25 ## Should figure this out with CPAN
32 foreach my $rawrpm (@ARGV) {
33 $rawrpm =~ /^([-\.a-z0-9\/]+)\s*$/i;
35 my @parts = split '/', $rpm;
36 my $name = pop @parts;
38 if ($name =~ m<([^/]+?)[-._]?v?-?([-_.\d]+[a-z]*?\d*)\.\w+\.rpm$>) {
42 print STDERR "rpm: $rpm ($name, $version)\n";
43 my @deps = sort `rpm -qp --requires $rpm`;
48 if (/^perl\((.*?)\)\s*((>=|=|<=)\s+([\d\.]+))?$/
49 || /^perl-(.*?)\s*((>=|=|<=)\s+([\d\.]+))?$/) {
50 my ($mod, $rel, $ver) = ($1, $3, $4);
52 print STDERR "\"$mod\"\n" if $verbose;
53 $mod = $rpm2mod{$mod} if exists($rpm2mod{$mod});
56 next if exists($suppress{$mod});
57 my @parts = split /::/, $mod;
58 if (scalar @parts > 1) {
59 next if exists($suppress{$parts[0]});
63 print STDERR " $rel $ver" if $ver;
66 $mods{$mod} = $ver ? $ver : undef; # Should also save $rel
73 package Bundle::$name;
75 \$VERSION = '$version';
83 Bundle::$name - A bundle to install prerequisites for the $name package
87 C<perl -MCPAN -e 'install Bundle::$name'>
96 This bundle includes all prerequisites needed by the $name package.
102 foreach (sort keys %mods) {
104 print " $mods{$_}" if exists($mods{$_}) && $mods{$_};