Changeset 1127 in ProjectBuilder for devel/pb


Ignore:
Timestamp:
Dec 21, 2010, 2:37:35 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Modify pb_check_req interface to return the found value and allow direct call
  • Use pb_check_req to avoid some hardcoded path
Location:
devel/pb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1126 r1127  
    19511951                die("Found an existing Virtual machine $vmm. Won't overwrite") if (-r $vmm);
    19521952                if (($vmtype eq "qemu") || ($vmtype eq "xen") || ($vmtype eq "kvm")) {
    1953                     pb_system("/usr/bin/qemu-img create -f qcow2 $vmm $vmsize->{$ENV{'PBPROJ'}}","Creating the QEMU VM");
     1953                    my $command = pb_check_req("qemu-img",0);
     1954                    pb_system("$command create -f qcow2 $vmm $vmsize->{$ENV{'PBPROJ'}}","Creating the QEMU VM");
    19541955                } elsif ($vmtype eq "vmware") {
    19551956                } else {
     
    20592060                            $addpkgs = "-a $postparam";
    20602061                        }
    2061                         pb_system("sudo /usr/bin/rpmbootstrap $rbsopt $postinstall $addpkgs $ddir-$dver-$darch $rbsverb","Creating the rpmbootstrap VE for $ddir-$dver ($darch)", "verbose");
     2062                        my $command = pb_check_req("rpmbootstrap",0);
     2063                        pb_system("sudo $command $rbsopt $postinstall $addpkgs $ddir-$dver-$darch $rbsverb","Creating the rpmbootstrap VE for $ddir-$dver ($darch)", "verbose");
    20622064                    } elsif ($verpmstyle eq "mock") {
    20632065                        my ($rbsconf) = pb_conf_get("rbsconf");
    2064                         pb_system("sudo /usr/sbin/mock --init --resultdir=\"/tmp\" --configdir=\"$rbsconf->{$ENV{'PBPROJ'}}\" -r $v $rbsopt","Creating the mock VE for $ddir-$dver ($darch)");
     2066                        my $command = pb_check_req("mock",0);
     2067                        pb_system("sudo $command --init --resultdir=\"/tmp\" --configdir=\"$rbsconf->{$ENV{'PBPROJ'}}\" -r $v $rbsopt","Creating the mock VE for $ddir-$dver ($darch)");
    20652068                        # Once setup we need to install some packages, the pb account, ...
    2066                         pb_system("sudo /usr/sbin/mock --install --configdir=\"$rbsconf->{$ENV{'PBPROJ'}}\" -r $v su","Configuring the mock VE");
     2069                        pb_system("sudo $command --install --configdir=\"$rbsconf->{$ENV{'PBPROJ'}}\" -r $v su","Configuring the mock VE");
    20672070                    } else {
    20682071                        die "Unknown verpmtype type $verpmstyle. Report to dev team";
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r1114 r1127  
    798798        open(CL,"> $dest/ChangeLog") || die "Unable to create $dest/ChangeLog";
    799799        close(CL);
    800         if (-x "/usr/bin/svn2cl") {
    801             pb_system("/usr/bin/svn2cl --group-by-day --authors=$authors -i -o $dest/ChangeLog $pkgdir","Generating ChangeLog from SVN with svn2cl");
     800        my $command = pb_check_req("svn2cl",1);
     801        if (-x $command) {
     802            pb_system("$command --group-by-day --authors=$authors -i -o $dest/ChangeLog $pkgdir","Generating ChangeLog from SVN with svn2cl");
    802803        } else {
    803804            # To be written from pbcl
     
    824825        open(CL,"> $dest/ChangeLog") || die "Unable to create $dest/ChangeLog";
    825826        close(CL);
    826         if (-x "/usr/bin/cvs2cl") {
    827             pb_system("/usr/bin/cvs2cl --group-by-day -U $authors -f $dest/ChangeLog $pkgdir","Generating ChangeLog from CVS with cvs2cl");
     827        my $command = pb_check_req("cvs2cl",1);
     828        if (-x $command) {
     829            pb_system("$command --group-by-day -U $authors -f $dest/ChangeLog $pkgdir","Generating ChangeLog from CVS with cvs2cl");
    828830        } else {
    829831            # To be written from pbcl
     
    882884    return($cmd."cvs")
    883885} elsif (($scheme =~ /http/) || ($scheme =~ /ftp/)) {
    884     if (-x "/usr/bin/wget") {
    885         return($cmd."/usr/bin/wget -nv -O ");
    886     } elsif (-x "/usr/bin/curl") {
    887         return($cmd."/usr/bin/curl -o ");
    888     } else {
    889         die "Unable to handle $scheme.\nNo wget/curl available, please install one of those";
     886    my $command = pb_check_req("wget",1);
     887    if (-x $command) {
     888        return($cmd."$command -nv -O ");
     889    } else {
     890        $command = pb_check_req("curl",1);
     891        if (-x $command) {
     892            return($cmd."$command -o ");
     893        } else {
     894            die "Unable to handle $scheme.\nNo wget/curl available, please install one of those";
     895        }
    890896    }
    891897} else {
Note: See TracChangeset for help on using the changeset viewer.