mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-06-20 01:17:49 +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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user