1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-17 01:12:23 +02:00

Pre-build containers for any execute elements marked pre.

This allows the documentation to be built more quickly and offline during development when --pre is specified on the command line.

Each host gets a pre-built container with all the execute elements marked pre. As long as the pre elements do not change the container will not need to be rebuilt.

The feature should not be used for CI builds as it may hide errors in the documentation.
This commit is contained in:
David Steele
2018-11-29 14:45:15 -05:00
parent 74b72df9db
commit 5d3c8e47f1
7 changed files with 95 additions and 19 deletions

View File

@ -306,6 +306,22 @@ sub variableGet
return $self->{oManifest}->variableGet(shift);
}
####################################################################################################################################
# Get pre-execute list for a host
####################################################################################################################################
sub preExecute
{
my $self = shift;
my $strHost = shift;
if (defined($self->{preExecute}{$strHost}))
{
return @{$self->{preExecute}{$strHost}};
}
return;
}
####################################################################################################################################
# build
#
@ -337,6 +353,7 @@ sub build
&log(DEBUG, " filtered ${strName}" . (defined($strDescription) ? ": ${strDescription}" : ''));
$oParent->nodeRemove($oNode);
return;
}
}
else
@ -527,6 +544,16 @@ sub build
$iChildIdx++;
}
}
# Check for pre-execute statements
elsif ($strName eq 'execute')
{
if ($self->{oManifest}->{bPre} && $oNode->paramGet('pre', false, 'n') eq 'y')
{
# Add to pre-execute list
my $strHost = $self->variableReplace($oParent->paramGet('host'));
push(@{$self->{preExecute}{$strHost}}, $oNode);
}
}
# Iterate all text nodes
if (defined($oNode->textGet(false)))
@ -548,7 +575,7 @@ sub build
$self->build($oChild, $oNode, $strPath, $strPathPrefix);
# If the child should be logged then log the parent as well so the hierarchy is complete
if ($oChild->nameGet() eq 'section' && $oChild->paramGet('log'))
if ($oChild->nameGet() eq 'section' && $oChild->paramGet('log', false, false))
{
$oNode->paramSet('log', true);
}