Changeset 1506 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder/Base.pm


Ignore:
Timestamp:
May 9, 2012, 2:46:34 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Base.pm: add pb_path_expand to do the path expansion for config values. Print out all sudo'd commands if we haven't already so people know what they're typing their passwords in for. (Eric Anderson from aaf4d2337ab1554ba0c1f894108b3edc90996f69)
  • Env.pm: use pb_path_expand instead of inline expansion. (Eric Anderson from aaf4d2337ab1554ba0c1f894108b3edc90996f69)
  • VE.pm: Error out if vetype isn't defined; improve variable name, and verify that we don't try to launch a mips ve on x86_64 (previous check only prevented x86_64 on ix86). Use pb_path_expand to expand out the vepath also. Make sure to create the path to the VE before we try to bootstrap it. (Eric Anderson from aaf4d2337ab1554ba0c1f894108b3edc90996f69)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r1505 r1506  
    4141
    4242our @ISA = qw(Exporter);
    43 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_get_osrelease pb_check_requirements pb_check_req $pbdebug $pbLOG $pbdisplaytype $pblocale);
     43our @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_get_osrelease pb_check_requirements pb_check_req pb_path_expand $pbdebug $pbLOG $pbdisplaytype $pblocale);
    4444($VERSION,$REVISION) = pb_version_init();
    4545
     
    153153unlink("$ENV{'PBTMP'}/system.$$.log") if (-f "$ENV{'PBTMP'}/system.$$.log");
    154154$redir = "2>> $ENV{'PBTMP'}/system.$$.log 1>> $ENV{'PBTMP'}/system.$$.log" if ((! defined $verbose) || ($verbose ne "noredir"));
     155
     156# If sudo used, then be more verbose
     157pb_log(0,"Executing $cmd\n") if (($pbdebug < 1) && ($cmd =~ /^\s*\S*sudo/o));
     158
    155159system("$cmd $redir");
    156160my $res = $?;
     
    494498}
    495499
     500=item B<pb_path_expand>
     501
     502Expand out a path by environment variables as ($ENV{XXX}) and ~
     503
     504=cut
     505
     506sub pb_path_expand {
     507
     508my $path = shift;
     509
     510eval { $path =~ s/(\$ENV.+\})/$1/eeg; };
     511$path =~ s/^\~/$ENV{HOME}/;
     512
     513return($path);
     514}
     515
    496516=back
    497517
Note: See TracChangeset for help on using the changeset viewer.