mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Skip version checks when testing in --dev mode.
This commit is contained in:
parent
3bcf637aee
commit
c9ce20d41a
@ -112,7 +112,7 @@
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Improve logic for smart builds to include version changes.</p>
|
||||
<p>Improve logic for smart builds to include version changes. Skip version checks when testing in <setting>--dev</setting> mode.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
|
94
test/test.pl
94
test/test.pl
@ -45,8 +45,6 @@ use pgBackRestBuild::Config::BuildParse;
|
||||
use pgBackRestBuild::Error::Build;
|
||||
use pgBackRestBuild::Error::Data;
|
||||
|
||||
use BackRestDoc::Custom::DocCustomRelease;
|
||||
|
||||
use pgBackRestTest::Common::BuildTest;
|
||||
use pgBackRestTest::Common::ContainerTest;
|
||||
use pgBackRestTest::Common::CiTest;
|
||||
@ -401,53 +399,65 @@ eval
|
||||
(new pgBackRestTest::Common::CiTest($oStorageBackRest))->process();
|
||||
}
|
||||
|
||||
&log(INFO, "check version info");
|
||||
|
||||
# Load the doc module dynamically since it is not supported on all systems
|
||||
require BackRestDoc::Common::Doc;
|
||||
BackRestDoc::Common::Doc->import();
|
||||
|
||||
# Make sure version number matches the latest release
|
||||
my $strReleaseFile = dirname(dirname(abs_path($0))) . '/doc/xml/release.xml';
|
||||
my $oRelease = (new BackRestDoc::Custom::DocCustomRelease(new BackRestDoc::Common::Doc($strReleaseFile)))->releaseLast();
|
||||
my $strVersion = $oRelease->paramGet('version');
|
||||
my $bVersionDev = false;
|
||||
my $strVersionBase = $strVersion;
|
||||
|
||||
if ($strVersion =~ /dev$/)
|
||||
{
|
||||
$bVersionDev = true;
|
||||
$strVersionBase = substr($strVersion, 0, length($strVersion) - 3);
|
||||
|
||||
if (BACKREST_VERSION !~ /dev$/ && $oRelease->nodeTest('release-core-list'))
|
||||
{
|
||||
confess "dev release ${strVersion} must match the program version when core changes have been made";
|
||||
}
|
||||
}
|
||||
elsif ($strVersion ne BACKREST_VERSION)
|
||||
{
|
||||
confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}";
|
||||
}
|
||||
|
||||
# Update version for the C code based on the current Perl version
|
||||
# Check Perl version against release notes and update version in C code if needed
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my $strCVersionFile = "${strBackRestBase}/src/version.h";
|
||||
my $strCVersionOld = ${$oStorageTest->get($strCVersionFile)};
|
||||
my $strCVersionNew;
|
||||
my $bVersionDev = true;
|
||||
my $strVersionBase;
|
||||
|
||||
foreach my $strLine (split("\n", $strCVersionOld))
|
||||
if (!$bDev)
|
||||
{
|
||||
if ($strLine =~ /^#define PGBACKREST_VERSION/)
|
||||
# Make sure version number matches the latest release
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
&log(INFO, "check version info");
|
||||
|
||||
# Load the doc modules dynamically since they are not supported on all systems
|
||||
require BackRestDoc::Common::Doc;
|
||||
BackRestDoc::Common::Doc->import();
|
||||
require BackRestDoc::Custom::DocCustomRelease;
|
||||
BackRestDoc::Custom::DocCustomRelease->import();
|
||||
|
||||
my $strReleaseFile = dirname(dirname(abs_path($0))) . '/doc/xml/release.xml';
|
||||
my $oRelease =
|
||||
(new BackRestDoc::Custom::DocCustomRelease(new BackRestDoc::Common::Doc($strReleaseFile)))->releaseLast();
|
||||
my $strVersion = $oRelease->paramGet('version');
|
||||
$bVersionDev = false;
|
||||
$strVersionBase = $strVersion;
|
||||
|
||||
if ($strVersion =~ /dev$/)
|
||||
{
|
||||
$strLine = '#define PGBACKREST_VERSION' . (' ' x 42) . '"' . BACKREST_VERSION . '"';
|
||||
$bVersionDev = true;
|
||||
$strVersionBase = substr($strVersion, 0, length($strVersion) - 3);
|
||||
|
||||
if (BACKREST_VERSION !~ /dev$/ && $oRelease->nodeTest('release-core-list'))
|
||||
{
|
||||
confess "dev release ${strVersion} must match the program version when core changes have been made";
|
||||
}
|
||||
}
|
||||
elsif ($strVersion ne BACKREST_VERSION)
|
||||
{
|
||||
confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}";
|
||||
}
|
||||
|
||||
$strCVersionNew .= "${strLine}\n";
|
||||
}
|
||||
# Update version for the C code based on the current Perl version
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
my $strCVersionFile = "${strBackRestBase}/src/version.h";
|
||||
my $strCVersionOld = ${$oStorageTest->get($strCVersionFile)};
|
||||
my $strCVersionNew;
|
||||
|
||||
if ($strCVersionNew ne $strCVersionOld)
|
||||
{
|
||||
$oStorageTest->put($strCVersionFile, $strCVersionNew);
|
||||
foreach my $strLine (split("\n", $strCVersionOld))
|
||||
{
|
||||
if ($strLine =~ /^#define PGBACKREST_VERSION/)
|
||||
{
|
||||
$strLine = '#define PGBACKREST_VERSION' . (' ' x 42) . '"' . BACKREST_VERSION . '"';
|
||||
}
|
||||
|
||||
$strCVersionNew .= "${strLine}\n";
|
||||
}
|
||||
|
||||
if ($strCVersionNew ne $strCVersionOld)
|
||||
{
|
||||
$oStorageTest->put($strCVersionFile, $strCVersionNew);
|
||||
}
|
||||
}
|
||||
|
||||
# Clean up
|
||||
|
Loading…
x
Reference in New Issue
Block a user