1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-17 20:58:34 +02:00

Move pgBackRest::Version module to pgBackRestDoc::ProjectInfo.

The primary source for project info is now src/version.h.

The pgBackRestDoc::ProjectInfo module loads the project info from src/version.h at runtime so there is no need to update it.
This commit is contained in:
David Steele 2020-03-10 17:57:02 -04:00
parent 731b862e6f
commit 4a5bd002c0
33 changed files with 110 additions and 147 deletions

View File

@ -14,10 +14,9 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::BuildDefine;

View File

@ -14,12 +14,11 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::DocConfig;
use pgBackRestDoc::Common::DocRender;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::Data;

View File

@ -14,10 +14,9 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::Build;

View File

@ -66,10 +66,9 @@ use File::Basename qw(dirname basename);
use Getopt::Long qw(GetOptions);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::Wait;

View File

@ -17,13 +17,13 @@ to:
<release date="2019-05-20" version="2.14" title="Bug Fix and Improvements">
```
Edit version in `lib/pgBackRest/Version.pm`, e.g.:
Edit version in `src/version.h`, e.g.:
```
use constant PROJECT_VERSION => '2.14dev';
#define PROJECT_VERSION "2.14dev"
```
to:
```
use constant PROJECT_VERSION => '2.14';
#define PROJECT_VERSION "2.14"
```
## Build release documentation. Be sure to install latex using the instructions from the Vagrantfile before running this step.
@ -121,13 +121,13 @@ Add new release in `doc/xml/release.xml`, e.g.:
<release date="XXXX-XX-XX" version="2.15dev" title="UNDER DEVELOPMENT">
```
Edit version in `lib/pgBackRest/Version.pm`, e.g.:
Edit version in `src/version.h`, e.g.:
```
use constant PROJECT_VERSION => '2.14';
#define PROJECT_VERSION "2.14"
```
to:
```
use constant PROJECT_VERSION => '2.15dev';
#define PROJECT_VERSION "2.15dev"
```
Run deploy to generate git history (ctrl-c as soon as the file is generated):

View File

@ -24,8 +24,6 @@ use lib dirname(dirname(abs_path($0))) . '/lib';
use lib dirname(dirname(abs_path($0))) . '/build/lib';
use lib dirname(dirname(abs_path($0))) . '/test/lib';
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;
@ -40,6 +38,7 @@ use pgBackRestDoc::Common::String;
use pgBackRestDoc::Html::DocHtmlSite;
use pgBackRestDoc::Latex::DocLatex;
use pgBackRestDoc::Markdown::DocMarkdown;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# Usage

View File

@ -11,12 +11,11 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Version;
use pgBackRestBuild::Config::Data;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# Help types

View File

@ -15,8 +15,6 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestBuild::Config::Data;
use pgBackRestTest::Common::ExecuteTest;
@ -28,6 +26,7 @@ use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Ini;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# User that's building the docs

View File

@ -15,11 +15,10 @@ use File::Basename qw(dirname);
use JSON::PP;
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# Boolean constants

View File

@ -12,13 +12,12 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Version;
use pgBackRestBuild::Config::Data;
use pgBackRestDoc::Common::DocRender;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# XML node constants

View File

@ -16,8 +16,6 @@ use File::Copy;
use POSIX qw(strftime);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestDoc::Common::DocConfig;
@ -26,6 +24,7 @@ use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::Html::DocHtmlPage;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -17,17 +17,15 @@ use File::Copy;
use POSIX qw(strftime);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestDoc::Common::DocConfig;
use pgBackRestDoc::Common::DocManifest;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::Latex::DocLatexSection;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -15,8 +15,6 @@ use File::Copy;
use POSIX qw(strftime);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestDoc::Common::DocConfig;
@ -24,6 +22,7 @@ use pgBackRestDoc::Common::DocManifest;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::Markdown::DocMarkdownRender;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -0,0 +1,69 @@
####################################################################################################################################
# PROJECT INFO MODULE
#
# Contains project name, version and format.
####################################################################################################################################
package pgBackRestDoc::ProjectInfo;
use strict;
use warnings FATAL => qw(all);
use Cwd qw(abs_path);
use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
# Project Name
#
# Defines the official project name, exe, and config file.
#-----------------------------------------------------------------------------------------------------------------------------------
push @EXPORT, qw(PROJECT_NAME);
push @EXPORT, qw(PROJECT_EXE);
push @EXPORT, qw(PROJECT_CONF);
# Project Version Number
#
# Defines the current version of the BackRest executable. The version number is used to track features but does not affect what
# repositories or manifests can be read - that's the job of the format number.
#-----------------------------------------------------------------------------------------------------------------------------------
push @EXPORT, qw(PROJECT_VERSION);
# Repository Format Number
#
# Defines format for info and manifest files as well as on-disk structure. If this number changes then the repository will be
# invalid unless migration functions are written.
#-----------------------------------------------------------------------------------------------------------------------------------
push @EXPORT, qw(REPOSITORY_FORMAT);
####################################################################################################################################
# Load project info from src/version.h
####################################################################################################################################
require pgBackRestTest::Common::Storage;
require pgBackRestTest::Common::StoragePosix;
my $strProjectInfo = ${new pgBackRestTest::Common::Storage(
dirname(dirname(abs_path($0))), new pgBackRestTest::Common::StoragePosix())->get('src/version.h')};
foreach my $strLine (split("\n", $strProjectInfo))
{
if ($strLine =~ /^#define PROJECT_NAME/)
{
eval("use constant PROJECT_NAME => " . (split(" ", $strLine))[-1]);
}
elsif ($strLine =~ /^#define PROJECT_BIN/)
{
eval("use constant PROJECT_EXE => " . (split(" ", $strLine))[-1]);
eval("use constant PROJECT_CONF => " . (split(" ", $strLine))[-1] . " . \'.conf\'");
}
elsif ($strLine =~ /^#define PROJECT_VERSION/)
{
eval("use constant PROJECT_VERSION => " . (split(" ", $strLine))[-1]);
}
elsif ($strLine =~ /^#define REPOSITORY_FORMAT/)
{
eval("use constant REPOSITORY_FORMAT => " . (split(" ", $strLine))[-1]);
}
}
1;

View File

@ -5,7 +5,7 @@
<variable-list>
<variable key="project">pgBackRest</variable>
<variable key="project-tagline">Reliable PostgreSQL Backup &amp; Restore</variable>
<variable key="version" eval="y">use pgBackRest::Version; PROJECT_VERSION</variable>
<variable key="version" eval="y">use pgBackRestDoc::ProjectInfo; PROJECT_VERSION</variable>
<variable key="version-stable" eval="y">
use pgBackRestDoc::Custom::DocCustomRelease;

View File

@ -24,8 +24,6 @@ use lib dirname(dirname($0)) . '/build/lib';
use lib dirname(dirname($0)) . '/lib';
use lib dirname(dirname($0)) . '/test/lib';
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;
@ -41,6 +39,7 @@ use pgBackRestDoc::Common::String;
use pgBackRestDoc::Html::DocHtmlSite;
use pgBackRestDoc::Latex::DocLatex;
use pgBackRestDoc::Markdown::DocMarkdown;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# Usage

View File

@ -1,53 +0,0 @@
####################################################################################################################################
# VERSION MODULE
#
# Contains project version and format numbers.
####################################################################################################################################
package pgBackRest::Version;
use strict;
use warnings FATAL => qw(all);
use Cwd qw(abs_path);
use Exporter qw(import);
our @EXPORT = qw();
# Project Name
#
# Defines the official project name.
#-----------------------------------------------------------------------------------------------------------------------------------
use constant PROJECT_NAME => 'pgBackRest';
push @EXPORT, qw(PROJECT_NAME);
use constant PROJECT_EXE => lc(PROJECT_NAME);
push @EXPORT, qw(PROJECT_EXE);
use constant PROJECT_CONF => PROJECT_EXE . '.conf';
push @EXPORT, qw(PROJECT_CONF);
# Binary location
#
# Stores the exe location.
#-----------------------------------------------------------------------------------------------------------------------------------
my $strProjectBin;
sub projectBin {return $strProjectBin};
sub projectBinSet {$strProjectBin = shift}
push @EXPORT, qw(projectBin projectBinSet);
# Project Version Number
#
# Defines the current version of the BackRest executable. The version number is used to track features but does not affect what
# repositories or manifests can be read - that's the job of the format number.
#-----------------------------------------------------------------------------------------------------------------------------------
use constant PROJECT_VERSION => '2.25dev';
push @EXPORT, qw(PROJECT_VERSION);
# Repository Format Number
#
# Defines format for info and manifest files as well as on-disk structure. If this number changes then the repository will be
# invalid unless migration functions are written.
#-----------------------------------------------------------------------------------------------------------------------------------
use constant REPOSITORY_FORMAT => 5;
push @EXPORT, qw(REPOSITORY_FORMAT);
1;

View File

@ -18,10 +18,9 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Getopt::Long qw(GetOptions);
use pgBackRest::Version;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::VmTest;

View File

@ -15,12 +15,11 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Version;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::Html::DocHtmlBuilder;
use pgBackRestDoc::Html::DocHtmlElement;
use pgBackRestDoc::ProjectInfo;
####################################################################################################################################
# Generate an lcov configuration file

View File

@ -18,11 +18,10 @@ use File::Basename qw(dirname basename);
use POSIX qw(ceil);
use Time::HiRes qw(gettimeofday);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::BuildTest;
use pgBackRestTest::Common::ContainerTest;

View File

@ -15,9 +15,8 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Version;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -15,11 +15,10 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::BuildTest;
use pgBackRestTest::Common::DefineTest;
@ -160,8 +159,6 @@ sub process
$oStorage = new pgBackRestTest::Common::Storage(
$self->testPath(), new pgBackRestTest::Common::StoragePosix({bFileSync => false, bPathSync => false}));
projectBinSet($self->{strBackRestExe});
# Init, run, and end the test(s)
$self->initModule();
$self->run();

View File

@ -17,10 +17,9 @@ use Fcntl qw(:mode);
use File::stat qw{lstat};
use JSON::PP;
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::Io::Handle;
use pgBackRestTest::Common::Io::Process;

View File

@ -14,11 +14,10 @@ use Carp qw(confess);
use Fcntl qw(O_RDONLY);
use File::Basename qw(basename);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Ini;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -18,12 +18,11 @@ use File::Basename qw(dirname);
use File::stat qw{lstat};
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Ini;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::StorageBase;

View File

@ -16,9 +16,8 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Version;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -16,12 +16,11 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Ini;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -17,11 +17,10 @@ use Fcntl ':mode';
use File::Basename qw(basename dirname);
use File::stat;
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;

View File

@ -16,11 +16,10 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(basename);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;

View File

@ -17,11 +17,10 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Ini;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -13,12 +13,11 @@ use Carp qw(confess);
use File::Basename qw(basename dirname);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Ini;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;

View File

@ -13,11 +13,10 @@ use Carp qw(confess);
use File::Basename qw(dirname);
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Ini;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::ProjectInfo;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;

View File

@ -27,11 +27,10 @@ use lib dirname(dirname($0)) . '/lib';
use lib dirname(dirname($0)) . '/build/lib';
use lib dirname(dirname($0)) . '/doc/lib';
use pgBackRest::Version;
use pgBackRestDoc::Common::Exception;
use pgBackRestDoc::Common::Log;
use pgBackRestDoc::Common::String;
use pgBackRestDoc::ProjectInfo;
use pgBackRestBuild::Build;
use pgBackRestBuild::Build::Common;
@ -453,7 +452,7 @@ eval
# Auto-generate version for configure.ac script
#-----------------------------------------------------------------------------------------------------------------------
if (!$bSmart || grep(/^lib\/pgBackRest\/Version\.pm/, @stryModifiedList))
if (!$bSmart || grep(/^src\/version\.h/, @stryModifiedList))
{
my $strConfigureAcOld = ${$oStorageTest->get("${strBackRestBase}/src/configure.ac")};
my $strConfigureAcNew;
@ -623,27 +622,6 @@ eval
{
confess 'unable to find version ' . PROJECT_VERSION . " as the most recent release in ${strReleaseFile}";
}
# 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;
foreach my $strLine (split("\n", $strCVersionOld))
{
if ($strLine =~ /^#define PROJECT_VERSION/)
{
$strLine = '#define PROJECT_VERSION' . (' ' x 45) . '"' . PROJECT_VERSION . '"';
}
$strCVersionNew .= "${strLine}\n";
}
if ($strCVersionNew ne $strCVersionOld)
{
$oStorageTest->put($strCVersionFile, $strCVersionNew);
}
}
# Clean up
@ -851,7 +829,7 @@ eval
{
my $strPackagePath = "${strVagrantPath}/package";
my $strPackageSmart = "${strPackagePath}/build.timestamp";
my @stryPackageSrcPath = ('lib');
my @stryPackageSrcPath = ('src');
# Find the lastest modified time for additional dirs that affect the package build
foreach my $strPackageSrcPath (@stryPackageSrcPath)