[freeside-commits] freeside/install/rpm rpm2Bundle, 1.1.2.2, 1.1.2.3

Richard Siddall rsiddall at wavetail.420.am
Wed Dec 10 11:39:34 PST 2008


Update of /home/cvs/cvsroot/freeside/install/rpm
In directory wavetail.420.am:/tmp/cvs-serv28495/install/rpm

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	rpm2Bundle 
Log Message:
Improved code to handle RPM names and convert back to Perl module names.


Index: rpm2Bundle
===================================================================
RCS file: /home/cvs/cvsroot/freeside/install/rpm/Attic/rpm2Bundle,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- rpm2Bundle	18 Nov 2008 02:56:20 -0000	1.1.2.2
+++ rpm2Bundle	10 Dec 2008 19:39:31 -0000	1.1.2.3
@@ -11,10 +11,16 @@
 # These are Perl dependencies that should be ignored/suppressed
 my %suppress;
 
-foreach (qw/strict subs vars FS/) {
+foreach (qw/strict subs vars base lib warnings FS/) {
 	$suppress{$_} = $_;
 }
 
+# These are Perl modules corresponding to RPM names.
+# Add entries when the mapping isn't simply "remove leading 'perl-' and replace - with ::"
+my %rpm2mod=(
+	'DBD-MySQL' => 'DBD::mysql',
+);
+
 ## These are root packages that shouldn't be cited multiple times
 ## Should figure this out with CPAN
 #my %rootpkgs;
@@ -39,19 +45,25 @@
 	my %mods;
 
 	foreach (@deps) {
-		if (/^perl\((.*)\)\s*((>=|=|<=)\s+([\d\.]+))?$/
-		 || /^perl-(.*)\s*((>=|=|<=)\s+([\d\.]+))?$/) {
-			next if exists($suppress{$1});
-			my @parts = split /::/, $1;
+		if (/^perl\((.*?)\)\s*((>=|=|<=)\s+([\d\.]+))?$/
+		 || /^perl-(.*?)\s*((>=|=|<=)\s+([\d\.]+))?$/) {
+			my ($mod, $rel, $ver) = ($1, $3, $4);
+			if (/^perl-/) {
+				print STDERR "\"$mod\"\n" if $verbose;
+				$mod = $rpm2mod{$mod} if exists($rpm2mod{$mod});
+				$mod =~ s/-/::/g
+			}
+			next if exists($suppress{$mod});
+			my @parts = split /::/, $mod;
 			if (scalar @parts > 1) {
 				next if exists($suppress{$parts[0]});
 			}
 			if ($verbose) {
-				print STDERR "$1";
-				print STDERR " $3 $4" if $4;
+				print STDERR "$mod";
+				print STDERR " $rel $ver" if $ver;
 				print STDERR "\n";
 			}
-			$mods{$1} = $4 ? $4 : undef;
+			$mods{$mod} = $ver ? $ver : undef; # Should also save $rel
 		}
 	}
 



More information about the freeside-commits mailing list