--- /usr/bin/cpan2rpm 2005-06-07 18:13:07 +0400 +++ /home/raorn/bin/cpan2rpm 2005-08-10 13:12:42 +0400 @@ -86,6 +86,7 @@ buildroot => "%{_tmppath}/%{name}-%{version}-%(id -u -n)", defattr => "-,root,root", description => "None.", + "rpm-args" => "", ); my %desc = ( @@ -122,6 +123,7 @@ # -- build options "spec-only" => "only generates spec file", "spec=s" => "specifies the name of a spec file", + "rpm-args=s" => "additional rpm arguments", "make-maker=s" => "arguments for makefile creation", "make=s" => "arguments passed to make", "make-no-test" => "suppress running test suite", @@ -914,7 +916,7 @@ writefile($info->{spec}, $spec); print("SPEC: $info->{spec}\n"); system("cleanup_spec $info->{spec}"); - system("buildreq $info->{spec}"); + system("buildreq --args=\"$info{'rpm-args'}\" $info->{spec}"); exit if $info->{"spec-only"}; } @@ -953,19 +955,19 @@ if (! -r $info->{rpm} || $info->{force}) { print "Generating package\n"; - my $bp = qx/$RPM -bp $info->{spec} 2>&1/; - warn("RPM test unpacking failed! [$RPM -bp $info->{spec}]\n$bp") + my $bp = qx/$RPM $info{"rpm-args"} -bp $info->{spec} 2>&1/; + warn("RPM test unpacking failed! [$RPM $info{'rpm-args'} -bp $info->{spec}]\n$bp") if $ret = $? >> 8; if ($ret == 0) { - my @cmd = ($RPM, '-ba'); + my @cmd = ($RPM, $info{"rpm-args"}, '-ba'); push @cmd, "--clean" unless $info->{"no-clean"}; push @cmd, $info->{sign} if $info->{sign}; push @cmd, $info->{spec}; debug(join " ", @cmd); print "Signing package (pass phrase required)\n" if $info->{sign}; - system(@cmd); + system(join(" ", @cmd)); die "RPM build failed [$ret]" if $ret = $? >> 8; } } @@ -1490,7 +1492,7 @@ sub getrpm_macdef($) { my $key = shift; - chomp(local $_ = qx/rpm --eval \%{$key}/); + chomp(local $_ = qx/rpm $info{"rpm-args"} --eval \%{$key}/); s/^\s+//; s/\s*\n+/ /gs; s/\s+$//; $_; } @@ -1550,7 +1552,7 @@ } my ($f) = $url =~ m|.*/(.*)|; - my @ret = qx|$RPM -ta $TMPDIR/$f 2>&1|; + my @ret = qx|$RPM $info{"rpm-args"} -ta $TMPDIR/$f 2>&1|; die "upgrade(): $!" if $?; /Wrote:\s+(.*)$/ && ($info{rpm} = $1) && last for reverse @ret; inst_rpm(\%info);