diff options
author | Sadie Powell <sadie@witchery.services> | 2021-01-25 12:13:54 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-01-25 12:39:56 +0000 |
commit | f6b861f12d070ba931d829505bfd3229653f5df2 (patch) | |
tree | b043d1e05d9703ab0ec29be91055d793f0fd93d0 | |
parent | cc28ba0f2164ea68db1bc373ee06fc58f82c3314 (diff) |
Fix unnecessary begin blocks in Perl source files.
-rwxr-xr-x | configure | 6 | ||||
-rwxr-xr-x | make/calcdep.pl | 13 | ||||
-rw-r--r-- | make/common.pm | 6 | ||||
-rw-r--r-- | make/configure.pm | 6 | ||||
-rw-r--r-- | make/console.pm | 6 | ||||
-rw-r--r-- | make/directive.pm | 6 | ||||
-rwxr-xr-x | make/unit-cc.pl | 9 | ||||
-rwxr-xr-x | modulemanager | 15 | ||||
-rwxr-xr-x | tools/directive | 10 | ||||
-rwxr-xr-x | tools/genssl | 6 | ||||
-rwxr-xr-x | tools/mkdescriptions | 15 | ||||
-rwxr-xr-x | tools/mkheaders | 13 | ||||
-rwxr-xr-x | tools/test-build | 17 | ||||
-rwxr-xr-x | tools/testssl | 6 | ||||
-rwxr-xr-x | vendor/update | 10 |
15 files changed, 35 insertions, 109 deletions
@@ -30,11 +30,7 @@ # -BEGIN { - require 5.10.0; -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/make/calcdep.pl b/make/calcdep.pl index 59b61e65a..3c02024fa 100755 --- a/make/calcdep.pl +++ b/make/calcdep.pl @@ -21,20 +21,13 @@ # -BEGIN { - push @INC, $ENV{SOURCEPATH}; - require 5.10.0; - unless (-f 'configure') { - print "Error: $0 must be run from the main source directory!\n"; - exit 1; - } -} - use strict; use warnings FATAL => qw(all); -use File::Basename qw(basename); +use File::Basename qw(basename dirname); +use FindBin qw($RealDir); +use lib dirname $RealDir; use make::common; use constant { diff --git a/make/common.pm b/make/common.pm index 4d4cd397c..38b77e215 100644 --- a/make/common.pm +++ b/make/common.pm @@ -17,13 +17,9 @@ # -BEGIN { - require 5.10.0; -} - package make::common; -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/make/configure.pm b/make/configure.pm index 001de5fc7..dcdcd0aca 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -21,13 +21,9 @@ # -BEGIN { - require 5.10.0; -} - package make::configure; -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/make/console.pm b/make/console.pm index 33ce8f289..278c97d0f 100644 --- a/make/console.pm +++ b/make/console.pm @@ -19,11 +19,7 @@ package make::console; -BEGIN { - require 5.10.0; -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/make/directive.pm b/make/directive.pm index 0c789ebf4..25e61160e 100644 --- a/make/directive.pm +++ b/make/directive.pm @@ -19,11 +19,7 @@ package make::directive; -BEGIN { - require 5.10.0; -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/make/unit-cc.pl b/make/unit-cc.pl index 8006afe9b..f8991cb67 100755 --- a/make/unit-cc.pl +++ b/make/unit-cc.pl @@ -22,16 +22,15 @@ # -BEGIN { - push @INC, $ENV{SOURCEPATH}; - require 5.10.0; -} - +use v5.10.0; use strict; use warnings FATAL => qw(all); +use File::Basename qw(dirname); use File::Spec::Functions qw(abs2rel); +use FindBin qw($RealDir); +use lib dirname $RealDir; use make::console; use make::directive; diff --git a/modulemanager b/modulemanager index 1be9f52f9..9bedfcc65 100755 --- a/modulemanager +++ b/modulemanager @@ -22,7 +22,6 @@ BEGIN { - require 5.10.0; unless (eval "use LWP::Simple; 1") { die "Your system is missing the LWP::Simple Perl module!"; } @@ -31,7 +30,7 @@ BEGIN { } } -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); @@ -65,7 +64,7 @@ sub parse_url { return if $url_seen{$src}; $url_seen{$src}++; - my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); + my $ua = LWP::UserAgent->new; my $response = $ua->get($src); unless ($response->is_success) { @@ -107,7 +106,7 @@ sub parse_url { } # hash of installed module versions from our mini-database, key (m_foobar) to version (00abacca..). -my %mod_versions = read_config_file '.modulemanager'; +my %mod_versions = read_config_file "$RealDir/.modulemanager"; # useless helper stub sub getmodversion { @@ -116,7 +115,7 @@ sub getmodversion { } # read in external URL sources -open SRC, 'sources.list' or die "Could not open sources.list: $!"; +open SRC, "$RealDir/sources.list" or die "Could not open sources.list: $!"; while (<SRC>) { next if /^\s*#/; parse_url($_); @@ -310,7 +309,7 @@ print "Processing changes...\n"; for my $mod (keys %installed) { next if $todo{$mod}; print "Uninstalling $mod $installed{$mod}\n"; - unlink "src/modules/$mod.cpp"; + unlink "$RealDir/src/modules/$mod.cpp"; } my $count = scalar keys %todo; @@ -334,7 +333,7 @@ for my $mod (sort keys %todo) { my $response = $ua->get($url); if ($response->is_success) { - open(MF, ">src/modules/$mod.cpp") or die "\nFilesystem not writable: $!"; + open(MF, '>', "$RealDir/src/modules/$mod.cpp") or die "\nFilesystem not writable: $!"; print MF $response->content; close(MF); print " - done\n"; @@ -344,6 +343,6 @@ for my $mod (sort keys %todo) { } # write database of installed versions -write_config_file '.modulemanager', %mod_versions; +write_config_file "$RealDir/.modulemanager", %mod_versions; print "Finished!\n"; diff --git a/tools/directive b/tools/directive index 95fe847ac..07d4b09e2 100755 --- a/tools/directive +++ b/tools/directive @@ -18,15 +18,7 @@ # -BEGIN { - require 5.10.0; - unless (-f 'configure') { - print "Error: $0 must be run from the main source directory!\n"; - exit 1; - } -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/tools/genssl b/tools/genssl index 337244292..aab8ce553 100755 --- a/tools/genssl +++ b/tools/genssl @@ -19,11 +19,7 @@ # -BEGIN { - require 5.10.0; -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/tools/mkdescriptions b/tools/mkdescriptions index ee29f48e9..bb6f011d8 100755 --- a/tools/mkdescriptions +++ b/tools/mkdescriptions @@ -18,15 +18,7 @@ # -BEGIN { - require 5.10.0; - unless (-f 'configure') { - print "Error: $0 must be run from the main source directory!\n"; - exit 1; - } -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); @@ -42,7 +34,7 @@ use lib dirname $RealDir; use make::common; use make::console; -if (scalar @ARGV < 1) { +unless (scalar @ARGV) { print_format "<|GREEN Usage:|> $0 <<|UNDERLINE DOCS-SITE|>>\n", *STDERR; exit 1; } @@ -51,7 +43,8 @@ my %version = get_version(); my $docdir = rel2abs catdir $ARGV[0], 'docs', $version{MAJOR}, 'modules'; print_error "unable to find the module directory at $docdir!" unless -d $docdir; -for my $module (<src/modules/extra/m_*.cpp>, <src/modules/m_*.cpp>, <src/modules/m_*/main.cpp>) { +my $root = dirname $RealDir; +for my $module (<$root/src/modules/extra/m_*.cpp>, <$root/src/modules/m_*.cpp>, <$root/src/modules/m_*/main.cpp>) { print_error "unable to extract module name from $module!" unless $module =~ /m_(\w+)[.\/]/; my $docfile = catfile $docdir, "$1.md"; print_error "unable to find the module documentation at $docfile!" unless -f $docfile; diff --git a/tools/mkheaders b/tools/mkheaders index 0569ec422..0ca593584 100755 --- a/tools/mkheaders +++ b/tools/mkheaders @@ -18,15 +18,7 @@ # -BEGIN { - require 5.10.0; - unless (-f 'configure') { - print "Error: $0 must be run from the main source directory!\n"; - exit 1; - } -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); @@ -49,11 +41,12 @@ my @ignored_revisions = ( 'f2acdbc3820f0f4f5ef76a0a64e73d2a320df91f', # peavey fixing line endings ); -my @paths = File::Util->new->list_dir('.' => { recurse => 1 }); +my @paths = File::Util->new->list_dir(dirname($RealDir) => { recurse => 1 }); my @updated; for my $path (@paths) { next unless -f $path; next if $path =~ /\/\./; + next if $path =~ /\/build\//; next if $path =~ /\/vendor\//; if (system "git ls-files --error-unmatch -- $path 1>/dev/null 2>/dev/null") { diff --git a/tools/test-build b/tools/test-build index 25981d4a6..47df0c8f0 100755 --- a/tools/test-build +++ b/tools/test-build @@ -18,15 +18,7 @@ # -BEGIN { - require 5.10.0; - unless (-f 'configure') { - print "Error: $0 must be run from the main source directory!\n"; - exit 1; - } -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); @@ -42,6 +34,7 @@ $ENV{INSPIRCD_VERBOSE} = 1; execute 'git', 'clean', '-dfx'; +my $root = dirname $RealDir; my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc); foreach my $compiler (@compilers) { if (system "$compiler -v > /dev/null 2>&1") { @@ -57,14 +50,14 @@ foreach my $compiler (@compilers) { say "Attempting to build using the $compiler compiler and the $socketengine socket engine..."; my @configure_flags; if (defined $ENV{TEST_BUILD_MODULES}) { - execute './configure', '--enable-extras', $ENV{TEST_BUILD_MODULES}; + execute "$root/configure", '--enable-extras', $ENV{TEST_BUILD_MODULES}; push @configure_flags, '--disable-auto-extras'; } - if (execute './configure', '--development', '--socketengine', $socketengine, @configure_flags) { + if (execute "$root/configure", '--development', '--socketengine', $socketengine, @configure_flags) { say "Failed to configure using the $compiler compiler and the $socketengine socket engine!"; exit 1; } - if (execute 'make', '--jobs', get_cpu_count() + 1, 'install') { + if (execute 'make', '--directory', $root, '--jobs', get_cpu_count() + 1, 'install') { say "Failed to compile using the $compiler compiler and the $socketengine socket engine!"; exit 1; } diff --git a/tools/testssl b/tools/testssl index ece15984f..ea50aee4e 100755 --- a/tools/testssl +++ b/tools/testssl @@ -18,11 +18,7 @@ # -BEGIN { - require 5.10.0; -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); diff --git a/vendor/update b/vendor/update index 20a4284bc..ca113ff29 100755 --- a/vendor/update +++ b/vendor/update @@ -18,15 +18,7 @@ # -BEGIN { - require 5.10.0; - unless (-f 'configure') { - print "Error: $0 must be run from the main source directory!\n"; - exit 1; - } -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); |