1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-29 22:28:02 +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:
David Steele
2016-06-27 20:37:25 -04:00
parent cc2a8777d5
commit 9516db4ad6
4 changed files with 69 additions and 19 deletions

View File

@@ -120,6 +120,24 @@ sub currentStableVersion
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
#

View File

@@ -18,14 +18,45 @@
<variable key="project-logo">logo.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 &amp;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 -->
<variable key="logo">{[doc-path]}/output/latex/logo</variable>
<!-- HTML variables -->
<variable key="html-footer" eval='y'>
use POSIX qw(strftime); 'Copyright &amp;copy; 2015' . '-' . strftime('%Y', localtime) .
', The PostgreSQL Global Development Group, &lt;a href="{[github-url-license]}">MIT License&lt;/a>. Updated ' .
strftime('%B ', localtime) . trim(strftime('%e,', localtime)) . strftime(' %Y.', localtime)</variable>
use POSIX qw(strftime);
'Copyright &amp;copy; 2015' . '-' . strftime('%Y', localtime({[release-epoch]})) .
', The PostgreSQL Global Development Group, &lt;a href="{[github-url-license]}">MIT License&lt;/a>. Updated ' .
strftime('%B ', localtime({[release-epoch]})) . trim(strftime('%e,', localtime({[release-epoch]}))) .
strftime(' %Y.', localtime({[release-epoch]}))
</variable>
<!-- <variable key="html-logo">&lt;img src=&quot;{[project-logo]}&quot;&gt;</variable> -->
<!-- PDF variables -->

View File

@@ -182,6 +182,10 @@
<p>Allow command summaries to be inserted anywhere in the documentation to avoid duplication.</p>
</release-item>
<release-item>
<p>Allow a static date to be used for documentation to generate reproducible builds.</p>
</release-item>
<release-item>
<p>Update TeX Live to 2016 version.</p>
</release-item>

View File

@@ -30,6 +30,9 @@ use pgBackRest::Db;
use pgBackRest::FileCommon;
use pgBackRest::Version;
use lib dirname($0) . '/../doc/lib';
use BackRestDoc::Custom::DocCustomRelease;
use lib dirname($0) . '/lib';
use pgBackRestTest::Backup::BackupTest;
use pgBackRestTest::Backup::Common::HostBackupTest;
@@ -216,28 +219,22 @@ eval
# Make sure version number matches the latest release
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 ($strVersion =~ /dev$/ && BACKREST_VERSION !~ /dev$/)
if ($oRelease->nodeTest('release-core-list'))
{
if ($oRelease->nodeTest('release-core-list'))
{
confess "dev release ${strVersion} must match the program version when core changes have been made";
}
next;
confess "dev release ${strVersion} must match the program version when core changes have been made";
}
if ($strVersion ne BACKREST_VERSION)
{
confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}";
}
next;
}
last;
if ($strVersion ne BACKREST_VERSION)
{
confess 'unable to find version ' . BACKREST_VERSION . " as the most recent release in ${strReleaseFile}";
}
if (!$bDryRun)