Changeset 974 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder/Base.pm
- Timestamp:
- Feb 19, 2010, 4:17:46 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Base.pm
r873 r974 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 $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 $pbdebug $pbLOG $pbdisplaytype $pblocale); 40 40 41 41 =pod … … 389 389 } 390 390 391 =item B<pb_check_requirements> 392 393 This function checks that the commands needed for the subsystem are indeed present. 394 The required comands are passed as a coma separated string as first parameter. 395 The optional comands are passed as a coma separated string as second parameter. 396 397 =cut 398 399 sub pb_check_requirements { 400 401 my $cmds = shift || ""; 402 my $opts = shift || ""; 403 404 # cmds is a string of coma separated commands 405 foreach my $file (split(/,/,$cmds) { 406 pb_check_req($file,0); 407 } 408 409 # opts is a string of coma separated commands 410 foreach my $file (split(/,/,$opts) { 411 pb_check_req($file,1); 412 } 413 } 414 415 sub pb_check_req { 416 417 my $file = shift; 418 my $opt = shift || 1; 419 my $found = 0; 420 421 pb_log(2,"Checking availability of $file..."); 422 # Check for all dirs in the PATH 423 foreach my $p (split(/:/,$ENV{'PATH'})) { 424 $found = 1 if (-x "$p/$file"); 425 } 426 if ($found eq 0) { 427 pb_log(2,"KO\n"); 428 if ($opt eq 1) { 429 pb_log(2,"Unable to find optional command $file\n"); 430 } else { 431 die pb_log(0,"Unable to find required command $file\n"); 432 } 433 } else { 434 pb_log(2,"OK\n"); 435 } 436 } 437 391 438 =back 392 439
Note:
See TracChangeset
for help on using the changeset viewer.