From f6b861f12d070ba931d829505bfd3229653f5df2 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 25 Jan 2021 12:13:54 +0000 Subject: Fix unnecessary begin blocks in Perl source files. --- tools/directive | 10 +--------- tools/genssl | 6 +----- tools/mkdescriptions | 15 ++++----------- tools/mkheaders | 13 +++---------- tools/test-build | 17 +++++------------ tools/testssl | 6 +----- 6 files changed, 15 insertions(+), 52 deletions(-) (limited to 'tools') 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 (, , ) { +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); -- cgit v1.2.3