Check the search path for rpm, rpmbuild, etc.
This commit is contained in:
@@ -3,9 +3,6 @@
|
||||
* Add options to filter out Provides/Requires.
|
||||
- Done, but the documentation needs work.
|
||||
|
||||
* Check the search path for rpm, rpmbuild, etc. instead of hard-coding
|
||||
paths.
|
||||
|
||||
* Try to get cpan_home from CPAN::MyConfig or CPAN::Config instead of
|
||||
hard-coding $pkgdetails.
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ sub build_rpm($) {
|
||||
my $spec=shift;
|
||||
my $dir=getcwd();
|
||||
|
||||
my $rpmbuild=(-x "/usr/bin/rpmbuild" ? "/usr/bin/rpmbuild" : "/bin/rpm");
|
||||
my $rpmbuild=which("rpmbuild","rpm");
|
||||
|
||||
verbose("Building " . ($buildrpm ? "rpms" : "source rpm") . " from $spec");
|
||||
|
||||
@@ -501,8 +501,7 @@ sub get_description(%) {
|
||||
sub check_rpm($) {
|
||||
my $dep=shift;
|
||||
|
||||
my $rpm="/bin/rpm";
|
||||
return undef if (!-x $rpm);
|
||||
my $rpm=which("rpm");
|
||||
|
||||
my @out=`$rpm -q --whatprovides "$dep"`;
|
||||
|
||||
@@ -517,8 +516,7 @@ sub check_rpm($) {
|
||||
sub check_repo($) {
|
||||
my $dep=shift;
|
||||
|
||||
my $repoquery="/usr/bin/repoquery";
|
||||
return undef if (!-x $repoquery);
|
||||
my $repoquery=which("repoquery");
|
||||
|
||||
verbose("Running $repoquery to check for $dep. This may take a while...");
|
||||
my @out=`$repoquery --whatprovides "$dep"`;
|
||||
@@ -537,6 +535,15 @@ sub check_dep($) {
|
||||
return (check_rpm("perl($module)") || check_repo("perl($module)"));
|
||||
}
|
||||
|
||||
sub which(@) {
|
||||
for my $bin (@_) {
|
||||
for my $path (split /:/, $ENV{PATH}) {
|
||||
return "$path/$bin" if -x "$path/$bin";
|
||||
}
|
||||
}
|
||||
die("Cannot find " . join(" or ", @_));
|
||||
}
|
||||
|
||||
# Set locale to en_US.UTF8 so that dates in changelog will be correct
|
||||
# if using another locale. Also ensures writing out UTF8. (Thanks to
|
||||
# Roy-Magne Mo for pointing out the problem and providing a solution.)
|
||||
@@ -582,7 +589,8 @@ if ($follow and $buildrpm) {
|
||||
|
||||
my $prefix=$noprefix ? "" : "perl-";
|
||||
|
||||
$packager=$packager || `rpm --eval '\%packager'`;
|
||||
my $rpm=which("rpm");
|
||||
$packager=$packager || `$rpm --eval '\%packager'`;
|
||||
|
||||
chomp $packager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user