Changeset 1127 in ProjectBuilder
- Timestamp:
- Dec 21, 2010, 2:37:35 AM (14 years ago)
- Location:
- devel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Base.pm
r1120 r1127 37 37 38 38 our @ISA = qw(Exporter); 39 our @EXPORT = qw(pb_mkdir_p pb_system pb_rm_rf pb_get_date pb_log pb_log_init pb_get_uri pb_get_content pb_set_content pb_display_file pb_syntax_init pb_syntax pb_temp_init pb_get_arch pb_check_requirements $pbdebug $pbLOG $pbdisplaytype $pblocale);39 our @EXPORT = qw(pb_mkdir_p pb_system pb_rm_rf pb_get_date pb_log pb_log_init pb_get_uri pb_get_content pb_set_content pb_display_file pb_syntax_init pb_syntax pb_temp_init pb_get_arch pb_check_requirements pb_check_req $pbdebug $pbLOG $pbdisplaytype $pblocale); 40 40 41 41 =pod … … 423 423 } 424 424 425 =item B<pb_check_req> 426 427 This function checks existence of a command and return its full pathname. 428 The command name is passed as first parameter. 429 The second parameter should be 0 if the command is mandatory, 1 if optional. 430 431 =cut 432 425 433 sub pb_check_req { 426 434 427 435 my $file = shift; 428 436 my $opt = shift || 1; 429 my $found = 0;437 my $found = undef; 430 438 431 439 pb_log(2,"Checking availability of $file..."); 432 440 # Check for all dirs in the PATH 433 441 foreach my $p (split(/:/,$ENV{'PATH'})) { 434 $found = 1 if (-x "$p/$file"); 435 } 436 if ($found eq 0) { 442 if (-x "$p/$file") { 443 $found = "$p/$file"; 444 last; 445 } 446 } 447 448 if (not $found) { 437 449 pb_log(2,"KO\n"); 438 450 if ($opt eq 1) { … … 443 455 } else { 444 456 pb_log(2,"OK\n"); 457 return($found"); 445 458 } 446 459 } -
devel/pb/bin/pb
r1126 r1127 1951 1951 die("Found an existing Virtual machine $vmm. Won't overwrite") if (-r $vmm); 1952 1952 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"); 1954 1955 } elsif ($vmtype eq "vmware") { 1955 1956 } else { … … 2059 2060 $addpkgs = "-a $postparam"; 2060 2061 } 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"); 2062 2064 } elsif ($verpmstyle eq "mock") { 2063 2065 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)"); 2065 2068 # 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"); 2067 2070 } else { 2068 2071 die "Unknown verpmtype type $verpmstyle. Report to dev team"; -
devel/pb/lib/ProjectBuilder/CMS.pm
r1114 r1127 798 798 open(CL,"> $dest/ChangeLog") || die "Unable to create $dest/ChangeLog"; 799 799 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"); 802 803 } else { 803 804 # To be written from pbcl … … 824 825 open(CL,"> $dest/ChangeLog") || die "Unable to create $dest/ChangeLog"; 825 826 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"); 828 830 } else { 829 831 # To be written from pbcl … … 882 884 return($cmd."cvs") 883 885 } 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 } 890 896 } 891 897 } else { -
devel/rpmbootstrap/bin/rpmbootstrap
r1111 r1127 546 546 unlink($_) if ($_ =~ /\.rpmnew$/); 547 547 } 548 549
Note:
See TracChangeset
for help on using the changeset viewer.