Skip to content

Commit

Permalink
Move Perl modules out of lib directory.
Browse files Browse the repository at this point in the history
This directory was once the home of the production Perl code but since f0ef73d this is no longer true.

Move the modules to test in most cases, except where the module is expected to be useful for the doc engine beyond the expected lifetime of the Perl test code (about a year if all goes well).

The exception is pgBackRest::Version which requires more work to migrate since it is used to track pgBackRest versions.
  • Loading branch information
dwsteele committed Mar 10, 2020
1 parent c279a00 commit 36d4ab9
Show file tree
Hide file tree
Showing 79 changed files with 860 additions and 1,024 deletions.
8 changes: 4 additions & 4 deletions build/lib/pgBackRestBuild/Build.pm
Expand Up @@ -13,14 +13,14 @@ use Exporter qw(import);
use File::Basename qw(basename);
use Storable qw(dclone);

use pgBackRest::Common::Log;
use pgBackRest::Common::String;

use pgBackRestBuild::Build::Common;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;

use pgBackRestBuild::Build::Common;

####################################################################################################################################
# Define generator used for auto generated warning messages
####################################################################################################################################
Expand Down
4 changes: 2 additions & 2 deletions build/lib/pgBackRestBuild/Build/Common.pm
Expand Up @@ -13,8 +13,8 @@ use Exporter qw(import);
our @EXPORT = qw();
use Storable qw(dclone);

use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

####################################################################################################################################
# Constants
Expand Down
5 changes: 3 additions & 2 deletions build/lib/pgBackRestBuild/Config/Build.pm
Expand Up @@ -14,10 +14,11 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);

use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;

use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::BuildDefine;
use pgBackRestBuild::Config::Data;
Expand Down
4 changes: 2 additions & 2 deletions build/lib/pgBackRestBuild/Config/BuildDefine.pm
Expand Up @@ -14,12 +14,12 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);

use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;

use BackRestDoc::Common::DocConfig;
use BackRestDoc::Common::DocRender;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::Data;
Expand Down
5 changes: 3 additions & 2 deletions build/lib/pgBackRestBuild/Config/BuildParse.pm
Expand Up @@ -14,10 +14,11 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);

use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;

use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::Build;
use pgBackRestBuild::Config::Data;
Expand Down
11 changes: 6 additions & 5 deletions build/lib/pgBackRestBuild/Config/Data.pm
Expand Up @@ -66,12 +66,13 @@ use File::Basename qw(dirname basename);
use Getopt::Long qw(GetOptions);
use Storable qw(dclone);

use pgBackRest::Common::Exception;
use pgBackRest::Common::Io::Base;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Version;

use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;

use pgBackRestTest::Common::Wait;

####################################################################################################################################
# Command constants - commands that are allowed in the exe
####################################################################################################################################
Expand Down Expand Up @@ -1202,7 +1203,7 @@ my %hConfigDefine =
{
&CFGDEF_SECTION => CFGDEF_SECTION_GLOBAL,
&CFGDEF_TYPE => CFGDEF_TYPE_SIZE,
&CFGDEF_DEFAULT => COMMON_IO_BUFFER_MAX,
&CFGDEF_DEFAULT => 4194304,
&CFGDEF_ALLOW_LIST =>
[
&CFGDEF_DEFAULT_BUFFER_SIZE_MIN,
Expand Down
4 changes: 2 additions & 2 deletions build/lib/pgBackRestBuild/Error/Build.pm
Expand Up @@ -11,11 +11,11 @@ use English '-no_match_vars';
use Exporter qw(import);
our @EXPORT = qw();

use BackRestDoc::Common::Log;

use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Error::Data;

use pgBackRest::Common::Log;

####################################################################################################################################
# Constants
####################################################################################################################################
Expand Down
6 changes: 3 additions & 3 deletions doc/doc.pl
Expand Up @@ -32,9 +32,9 @@
use BackRestDoc::Latex::DocLatex;
use BackRestDoc::Markdown::DocMarkdown;

use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRest::Version;

use pgBackRestTest::Common::ExecuteTest;
Expand Down
4 changes: 2 additions & 2 deletions doc/lib/BackRestDoc/Common/Doc.pm
Expand Up @@ -13,8 +13,8 @@ use File::Basename qw(dirname);
use Scalar::Util qw(blessed);
use XML::Checker::Parser;

use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

####################################################################################################################################
# CONSTRUCTOR
Expand Down
8 changes: 5 additions & 3 deletions doc/lib/BackRestDoc/Common/DocConfig.pm
Expand Up @@ -11,11 +11,13 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);

use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRestBuild::Config::Data;
use pgBackRest::Version;

use pgBackRestBuild::Config::Data;

use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

####################################################################################################################################
# Help types
####################################################################################################################################
Expand Down
15 changes: 6 additions & 9 deletions doc/lib/BackRestDoc/Common/DocExecute.pm
Expand Up @@ -15,19 +15,20 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);

use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;

use pgBackRestBuild::Config::Data;

use BackRestDoc::Common::DocManifest;

use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostTest;
use pgBackRestTest::Common::HostGroupTest;

use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

####################################################################################################################################
# User that's building the docs
####################################################################################################################################
Expand Down Expand Up @@ -526,10 +527,6 @@ sub backrestConfig

if ($self->{bExe} && $self->isRequired($oSection))
{
# Load module dynamically
require pgBackRest::Common::Ini;
pgBackRest::Common::Ini->import();

my ($bCacheHit, $strCacheType, $hCacheKey, $hCacheValue) = $self->cachePop('cfg-' . PROJECT_EXE, $hCacheKey);

if ($bCacheHit)
Expand Down
4 changes: 2 additions & 2 deletions doc/lib/BackRestDoc/Common/DocManifest.pm
Expand Up @@ -13,8 +13,8 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use JSON::PP;

use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

####################################################################################################################################
# File constants
Expand Down
5 changes: 2 additions & 3 deletions doc/lib/BackRestDoc/Common/DocRender.pm
Expand Up @@ -12,10 +12,9 @@ use Exporter qw(import);
use JSON::PP;
use Storable qw(dclone);

use pgBackRest::Common::Log;
use pgBackRest::Common::String;

use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

####################################################################################################################################
# XML tag/param constants
Expand Down
@@ -1,7 +1,7 @@
####################################################################################################################################
# COMMON EXCEPTION MODULE
####################################################################################################################################
package pgBackRest::Common::Exception;
package BackRestDoc::Common::Exception;

use strict;
use warnings FATAL => qw(all);
Expand Down Expand Up @@ -158,16 +158,6 @@ sub code
return $self->{iCode};
}

####################################################################################################################################
# Is this a C error?
####################################################################################################################################
sub errorC
{
my $self = shift;

return $self->{bErrorC};
}

####################################################################################################################################
# extra
####################################################################################################################################
Expand Down Expand Up @@ -211,7 +201,7 @@ sub isException
# If a standard Exception
if (blessed($$roException))
{
return $$roException->isa('pgBackRest::Common::Exception') ? 1 : 0;
return $$roException->isa('BackRestDoc::Common::Exception') ? 1 : 0;
}
# Else if a specially formatted string from the C library
elsif ($$roException =~ /^PGBRCLIB\:[0-9]+\:/)
Expand All @@ -226,7 +216,7 @@ sub isException
my $strMessage = join(':', @stryException);

# Create exception
$$roException = new pgBackRest::Common::Exception("ERROR", $iCode, $strMessage, $strTrace, undef, 1);
$$roException = new BackRestDoc::Common::Exception("ERROR", $iCode, $strMessage, $strTrace, undef, 1);

return 1;
}
Expand Down
@@ -1,7 +1,7 @@
####################################################################################################################################
# COMMON INI MODULE
####################################################################################################################################
package pgBackRest::Common::Ini;
package BackRestDoc::Common::Ini;

use strict;
use warnings FATAL => qw(all);
Expand All @@ -15,11 +15,12 @@ use File::Basename qw(dirname);
use JSON::PP;
use Storable qw(dclone);

use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;

use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;

####################################################################################################################################
# Boolean constants
####################################################################################################################################
Expand Down
@@ -1,7 +1,7 @@
####################################################################################################################################
# COMMON LOG MODULE
####################################################################################################################################
package pgBackRest::Common::Log;
package BackRestDoc::Common::Log;

use strict;
use warnings FATAL => qw(all);
Expand All @@ -15,8 +15,8 @@ use File::Basename qw(dirname);
use Scalar::Util qw(blessed reftype);
use Time::HiRes qw(gettimeofday usleep);

use pgBackRest::Common::Exception;
use pgBackRest::Common::String;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::String;

####################################################################################################################################
# Boolean constants
Expand Down Expand Up @@ -751,7 +751,7 @@ sub log
# Return a typed exception if code is defined
if (defined($iCode))
{
$oErrorLast = new pgBackRest::Common::Exception($strLevel, $iCode, $strMessage, longmess(), $rExtra);
$oErrorLast = new BackRestDoc::Common::Exception($strLevel, $iCode, $strMessage, longmess(), $rExtra);
return $oErrorLast;
}

Expand Down

0 comments on commit 36d4ab9

Please sign in to comment.