Changeset 397 for devel/pb/bin/pb


Ignore:
Timestamp:
Apr 19, 2008, 1:03:02 AM (11 years ago)
Author:
bruno
Message:
  • pb_syntax is now shared
  • creation of 2 new shared functions pb_syntax_init and pb_temp_init
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r395 r397  
    1212use strict 'vars';
    1313use Getopt::Long qw(:config auto_abbrev no_ignore_case);
    14 use Pod::Usage;
    1514use Data::Dumper;
    1615use English;
    1716use File::Basename;
    1817use File::Copy;
    19 use File::Path;
    2018use File::stat;
    2119use File::Temp qw(tempdir);
    2220use Date::Manip;
    23 use Time::localtime qw(localtime);
    2421use POSIX qw(strftime);
    25 
    26 
    27 # Global variables
    2822use lib qw (lib);
    2923use ProjectBuilder::Distribution;
     
    3125use ProjectBuilder::Base;
    3226
     27# Global variables
    3328my %opts;                   # CLI Options
    3429my $action;                 # action to realize
     
    304299
    305300my ($projectbuilderver,$projectbuilderrev) = pb_version_init();
     301
     302# Initialize the syntax string
     303
     304pb_syntax_init("pb (aka project-builder.org) Version $projectbuilderver-$projectbuilderrev\n");
    306305
    307306GetOptions("help|?|h" => \$opts{'h'},
     
    16371636}
    16381637
    1639 sub pb_syntax {
    1640 
    1641 my $exit_status = shift || -1;
    1642 my $verbose_level = shift || 0;
    1643 
    1644 my $filehandle = \*STDERR;
    1645 
    1646 $filehandle = \*STDOUT if ($exit_status == 0);
    1647 
    1648 pod2usage( { -message => "pb (aka project-builder.org) Version $projectbuilderver-$projectbuilderrev\n",
    1649              -exitval => $exit_status  ,
    1650              -verbose => $verbose_level,
    1651              -output  => $filehandle } );
    1652 }
    1653 
    16541638sub pb_env_init {
    16551639
     
    17891773
    17901774pb_log(2,"PBBUILDDIR: $ENV{'PBBUILDDIR'}\n");
    1791 #
    1792 # Set temp directory
    1793 #
    1794 if (not defined $ENV{'TMPDIR'}) {
    1795     $ENV{'TMPDIR'}="/tmp";
    1796 }
    1797 $ENV{'PBTMP'} = tempdir( "pb.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
     1775
     1776pb_temp_init();
    17981777pb_log(2,"PBTMP: $ENV{'PBTMP'}\n");
    17991778
     
    31993178# If we don't need to do it, or don't have it fake something
    32003179if (((not defined $chglog) || (! -f $chglog)) && ($doit ne "yes")) {
    3201     my @date=(localtime->sec(), localtime->min(), localtime->hour(), localtime->mday(), localtime->mon(), localtime->year(), localtime->wday(), localtime->yday(), localtime->isdst());
     3180    my @date = pb_get_date();
    32023181    $date = strftime("%Y-%m-%d", @date);
    32033182    $ndate = UnixDate($date,"%a", "%b", "%d", "%Y");
Note: See TracChangeset for help on using the changeset viewer.