You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-12-03 22:39:18 +02:00
Closed #209: Dont' use "localtime" for HTML-docs.
The release-date-static var has been added to allow the html footer to use the last release date instead of localtime().
This commit is contained in:
@@ -120,6 +120,24 @@ sub currentStableVersion
|
|||||||
confess &log(ERROR, "unable to find non-development version");
|
confess &log(ERROR, "unable to find non-development version");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
# releaseLast
|
||||||
|
#
|
||||||
|
# Get the last release.
|
||||||
|
####################################################################################################################################
|
||||||
|
sub releaseLast
|
||||||
|
{
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
my $oDoc = $self->{oDoc};
|
||||||
|
|
||||||
|
foreach my $oRelease ($oDoc->nodeGet('release-list')->nodeList('release'))
|
||||||
|
{
|
||||||
|
return $oRelease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
####################################################################################################################################
|
####################################################################################################################################
|
||||||
# contributorTextGet
|
# contributorTextGet
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -18,14 +18,45 @@
|
|||||||
<variable key="project-logo">logo.png</variable>
|
<variable key="project-logo">logo.png</variable>
|
||||||
<variable key="project-favicon">favicon.png</variable>
|
<variable key="project-favicon">favicon.png</variable>
|
||||||
|
|
||||||
|
<!-- Release date - static allows for reproducible builds -->
|
||||||
|
<variable key="release-date-static">n</variable>
|
||||||
|
<variable key="release-epoch" eval="y">
|
||||||
|
use Time::Local;
|
||||||
|
use BackRestDoc::Custom::DocCustomRelease;
|
||||||
|
|
||||||
|
my ($second, $minute , $hour, $mday, $month, $year) = localtime();
|
||||||
|
|
||||||
|
if ('{[release-date-static]}' eq 'y')
|
||||||
|
{
|
||||||
|
my $strDate = (new BackRestDoc::Custom::DocCustomRelease(
|
||||||
|
new BackRestDoc::Common::Doc("{[doc-path]}/xml/release.xml")))->releaseLast()->paramGet('date');
|
||||||
|
|
||||||
|
if ($strDate eq 'XXXX-XX-XX')
|
||||||
|
{
|
||||||
|
confess &log(ERROR, 'not possible to use static release dates on a dev build');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
($year, $month, $mday) = split(/[\s.\-]+/, $strDate);
|
||||||
|
$month -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
timelocal(0, 0, 0, $mday, $month, $year);
|
||||||
|
</variable>
|
||||||
|
|
||||||
<!-- Logo locations -->
|
<!-- Logo locations -->
|
||||||
<variable key="logo">{[doc-path]}/output/latex/logo</variable>
|
<variable key="logo">{[doc-path]}/output/latex/logo</variable>
|
||||||
|
|
||||||
<!-- HTML variables -->
|
<!-- HTML variables -->
|
||||||
<variable key="html-footer" eval='y'>
|
<variable key="html-footer" eval='y'>
|
||||||
use POSIX qw(strftime); 'Copyright &copy; 2015' . '-' . strftime('%Y', localtime) .
|
use POSIX qw(strftime);
|
||||||
', The PostgreSQL Global Development Group, <a href="{[github-url-license]}">MIT License</a>. Updated ' .
|
|
||||||
strftime('%B ', localtime) . trim(strftime('%e,', localtime)) . strftime(' %Y.', localtime)</variable>
|
'Copyright &copy; 2015' . '-' . strftime('%Y', localtime({[release-epoch]})) .
|
||||||
|
', The PostgreSQL Global Development Group, <a href="{[github-url-license]}">MIT License</a>. Updated ' .
|
||||||
|
strftime('%B ', localtime({[release-epoch]})) . trim(strftime('%e,', localtime({[release-epoch]}))) .
|
||||||
|
strftime(' %Y.', localtime({[release-epoch]}))
|
||||||
|
</variable>
|
||||||
<!-- <variable key="html-logo"><img src="{[project-logo]}"></variable> -->
|
<!-- <variable key="html-logo"><img src="{[project-logo]}"></variable> -->
|
||||||
|
|
||||||
<!-- PDF variables -->
|
<!-- PDF variables -->
|
||||||
|
|||||||
@@ -182,6 +182,10 @@
|
|||||||
<p>Allow command summaries to be inserted anywhere in the documentation to avoid duplication.</p>
|
<p>Allow command summaries to be inserted anywhere in the documentation to avoid duplication.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
|
||||||
|
<release-item>
|
||||||
|
<p>Allow a static date to be used for documentation to generate reproducible builds.</p>
|
||||||
|
</release-item>
|
||||||
|
|
||||||
<release-item>
|
<release-item>
|
||||||
<p>Update TeX Live to 2016 version.</p>
|
<p>Update TeX Live to 2016 version.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
|||||||
29
test/test.pl
29
test/test.pl
@@ -30,6 +30,9 @@ use pgBackRest::Db;
|
|||||||
use pgBackRest::FileCommon;
|
use pgBackRest::FileCommon;
|
||||||
use pgBackRest::Version;
|
use pgBackRest::Version;
|
||||||
|
|
||||||
|
use lib dirname($0) . '/../doc/lib';
|
||||||
|
use BackRestDoc::Custom::DocCustomRelease;
|
||||||
|
|
||||||
use lib dirname($0) . '/lib';
|
use lib dirname($0) . '/lib';
|
||||||
use pgBackRestTest::Backup::BackupTest;
|
use pgBackRestTest::Backup::BackupTest;
|
||||||
use pgBackRestTest::Backup::Common::HostBackupTest;
|
use pgBackRestTest::Backup::Common::HostBackupTest;
|
||||||
@@ -216,28 +219,22 @@ eval
|
|||||||
|
|
||||||
# Make sure version number matches the latest release
|
# Make sure version number matches the latest release
|
||||||
my $strReleaseFile = dirname(dirname(abs_path($0))) . '/doc/xml/release.xml';
|
my $strReleaseFile = dirname(dirname(abs_path($0))) . '/doc/xml/release.xml';
|
||||||
my $oReleaseDoc = new BackRestDoc::Common::Doc($strReleaseFile);
|
my $oRelease = (new BackRestDoc::Custom::DocCustomRelease(new BackRestDoc::Common::Doc($strReleaseFile)))->releaseLast();
|
||||||
|
my $strVersion = $oRelease->paramGet('version');
|
||||||
|
|
||||||
foreach my $oRelease ($oReleaseDoc->nodeGet('release-list')->nodeList('release'))
|
if ($strVersion =~ /dev$/ && BACKREST_VERSION !~ /dev$/)
|
||||||
{
|
{
|
||||||
my $strVersion = $oRelease->paramGet('version');
|
if ($oRelease->nodeTest('release-core-list'))
|
||||||
|
|
||||||
if ($strVersion =~ /dev$/ && BACKREST_VERSION !~ /dev$/)
|
|
||||||
{
|
{
|
||||||
if ($oRelease->nodeTest('release-core-list'))
|
confess "dev release ${strVersion} must match the program version when core changes have been made";
|
||||||
{
|
|
||||||
confess "dev release ${strVersion} must match the program version when core changes have been made";
|
|
||||||
}
|
|
||||||
|
|
||||||
next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($strVersion ne BACKREST_VERSION)
|
next;
|
||||||
{
|
}
|
||||||
confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}";
|
|
||||||
}
|
|
||||||
|
|
||||||
last;
|
if ($strVersion ne BACKREST_VERSION)
|
||||||
|
{
|
||||||
|
confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$bDryRun)
|
if (!$bDryRun)
|
||||||
|
|||||||
Reference in New Issue
Block a user