mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-11 14:49:31 +02:00
Added release.pl to make releases reproducible.
This commit is contained in:
parent
1b62354dcb
commit
6e52808065
@ -131,17 +131,8 @@ eval
|
||||
!$bNoExe
|
||||
or confess "--no-exe ${strError}";
|
||||
|
||||
!$bNoCache
|
||||
or confess "--no-cache ${strError}";
|
||||
|
||||
!@stryRequire
|
||||
or confess "--require ${strError}";
|
||||
|
||||
!@stryOutput
|
||||
or confess "--out ${strError}";
|
||||
|
||||
!@stryExclude
|
||||
or confess "--exclude ${strError}";
|
||||
}
|
||||
|
||||
# Set console log level
|
||||
|
@ -290,7 +290,7 @@ sub docGet
|
||||
confess &log(ERROR, 'only one development release is allowed');
|
||||
}
|
||||
|
||||
$oSection = $oDoc->nodeAdd('section', undef, {id => 'development'});
|
||||
$oSection = $oDoc->nodeAdd('section', undef, {id => 'development', keyword => 'dev'});
|
||||
$oSection->nodeAdd('title')->textSet("Development Notes");
|
||||
|
||||
$iDevReleaseTotal++;
|
||||
@ -329,17 +329,17 @@ sub docGet
|
||||
my @stryMonth = ('January', 'February', 'March', 'April', 'May', 'June',
|
||||
'July', 'August', 'September', 'October', 'November', 'December');
|
||||
|
||||
if ($strDate !~ /^(XXXX-XX-XX)|([0-9]{4}-[0-9]{2}-[0-9]{2})$/)
|
||||
{
|
||||
confess &log(ASSERT, "invalid date ${strDate} for release {$strVersion}");
|
||||
}
|
||||
|
||||
if ($strDate =~ /^X/)
|
||||
{
|
||||
$strDateOut .= 'No Release Date Set';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($strDate !~ /^(XXXX-XX-XX)|([0-9]{4}-[0-9]{2}-[0-9]{2})$/)
|
||||
{
|
||||
confess &log(ASSERT, "invalid date ${strDate} for release {$strVersion}");
|
||||
}
|
||||
|
||||
$strDateOut .= 'Released ' . $stryMonth[(substr($strDate, 5, 2) - 1)] . ' ' .
|
||||
(substr($strDate, 8, 2) + 0) . ', ' . substr($strDate, 0, 4);
|
||||
}
|
||||
|
195
doc/release.pl
Executable file
195
doc/release.pl
Executable file
@ -0,0 +1,195 @@
|
||||
#!/usr/bin/perl
|
||||
####################################################################################################################################
|
||||
# release.pl - PgBackRest Release Manager
|
||||
####################################################################################################################################
|
||||
|
||||
####################################################################################################################################
|
||||
# Perl includes
|
||||
####################################################################################################################################
|
||||
use strict;
|
||||
use warnings FATAL => qw(all);
|
||||
use Carp qw(confess);
|
||||
|
||||
$SIG{__DIE__} = sub { Carp::confess @_ };
|
||||
|
||||
use Cwd qw(abs_path);
|
||||
use File::Basename qw(dirname);
|
||||
use Getopt::Long qw(GetOptions);
|
||||
use Pod::Usage qw(pod2usage);
|
||||
use Scalar::Util qw(blessed);
|
||||
use Storable;
|
||||
|
||||
use lib dirname($0) . '/lib';
|
||||
use BackRestDoc::Common::Doc;
|
||||
use BackRestDoc::Common::DocConfig;
|
||||
use BackRestDoc::Common::DocManifest;
|
||||
use BackRestDoc::Common::DocRender;
|
||||
use BackRestDoc::Html::DocHtmlSite;
|
||||
use BackRestDoc::Latex::DocLatex;
|
||||
use BackRestDoc::Markdown::DocMarkdown;
|
||||
|
||||
use lib dirname($0) . '/../lib';
|
||||
use pgBackRest::Common::Log;
|
||||
use pgBackRest::Common::String;
|
||||
use pgBackRest::Config::Config;
|
||||
use pgBackRest::FileCommon;
|
||||
use pgBackRest::Version;
|
||||
|
||||
use lib dirname($0) . '/../test/lib';
|
||||
use pgBackRestTest::Common::ExecuteTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# Usage
|
||||
####################################################################################################################################
|
||||
|
||||
=head1 NAME
|
||||
|
||||
release.pl - pgBackRest Release Manager
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
release.pl [options]
|
||||
|
||||
General Options:
|
||||
--help Display usage and exit
|
||||
--version Display pgBackRest version
|
||||
--quiet Sets log level to ERROR
|
||||
--log-level Log level for execution (e.g. ERROR, WARN, INFO, DEBUG)
|
||||
|
||||
Release Options:
|
||||
--build Build the cache before release (should be included in the release commit)
|
||||
--deploy Deploy documentation to website (can be done as docs are updated)
|
||||
=cut
|
||||
|
||||
####################################################################################################################################
|
||||
# Load command line parameters and config (see usage above for details)
|
||||
####################################################################################################################################
|
||||
my $bHelp = false;
|
||||
my $bVersion = false;
|
||||
my $bQuiet = false;
|
||||
my $strLogLevel = 'info';
|
||||
my $strHost = 'root@www.pgbackrest.org';
|
||||
my $strUser = 'www-data';
|
||||
my $strGroup = 'www-data';
|
||||
my $strPath = '/data/http/backrest';
|
||||
my $bBuild = false;
|
||||
my $bDeploy = false;
|
||||
|
||||
GetOptions ('help' => \$bHelp,
|
||||
'version' => \$bVersion,
|
||||
'quiet' => \$bQuiet,
|
||||
'log-level=s' => \$strLogLevel,
|
||||
'build' => \$bBuild,
|
||||
'deploy' => \$bDeploy)
|
||||
or pod2usage(2);
|
||||
|
||||
####################################################################################################################################
|
||||
# Run in eval block to catch errors
|
||||
####################################################################################################################################
|
||||
eval
|
||||
{
|
||||
# Display version and exit if requested
|
||||
if ($bHelp || $bVersion)
|
||||
{
|
||||
print BACKREST_NAME . ' ' . BACKREST_VERSION . " Release Manager\n";
|
||||
|
||||
if ($bHelp)
|
||||
{
|
||||
print "\n";
|
||||
pod2usage();
|
||||
}
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# If neither build nor deploy is requested then error
|
||||
if (!$bBuild && !$bDeploy)
|
||||
{
|
||||
confess &log(ERROR, 'neither --build nor --deploy requested, nothing to do');
|
||||
}
|
||||
|
||||
# Set console log level
|
||||
if ($bQuiet)
|
||||
{
|
||||
$strLogLevel = 'error';
|
||||
}
|
||||
|
||||
logLevelSet(undef, uc($strLogLevel));
|
||||
|
||||
# Set the paths
|
||||
my $strDocPath = dirname(abs_path($0));
|
||||
my $strDocHtml = "${strDocPath}/output/html";
|
||||
my $strDocExe = "${strDocPath}/doc.pl";
|
||||
|
||||
# Determine if this is a dev release
|
||||
my $bDev = BACKREST_VERSION =~ /dev$/;
|
||||
my $strVersion = $bDev ? 'dev' : BACKREST_VERSION;
|
||||
|
||||
if ($bBuild)
|
||||
{
|
||||
# Remove permanent cache file
|
||||
fileRemove("${strDocPath}/resource/exe.cache", true);
|
||||
|
||||
# Generate deployment docs for RHEL/Centos 6
|
||||
&log(INFO, "Generate RHEL/CentOS 6 documentation");
|
||||
|
||||
executeTest("${strDocExe} --deploy --keyword=co6");
|
||||
executeTest("${strDocExe} --deploy --cache-only --keyword=co6 --out=pdf --var=\"project-name=Crunchy BackRest\"");
|
||||
|
||||
# Generate deployment docs for Debian
|
||||
&log(INFO, "Generate Debian/Ubuntu documentation");
|
||||
|
||||
executeTest("${strDocExe} --deploy");
|
||||
executeTest("${strDocExe} --deploy --cache-only --out=man --out=html --var=project-url-root=index.html --exclude=backlog");
|
||||
}
|
||||
|
||||
if ($bDeploy)
|
||||
{
|
||||
# Generate deployment docs for the website history
|
||||
&log(INFO, 'Generate website ' . ($bDev ? 'dev' : 'history') . ' documentation');
|
||||
|
||||
executeTest(
|
||||
$strDocExe . ($bDev ? '' : ' --deploy --cache-only') . ' --out=html --var=project-url-root=index.html' .
|
||||
($bDev ? ' --keyword=default --keyword=dev' : ' --exclude=backlog --exclude=release'));
|
||||
|
||||
# Deploy to server
|
||||
&log(INFO, '...Deploy to server');
|
||||
executeTest("ssh ${strHost} rm -rf ${strPath}/${strVersion}");
|
||||
executeTest("ssh ${strHost} mkdir ${strPath}/${strVersion}");
|
||||
executeTest("scp ${strDocHtml}/* ${strHost}:${strPath}/${strVersion}");
|
||||
|
||||
# Generate deployment docs for the main website
|
||||
if (!$bDev)
|
||||
{
|
||||
&log(INFO, "Generate website documentation");
|
||||
|
||||
executeTest("${strDocExe} --deploy --cache-only --out=html");
|
||||
|
||||
&log(INFO, '...Deploy to server');
|
||||
executeTest("ssh ${strHost} rm -rf ${strPath}/dev");
|
||||
executeTest("ssh ${strHost} find ${strPath} -maxdepth 1 -type f -exec rm {} +");
|
||||
executeTest("scp ${strDocHtml}/* ${strHost}:${strPath}");
|
||||
}
|
||||
|
||||
# Update permissions
|
||||
executeTest("ssh ${strHost} chown -R ${strUser}:${strGroup} ${strPath}");
|
||||
executeTest("ssh ${strHost} find ${strPath} -type d -exec chmod 550 {} +");
|
||||
executeTest("ssh ${strHost} find ${strPath} -type f -exec chmod 440 {} +");
|
||||
}
|
||||
};
|
||||
|
||||
####################################################################################################################################
|
||||
# Check for errors
|
||||
####################################################################################################################################
|
||||
if ($@)
|
||||
{
|
||||
my $oMessage = $@;
|
||||
|
||||
# If a backrest exception then return the code - don't confess
|
||||
if (blessed($oMessage) && $oMessage->isa('pgBackRest::Common::Exception'))
|
||||
{
|
||||
exit $oMessage->code();
|
||||
}
|
||||
|
||||
confess $oMessage;
|
||||
}
|
@ -94,6 +94,16 @@
|
||||
</contributor-list>
|
||||
|
||||
<release-list>
|
||||
<release date="XXX-XX-XX" version="1.04dev" title="UNDER DEVELOPMENT">
|
||||
<release-doc-list>
|
||||
<release-feature-list>
|
||||
<release-item>
|
||||
<p>Added <file>release.pl</file> to make releases reproducible. For now this only includes building and deploying documentation.</p>
|
||||
</release-item>
|
||||
</release-feature-list>
|
||||
</release-doc-list>
|
||||
</release>
|
||||
|
||||
<release date="2016-07-02" version="1.03" title="Check Command and Bug Fixes">
|
||||
<release-core-list>
|
||||
<release-bug-list>
|
||||
|
Loading…
x
Reference in New Issue
Block a user