Subversion Repositories DevTools

Rev

Rev 255 | Rev 263 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 255 Rev 261
Line 47... Line 47...
47
    # set the version for version checking
47
    # set the version for version checking
48
    $VERSION     = 1.00;
48
    $VERSION     = 1.00;
49
 
49
 
50
    @ISA         = qw(Exporter);
50
    @ISA         = qw(Exporter);
51
    @EXPORT      = qw(ErrorConfig ErrorDoExit
51
    @EXPORT      = qw(ErrorConfig ErrorDoExit
52
                      ReportError Error Warning
52
                      ReportError Fatal Error Warning
53
                      Message Message1
53
                      Message Message1
54
                      Information Information1
54
                      Information Information1
55
                      Question
55
                      Question
56
                      Verbose Verbose2 Verbose3
56
                      Verbose Verbose2 Verbose3
57
                      Debug0 Debug Debug2 Debug3
57
                      Debug0 Debug Debug2 Debug3
Line 89... Line 89...
89
#our $ScmVerbose;
89
#our $ScmVerbose;
90
#our $ScmDebug;
90
#our $ScmDebug;
91
our $ScmOnExit;
91
our $ScmOnExit;
92
our $ScmDelayExit;
92
our $ScmDelayExit;
93
our $ScmErrorCount;
93
our $ScmErrorCount;
-
 
94
our $ScmExitCode;
94
 
95
 
95
# non-exported package globals go here
96
# non-exported package globals go here
96
$ScmErrorCount = 0;
97
$ScmErrorCount = 0;
-
 
98
$ScmExitCode = 1;
97
 
99
 
98
#  initialize package globals, first exported ones
100
#  initialize package globals, first exported ones
99
 
101
 
100
 
102
 
101
#-------------------------------------------------------------------------------
103
#-------------------------------------------------------------------------------
Line 199... Line 201...
199
    if ( $name )
201
    if ( $name )
200
    {
202
    {
201
        my ($value, $tag);
203
        my ($value, $tag);
202
 
204
 
203
        $tag = "GBE_${name}_DEBUG" ;
205
        $tag = "GBE_${name}_DEBUG" ;
-
 
206
        $tag =~ s~\s+~~g;
204
        $value = $ENV{ $tag };
207
        $value = $ENV{ $tag };
205
        if (defined $value)
208
        if (defined $value)
206
        {
209
        {
207
            $::ScmDebug = $value;
210
            $::ScmDebug = $value;
208
            Warning("Envar: $tag setting debug: $value");
211
            Warning("Envar: $tag setting debug: $value");
209
        }
212
        }
210
 
213
 
211
        $tag = "GBE_${name}_VERBOSE" ;
214
        $tag = "GBE_${name}_VERBOSE" ;
-
 
215
        $tag =~ s~\s+~~g;
212
        $value = $ENV{ $tag };
216
        $value = $ENV{ $tag };
213
        if (defined $value)
217
        if (defined $value)
214
        {
218
        {
215
            $::ScmVerbose = $value;
219
            $::ScmVerbose = $value;
216
            Warning("Envar: $tag setting verbose: $value");
220
            Warning("Envar: $tag setting verbose: $value");
Line 360... Line 364...
360
    STDERR->flush;              # Force output to be displayed
364
    STDERR->flush;              # Force output to be displayed
361
    STDOUT->flush;              # Force output to be displayed
365
    STDOUT->flush;              # Force output to be displayed
362
}
366
}
363
 
367
 
364
#-------------------------------------------------------------------------------
368
#-------------------------------------------------------------------------------
-
 
369
# Function        : Fatal
-
 
370
#
-
 
371
# Description     : Display a multi line fatal message
-
 
372
#                   This will cause the program to exit.
-
 
373
#
-
 
374
#                   Similar to Error(), except
-
 
375
#                       Display a (F) prefix
-
 
376
#                       Alters the exit code to "2"
-
 
377
#                       Will terminate program execution.
-
 
378
#                       Will not honor delayed exit configuration.
-
 
379
#
-
 
380
#                   Fatal is to be used to indicate to consumer processes that
-
 
381
#                   the error is a function of the infrastructure and cannot be
-
 
382
#                   corrected by a user. ie:
-
 
383
#                       clearcase is not available
-
 
384
#                           Not just a bad user parameter
-
 
385
#                       dpkg_archive is not available
-
 
386
#                       release manager database is not available
-
 
387
#
-
 
388
#                   Intended to be used by build deamons to determine if building
-
 
389
#                   should continue, or if the entire build process should be
-
 
390
#                   terminated.
-
 
391
#
-
 
392
# Inputs          : An array of strings to display
-
 
393
#
-
 
394
# Returns         : May not return
-
 
395
#
-
 
396
sub Fatal
-
 
397
{
-
 
398
    _Message '(F)', @_;
-
 
399
    $ScmErrorCount++;
-
 
400
    $ScmExitCode = 2;
-
 
401
    ErrorDoExit() unless ( $ScmDelayExit );
-
 
402
}
-
 
403
 
-
 
404
#-------------------------------------------------------------------------------
365
# Function        : Error
405
# Function        : Error
366
#
406
#
367
# Description     : Display a multiline error message
407
# Description     : Display a multi line error message
368
#                   This may cause the program to exit, or the user may have
408
#                   This may cause the program to exit, or the user may have
369
#                   configured the package to accumulate error messages
409
#                   configured the package to accumulate error messages
370
#
410
#
371
#                   This could be used to generate multiple error messages
411
#                   This could be used to generate multiple error messages
372
#                   while parsing a file, and then terminate program execution at
412
#                   while parsing a file, and then terminate program execution at
Line 419... Line 459...
419
        if ( my $func = $ScmOnExit )
459
        if ( my $func = $ScmOnExit )
420
        {
460
        {
421
            $ScmOnExit = undef;
461
            $ScmOnExit = undef;
422
            &$func();
462
            &$func();
423
        }
463
        }
424
        exit 1;
464
        exit $ScmExitCode;
425
    }
465
    }
426
}
466
}
427
 
467
 
428
#-------------------------------------------------------------------------------
468
#-------------------------------------------------------------------------------
429
# Function        : Verbose
469
# Function        : Verbose