1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-20 23:59:28 +02:00

The C library is now required.

This eliminates conditional loading and eases development of new library features.
This commit is contained in:
David Steele
2017-11-26 17:45:00 -05:00
parent c164fc5fb9
commit 7cf955425e
29 changed files with 156 additions and 780 deletions

View File

@ -17,21 +17,72 @@ use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Config::Data;
use pgBackRest::Config::Define;
use pgBackRest::Version;
use pgBackRestBuild::Config::Data;
use BackRestDoc::Common::DocManifest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostTest;
use pgBackRestTest::Common::HostGroupTest;
use BackRestDoc::Common::DocManifest;
####################################################################################################################################
# User that's building the docs
####################################################################################################################################
use constant DOC_USER => getpwuid($UID) eq 'root' ? 'ubuntu' : getpwuid($UID) . '';
####################################################################################################################################
# Generate indexed defines
####################################################################################################################################
my $rhConfigDefineIndex = cfgDefine();
foreach my $strKey (sort(keys(%{$rhConfigDefineIndex})))
{
# Build options for all possible db configurations
if (defined($rhConfigDefineIndex->{$strKey}{&CFGDEF_PREFIX}) &&
$rhConfigDefineIndex->{$strKey}{&CFGDEF_PREFIX} eq CFGDEF_PREFIX_DB)
{
my $strPrefix = $rhConfigDefineIndex->{$strKey}{&CFGDEF_PREFIX};
for (my $iIndex = 1; $iIndex <= CFGDEF_INDEX_DB; $iIndex++)
{
my $strKeyNew = "${strPrefix}${iIndex}" . substr($strKey, length($strPrefix));
$rhConfigDefineIndex->{$strKeyNew} = dclone($rhConfigDefineIndex->{$strKey});
$rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_INDEX_TOTAL} = CFGDEF_INDEX_DB;
$rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_INDEX} = $iIndex - 1;
# Create the alternate name for option index 1
if ($iIndex == 1)
{
$rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_ALT_NAME} = $strKey;
}
else
{
$rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_REQUIRED} = false;
}
if (defined($rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_DEPEND}) &&
defined($rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_DEPEND}{&CFGDEF_DEPEND_OPTION}))
{
$rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_DEPEND}{&CFGDEF_DEPEND_OPTION} =
"${strPrefix}${iIndex}" .
substr(
$rhConfigDefineIndex->{$strKeyNew}{&CFGDEF_DEPEND}{&CFGDEF_DEPEND_OPTION},
length($strPrefix));
}
}
delete($rhConfigDefineIndex->{$strKey});
}
else
{
$rhConfigDefineIndex->{$strKey}{&CFGDEF_INDEX} = 0;
}
}
####################################################################################################################################
# CONSTRUCTOR
####################################################################################################################################
@ -516,20 +567,17 @@ sub backrestConfig
}
else
{
# Get the config options hash
my $rhOptionIndex = cfgDefineIndex();
# Make sure the specified option exists
# ??? This is too simplistic to handle new indexed options. The check below works for now but it would be good
# ??? to bring back more sophisticated checking in the future.
# if (!defined($rhOptionIndex->{$strKey}))
# if (!defined($rhConfigDefineIndex->{$strKey}))
# {
# confess &log(ERROR, "option ${strKey} does not exist");
# }
# If this option is a hash and the value is already set then append to the array
if (defined($rhOptionIndex->{$strKey}) &&
$rhOptionIndex->{$strKey}{&CFGDEF_TYPE} eq CFGDEF_TYPE_HASH &&
if (defined($rhConfigDefineIndex->{$strKey}) &&
$rhConfigDefineIndex->{$strKey}{&CFGDEF_TYPE} eq CFGDEF_TYPE_HASH &&
defined(${$self->{config}}{$strHostName}{$$hCacheKey{file}}{$strSection}{$strKey}))
{
my @oValue = ();