-
Notifications
You must be signed in to change notification settings - Fork 38
/
Dependencies.pm
778 lines (620 loc) · 22.1 KB
/
Dependencies.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# See bottom of file for license and copyright information
package Foswiki::Aux::Dependencies;
use v5.14;
use strict;
use warnings;
use Config;
=begin TML
---+ package Foswiki::Aux::Dependencies;
Fetch and install dependencies.
---++ SYNOPSIS
<verbatim>
use Foswiki::Aux::Dependencies rootDir => $ENV{FOSWIKI_HOME};
if (Foswiki::Aux::Dependencies::isFirstRun) {
Foswiki::Aux::Dependencies::checkDependencies(
doUpgrade => 0,
withExtensions => 1,
inlineExec => 1,
);
}
</verbatim>
#ModParams
---++ Module import parameters.
| *Key* | *Default* | *Description* |
| =rootDir= | _undef_ | Foswiki root dir as defined in FOSWIKI_HOME shell environment variable |
| =firstRunCheck = | _FALSE_ | Boolean, check if it's the first run of the application on this server; in other words, check if there is no .checksum file in =$FOSWIKI_HOME/perl5=. |
| =requiredExtensions= | [] | List (arrayref) of extensions required for this app to start. |
=cut
use File::Spec ();
use File::Path qw(make_path);
our ( $rootDir, @messages, $OK );
my $DEBUG = $ENV{FOSWIKI_ASSERTS};
sub import {
my $target = shift;
my (%params) = @_;
$rootDir = $params{rootDir} // $ENV{FOSWIKI_HOME};
$DEBUG //= $params{debug};
_dbg( "IMPORTING ", __PACKAGE__ );
_dbg( "PARAMS:", join( ", ", map { "$_ => $params{$_}" } keys %params ) );
if ( !$rootDir ) {
# Try to guess root dir location depending on where this module is
# located by presuming that $FOSWIKI_HOME/lib/<this module path> is the
# location.
my @modNames = split /::/, __PACKAGE__;
my $modFile =
File::Spec->rel2abs( $INC{ File::Spec->catfile(@modNames) . ".pm" } );
my @path = File::Spec->splitdir($modFile);
my $vol = shift @path;
# @path would containt all path elements including module file name.
# Cut off the trailing scalar(@modNames) elements to remove this module
# path and name elements and then one more to remove 'lib'. What remains
# we expect to be the root dir.
my $rootPath =
File::Spec->catdir( File::Spec->rootdir,
@path[ 0 .. $#path - @modNames - 1 ] );
$rootDir = File::Spec->catpath( $vol, $rootPath, '' );
}
$OK = 1;
if ( $params{firstRunCheck} ) {
if ( Foswiki::Aux::Dependencies::isFirstRun() ) {
my $noPerlBin = 1
; # Must be dynamically checked later for, say, mod_perl environment.
my $withExtensions = $params{withExtensions} // 0;
my @profile = (
rootDir => $rootDir,
doUpgrade => 0,
inlineExec => $noPerlBin,
firstRunCheck => 1,
);
if ( defined $params{requiredExtensions} ) {
if ( ref( $params{requiredExtensions} ) eq 'ARRAY' ) {
_dbg( "Mandatory extensions: ",
join( ",", @{ $params{requiredExtensions} } ) );
$withExtensions = 1;
push @profile,
requiredExtensions => $params{requiredExtensions};
}
else {
_msg( "requiredExtensions is not an array ref but "
. ref( $params{requiredExtensions} ) );
}
}
push @profile, withExtensions => $withExtensions;
_dbg( "Collecting DEPENDENCIES ",
( $withExtensions ? "with extensions" : "for core only" ) );
$OK = Foswiki::Aux::Dependencies::checkDependencies(@profile);
}
}
if ($OK) {
my %inc = map { $_ => 1 } @INC;
_presets( \%params );
my $localLib = File::Spec->catdir( $params{libDir}, "lib", "perl5" );
# Isert lib path to the beginning prefer locally installed modules over
# system ones.
_dbg( "Adding ", $localLib, " to \@INC" );
push @INC, $localLib unless $inc{$localLib};
}
if ( !$OK || $DEBUG ) {
say STDERR
join( "\n", "---MESSAGES BEGIN---", @messages, "---MESSAGES END---" );
}
}
sub _msg {
push @messages, @_;
}
sub _dbg_print {
return unless $DEBUG;
print STDERR @_;
}
sub _dbg {
_dbg_print( @_, "\n" );
}
sub _say {
my $profile = shift;
if ( $profile->{verbose} ) {
return say STDERR @_;
}
return 0;
}
=begin TML
---++ StaticMethod checkDependencies(%params) -> bool
=%params= keys:
| *Key* | *Default* | *Description* |
| =rootDir= | $Foswiki::Aux::Dependencies::rootDir | See [[#ModParams][module import parameters]] |
| =depFile= | _undef_ | Full path to DEPENDENCIES file to be checked. |
| =withExtensions= | _FALSE_ | Scan for extensions DEPENDECIES files too |
| =doUpgrade= | _FALSE_ | Recheck all dependencies for possible upgrades. |
| =inlineExec= | _FALSE_ | Don't use system() call for running any Perl code but execute it as inline. May have unexpected side effects and should be avoided whenever possible! |
| =depFileList= | _empty_ | Manually define DEPENDENCIES files to be processed. If =withExtensions= is true then added to this list. |
| =retries= | 5 | Number of times to retry a failed installation. Reasonable if cause of failure is a network issue. |
| =retryPause= | 1 | Number of seconds to wait between retries |
| =requiredExtensions= | [] | List (arrayref) of extensions required for this app to start. |
---+++ HOW TO BLOCK THE CHECKS
=checkDependencies()= function will do nothing if either of two conditions are met:
* Either there is =NOCPAN= file exists in =lib= subdirectory of the =rootDir=.
* Or FOSWIKI_NOCPAN environment variable exists.
The block is administrativly mandatory; i.e. there is no way to get around it
until these conditions are fullfilled and there is no flag/option of suppres
their effect.
=cut
sub checkDependencies {
my %profile = @_;
return 0 unless _presets( \%profile );
return 1
if -e $profile{rootDir} . "/lib/NOCPAN" || exists $ENV{FOSWIKI_NOCPAN};
$ENV{PERL_CPANM_HOME} = $profile{cpanmHomeDir};
# Read dependencies before validating DEPENDENCIES checksum
return 0 unless readDependencies( \%profile );
foreach my $depFile ( keys %{ $profile{depFiles} } ) {
my $sumValid = validChecksum( \%profile, $depFile );
# If checksums cannot be validated we cannot proceed.
return 0 unless defined $sumValid;
unless ($sumValid) {
push @{ $profile{dependencies} },
@{ $profile{depFiles}{$depFile}{dependencies} };
}
}
# Dependencies must be rechecked.
return 0 unless _installDependencies( \%profile );
writeChecksums( \%profile );
return 1;
}
sub isFirstRun {
my $profile;
if ( @_ == 1 ) {
$profile = shift;
}
else {
$profile = {@_};
return 0 unless _presets($profile);
}
return !( -f $profile->{checksumFile} );
}
sub _presets {
my $profile = shift;
$profile->{rootDir} //= $rootDir;
$profile->{doUpgrade} //= 0;
$profile->{withExtensions} //= 0;
$profile->{retries} //= 5;
$profile->{retryPause} //= 1;
unless ( defined $profile->{rootDir} ) {
_msg("No directory to look for DEPENDENCIES is defined.");
return 0;
}
@{$profile}{qw(libDir toolsDir)} = (
File::Spec->catdir( $profile->{rootDir}, "perl5" ),
File::Spec->catdir( $profile->{rootDir}, "tools" ),
);
$profile->{cpanmBin} = File::Spec->catfile( $profile->{toolsDir}, "cpanm" );
$profile->{cpanmHomeDir} =
File::Spec->catdir( $profile->{libDir}, ".cpanm" );
$profile->{contribDir} //=
File::Spec->catdir( $profile->{rootDir}, "lib", "Foswiki", "Contrib",
"core" );
$profile->{checksumFile} =
File::Spec->catfile( $profile->{libDir}, ".checksum" );
my $mainDepFile = $profile->{depFile}
|| File::Spec->catfile( $profile->{contribDir}, "DEPENDENCIES" );
$profile->{depFiles}{$mainDepFile} = {};
if ( $profile->{requiredExtensions} ) {
if ( ref( $profile->{requiredExtensions} ) eq 'ARRAY' ) {
$profile->{mandatoryExt} =
{ map { $_ => 1 } @{ $profile->{requiredExtensions} } };
}
else {
_msg("requiredExtensions key is expected to be an array");
}
}
return 1;
}
sub _decodeFileName {
my ($name) = @_;
$name =~ s/\\(.)/$1/g;
return $name;
}
sub _encodeFileName {
my ($name) = @_;
$name =~ s/([\\:])/\\$1/g;
return $name;
}
sub _readOldSums {
my $profile = shift;
my $checkSums = _slurpFile( $profile->{checksumFile} );
return 0 unless $checkSums;
foreach my $line ( split /\n/s, $checkSums ) {
chomp $line;
my ( $file, $sum ) = split /(?<!\\):\s*/, $line;
$file = _decodeFileName($file);
$profile->{checkSums}{$file} = $sum;
}
return 1;
}
sub _fileChkSum {
my $profile = shift;
my ($file) = @_;
my $sha1 = Digest::SHA->new;
my ( $fh, $chkSum );
if ( open $fh, "<", $file ) {
local $/;
$chkSum = Digest::SHA::sha1_hex(<$fh>);
close $fh;
}
else {
_msg( "Cannot open $file: " . $! );
return undef;
}
$profile->{newCheckSums}{$file} = $chkSum;
return $chkSum;
}
sub validChecksum {
my ( $profile, $depFile ) = @_;
my $digestModule = 'Digest::SHA';
my $digestVersion = $profile->{modules}{$digestModule} // '>0';
unless ( defined _verifyModule( $profile, $digestModule, $digestVersion ) )
{
_msg(
"!!! Module $digestModule is required but not found and cannot be installed."
);
return undef;
}
my $rc = eval "require Digest::SHA";
if ( !$rc || $@ ) {
_msg($@);
return 0;
}
my $newSum = _fileChkSum( $profile, $depFile );
return 0 unless defined $newSum;
return 0 if isFirstRun($profile);
unless ( -d $profile->{libDir} ) {
_msg("Directory not found: $profile->{libDir}");
return 0;
}
unless ( -f $profile->{checksumFile} ) {
_msg("File doesn't exists: $profile->{checksumFile}");
return 0;
}
unless ( -r $profile->{checksumFile} ) {
_msg("File not readable: $profile->{checksumFile}");
return 0;
}
return 0 unless _readOldSums($profile);
return $newSum eq $profile->{checkSums}{$depFile};
}
# Gets a directory and returns a list of found DEPENDENCIES files.
sub _scanDirs {
my $profile = shift;
my ( $dir, $params ) = @_;
# The *SubDir keys are expected to start with path separator. The inExtDir
# flag is ON only when we're at the top of Plugins/Contrib directory
# structure.
$params->{inExtDir} ||= $dir =~
/(?:\Q$profile->{_pluginsSubDir}\E|\Q$profile->{_contribSubDir}\E)$/;
my @found;
my $dh;
unless ( opendir $dh, $dir ) {
_msg( "Cannot open dir '$dir': " . $! );
return ();
}
while ( my $entry = readdir($dh) ) {
next if $entry eq File::Spec->updir or $entry eq File::Spec->curdir;
my $fullDir = File::Spec->catdir( $dir, $entry );
if ( -d $fullDir ) {
push @found, _scanDirs( $profile, $fullDir, $params );
}
elsif ( $params->{inExtDir} && $entry eq 'DEPENDENCIES' ) {
my $depFile = File::Spec->catfile( $dir, $entry );
push @found, $depFile;
# $entry is equivalent to extension name.
$profile->{_dep2Ext}{$depFile} = $entry;
}
}
closedir $dh;
return @found;
}
sub _findExtDependecies {
my $profile = shift;
my $rootDir = $profile->{rootDir};
# The trick with '' is here to get subdir strings delimited with path
# separator in the beginning and end of the string.
$profile->{_pluginsSubDir} = File::Spec->catdir( '', 'Foswiki', 'Plugins' );
$profile->{_contribSubDir} = File::Spec->catdir( '', 'Foswiki', 'Contrib' );
my @depFileList = _scanDirs( $profile, $rootDir );
$profile->{depFiles}{$_} = { fromExt => 1, } foreach @depFileList;
}
sub readDependencies {
my $profile = shift;
my $dep_fh;
if ( $profile->{depFileList} ) {
$profile->{depFiles}{$_} = {} foreach @{ $profile->{depFileList} };
}
if ( $profile->{withExtensions} ) {
_dbg("Scanning for extensions.");
_findExtDependecies($profile);
}
foreach my $depFile ( keys %{ $profile->{depFiles} } ) {
unless ( open $dep_fh, "<", $depFile ) {
_msg( "Failed to open $depFile:" . $! );
return 0;
}
$profile->{depFiles}{$depFile}{dependencies} = [];
my $fromExt = $profile->{depFiles}{$depFile}{fromExt} // 0;
while ( my $line = <$dep_fh> ) {
chomp $line;
my %depEntry;
my @splitLine = split /,/, $line, 4;
next if @splitLine < 4; # Ignore some special format lines for now.
@depEntry{qw(module version type description source fromExt)} =
( @splitLine, $depFile, $fromExt );
next unless lc( $depEntry{type} ) eq 'cpan';
$profile->{modules}{ $depEntry{module} } = \%depEntry;
push @{ $profile->{depFiles}{$depFile}{dependencies} }, \%depEntry;
}
close $dep_fh;
}
return 1;
}
sub writeChecksums {
my ($profile) = @_;
foreach my $depFile ( keys %{ $profile->{newCheckSums} } ) {
$profile->{checkSums}{$depFile} = $profile->{newCheckSums}{$depFile};
}
my $fh;
unless ( open $fh, ">", $profile->{checksumFile} ) {
_msg( "Cannot open '$profile->{checksumFile}' for write: " . $! );
return 0;
}
foreach my $depFile ( keys %{ $profile->{checkSums} } ) {
my $file = _encodeFileName($depFile);
print $fh $file, ":", $profile->{checkSums}{$depFile}, "\n";
}
close $fh;
return 1;
}
sub _signalName {
my ($sigNum) = @_;
my $sigName = ( split ' ', $Config{sig_name} )[$sigNum] // $sigNum;
return $sigName;
}
sub _slurpFile {
my ($file) = @_;
my $fh;
unless ( open $fh, "<", $file ) {
_msg( "Cannot open '$file': " . $! );
return undef;
}
local $/;
my $data = <$fh>;
_msg( "Read from '$file' failed: " . $! ) unless defined $data;
close $fh;
return $data;
}
sub _inlineCpanmExec {
my $profile = shift;
# Shell-like return.
my $rc = 0;
state $codeLoaded = 0;
unless ($codeLoaded) {
my $code = _slurpFile( $profile->{cpanmBin} );
if ($code) {
$code =~ s/^(.+)\h*#\h+END\h+OF\h+FATPACK\h+CODE.+$/$1/s;
$code .= "\n1;";
my $compiled = eval $code;
if ( !$compiled ) {
_msg( "Load of cpanm code failed: " . $@ );
$rc = 1;
}
else {
$codeLoaded = 1;
}
}
else {
$rc = 1;
}
}
if ( $rc == 0 ) {
require App::cpanminus::script;
my $cpanmApp = App::cpanminus::script->new;
$cpanmApp->parse_options(@_);
$rc = $cpanmApp->doit;
}
# Simulate system()
return $rc << 8;
}
sub _cpanmExec {
my $profile = shift;
# For no good reason an attempt to install mod_perl on macOS causes either
# cpanm or the mod_perl installation scripts to raise TERM signal to the
# parent – i.e. to us. We shall ignore it.
my $cmdLine = "$^X $profile->{cpanmBin} " . join( " ", @_ );
local $SIG{TERM} = sub { say STDERR "Got $_[0] signal for `$cmdLine`"; };
if ( $profile->{inlineExec} ) {
return _inlineCpanmExec( $profile, @_ );
}
return system $^X, $profile->{cpanmBin}, @_;
}
sub _perlExec {
return system $^X, @_;
}
sub _muteExec {
my $profile = shift;
my $sub = shift;
my $wantArray = wantarray;
my $rc;
my $outFile = File::Spec->catfile( $profile->{libDir}, ".stdout" );
my $errFile = File::Spec->catfile( $profile->{libDir}, ".stderr" );
{
my $muter = Foswiki::Aux::MuteOut->new(
outFile => $outFile,
errFile => $errFile,
);
$rc = $muter->exec( $sub, @_ );
}
my @capturedContent;
if ($wantArray) {
foreach my $captureFile ( $outFile, $errFile ) {
push @capturedContent,
_slurpFile($captureFile)
// '*** Failed to slurp from ' . $captureFile . ': ' . $!;
}
}
unlink $outFile;
unlink $errFile;
return $wantArray ? ( $rc, @capturedContent ) : $rc;
}
sub _testModule {
my $profile = shift;
my ( $module, $modParams ) = @_;
if ( $profile->{inlineExec} ) {
eval "use $module $modParams;";
return !$@;
}
else {
# Use libDir because it's the only location we know for sure where nothing
# would be broken.
my $scriptFile = File::Spec->catfile( $profile->{libDir}, ".test.pl" );
my $fh;
if ( open $fh, ">", $scriptFile ) {
print $fh <<SCRIPT;
use $module $modParams;
print "OK";
exit 0;
SCRIPT
close $fh;
my $rc = _muteExec( $profile, \&_perlExec, $scriptFile );
my $success;
if ( $rc != 0 ) {
if ( $rc & 0x7f ) {
_msg( "'perl $scriptFile' died by signal "
. _signalName( $rc & 0x7f ) );
undef $success;
}
else {
$success = 0;
}
}
else {
$success = 1;
}
unlink $scriptFile;
return $success;
}
}
# Cannot create test script file.
return undef;
}
sub _verifyModule {
my ( $profile, $module, $version, @modParams ) = @_;
my $modParams = @modParams ? join( " ", @modParams ) : '()';
my $moduleExists = _testModule( $profile, $module, $modParams );
# If test for module existance failed then verify fail too.
return 0 unless defined $moduleExists;
if ( !$moduleExists || $profile->{doUpgrade} ) {
_say( $profile, "Processing module $module" );
my $verSuffix = '';
$version =~ s/^\s*(.+)\s*$/$1/;
if ($version) {
if ( $version =~ /[><]/ ) {
$verSuffix = "~$version";
}
else {
# Remove = version prefix.
$version =~ s/^=//;
$verSuffix = '@' . $version;
}
}
my @cpanmArgs = ( qw(--pureperl -q --local-lib), $profile->{libDir} );
push @cpanmArgs, "$module$verSuffix";
my ( $rc, $stdout, $stderr ) =
_muteExec( $profile, \&_cpanmExec, $profile, @cpanmArgs );
my $exitCode = $rc >> 8;
if ( $exitCode != 0 ) {
if ( $rc == -1 ) {
_msg( "Failed to execute `$profile->{cpanmBin}`: " . $! );
}
elsif ( my $sig = $rc & 0x7f ) {
_msg( "$profile->{cpanmBin} died by signal "
. _signalName($sig) );
}
else {
_msg( $profile->{cpanmBin}
. " exited with code "
. $exitCode
. ";\n>>>STDOUT BEGIN<<<\n"
. $stdout
. ">>>STDOUT END<<<\n"
. ">>>STDERR BEGIN<<<\n"
. $stderr
. ">>>STDERR END<<<" );
}
return 0;
}
}
return 1;
}
sub _installDependencies {
my $profile = shift;
unless ( -d $profile->{libDir} ) {
my $errStr;
unless (
make_path(
$profile->{libDir}, { mode => 0700, error => \$errStr }
)
)
{
_msg(@$errStr);
return 0;
}
}
# Take special care of local::lib
my $llibMod = 'local::lib';
my $version = $profile->{modules}{$llibMod}{version} || '>=2.00000';
return 0
unless _verifyModule( $profile, $llibMod, $version,
"'$profile->{libDir}'" );
foreach my $depEntry ( @{ $profile->{dependencies} } ) {
my $version = $depEntry->{version};
$version ||= 0;
my $extName = $profile->{_dep2Ext}{ $depEntry->{source} };
my $extOptional = !( $extName && $profile->{mandatoryExt}{$extName} );
my $optional = ( $depEntry->{fromExt} && $extOptional )
|| $depEntry->{description} !~ /^required/i;
# To reduce the first time startup time we ignore optional dependencies.
next if $optional && $profile->{firstRunCheck};
_dbg("Checking for $depEntry->{module} from $depEntry->{source}");
# NOTE Only dependencies of the core or those defined by depFileList
# profile key are considered really required. If a dependency was picked
# from an extension then it could ignored if failed verification.
my ( $succeed, $attempt ) = ( 0, 0 );
while ( !$succeed && $attempt < $profile->{retries} ) {
$attempt++;
$succeed = _verifyModule( $profile, $depEntry->{module}, $version );
if ( !$succeed ) {
_msg( "Verification of "
. ( $optional ? "" : "REQUIRED" )
. " module "
. $depEntry->{module}
. ", attempt #"
. $attempt
. " FAILED" );
sleep $profile->{retryPause} if $profile->{retryPause} > 0;
}
}
return 0 unless $succeed || $optional;
}
return 1;
}
1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2016 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read LICENSE in the root of this distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As per the GPL, removal of this notice is prohibited.