X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rpm%2Frpm2Bundle;fp=rpm%2Frpm2Bundle;h=38a7ac207ab89735f304bcc138c68501a19bb8dd;hp=0000000000000000000000000000000000000000;hb=ca232ab57eb96f7fa68c2775b26beb13ecc8cbdf;hpb=45c73e0d548b950dd29c21d863c239f6114a2083 diff --git a/rpm/rpm2Bundle b/rpm/rpm2Bundle new file mode 100755 index 000000000..38a7ac207 --- /dev/null +++ b/rpm/rpm2Bundle @@ -0,0 +1,98 @@ +#!/usr/bin/perl -Tw +# +# Make a bundle file from an RPM +# +use strict; + +$ENV{PATH} = '/bin:/usr/bin/'; + +my $verbose = 0; + +# These are Perl dependencies that should be ignored/suppressed +my %suppress; + +foreach (qw/strict subs vars FS/) { + $suppress{$_} = $_; +} + +## These are root packages that shouldn't be cited multiple times +## Should figure this out with CPAN +#my %rootpkgs; +# +#foreach (qw/FS/) { +# $rootpkgs{$_} = 1; +#} + +foreach my $rawrpm (@ARGV) { + $rawrpm =~ /^([-\.a-z0-9\/]+)\s*$/i; + my $rpm = $1 or next; + my @parts = split '/', $rpm; + my $name = pop @parts; + my $version = 0.01; + if ($name =~ m<([^/]+?)[-._]?v?-?([-_.\d]+[a-z]*?\d*)\.\w+\.rpm$>) { + $name = $1; + $version = $2; + } + print STDERR "rpm: $rpm ($name, $version)\n"; + my @deps = sort `rpm -qp --requires $rpm`; + + my %mods; + + foreach (@deps) { + if (/^perl\((.*)\)\s*(>=\s+([\d\.]+))?$/) { + next if exists($suppress{$1}); + my @parts = split /::/, $1; + if (scalar @parts > 1) { + next if exists($suppress{$parts[0]}); + } + if ($verbose) { + print STDERR "$1"; + print STDERR " >= $3" if $3; + print STDERR "\n"; + } + $mods{$1} = $3 ? $3 : undef; + } + } + + my $hdr =< + +=head1 CONTENTS + +END + + my $ftr =<