From 5f310e5b9e7afbd5badb17178349fefaaabfacce Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Thu, 30 Jun 2016 23:32:40 -0400 Subject: Bug 1283930 - Add Makefile.PL & local/lib/perl5 support to bmo/master + local symlink to data/ directory --- t/Support/Files.pm | 61 ++++++++++++++++++++---------------------- t/Support/Systemexec.pm | 21 +++++++++++---- t/Support/Templates.pm | 70 ++++++++++++++++++------------------------------- 3 files changed, 71 insertions(+), 81 deletions(-) (limited to 't/Support') diff --git a/t/Support/Files.pm b/t/Support/Files.pm index 00e0efd34..1bdf2eac7 100644 --- a/t/Support/Files.pm +++ b/t/Support/Files.pm @@ -1,45 +1,40 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code are the Bugzilla Tests. -# -# The Initial Developer of the Original Code is Zach Lipton -# Portions created by Zach Lipton are -# Copyright (C) 2001 Zach Lipton. All -# Rights Reserved. -# -# Contributor(s): Zach Lipton -# Joel Peshkin +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. package Support::Files; -use Bugzilla; +use 5.10.1; +use strict; +use warnings; use File::Find; +our @additional_files = (); + use constant IGNORE => qw( Bugzilla/DuoAPI.pm Bugzilla/DuoWeb.pm ); -@additional_files = (); +our @files = glob('*'); +find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, qw(Bugzilla docs)); +push(@files, 'extensions/create.pl', 'docs/makedocs.pl', 'cpanfile'); + +our @extensions = + grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" } + glob('extensions/*'); + +foreach my $extension (@extensions) { + find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension); +} -@files = glob('*'); -my @extension_paths = map { $_->package_dir } @{ Bugzilla->extensions }; -find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla', @extension_paths); -push(@files, 'extensions/create.pl'); +our @test_files = glob('t/*.t xt/*/*.t'); -my @extensions = glob('extensions/*'); foreach my $extension (@extensions) { # Skip disabled extensions next if -e "$extension/disabled"; @@ -55,7 +50,7 @@ sub isTestingFile { return undef if $ignore eq $file; } - if ($file =~ /\.cgi$|\.pl$|\.pm$/) { + if ($file =~ /\.psgi$|\.cgi$|\.pl$|\.pm$/) { return 1; } my $additional; @@ -65,11 +60,13 @@ sub isTestingFile { return undef; } -foreach $currentfile (@files) { +our (@testitems, @module_files); + +foreach my $currentfile (@files) { if (isTestingFile($currentfile)) { - push(@testitems,$currentfile); + push(@testitems, $currentfile); } + push(@module_files, $currentfile) if $currentfile =~ /\.pm$/; } - 1; diff --git a/t/Support/Systemexec.pm b/t/Support/Systemexec.pm index 676ee02a4..e73763f8f 100644 --- a/t/Support/Systemexec.pm +++ b/t/Support/Systemexec.pm @@ -1,14 +1,25 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. package Support::Systemexec; -require Exporter; -@ISA = qw(Exporter); -@EXPORT = qw(system exec); -@EXPORT_OK = qw(); + +use 5.10.1; +use strict; +use warnings; + +use parent qw(Exporter); +@Support::Systemexec::EXPORT = qw(system exec); + sub system($$@) { 1; } + sub exec($$@) { 1; } + 1; diff --git a/t/Support/Templates.pm b/t/Support/Templates.pm index 81dc8cc3f..5071d67ae 100644 --- a/t/Support/Templates.pm +++ b/t/Support/Templates.pm @@ -1,38 +1,21 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code are the Bugzilla tests. -# -# The Initial Developer of the Original Code is Jacob Steenhagen. -# Portions created by Jacob Steenhagen are -# Copyright (C) 2001 Jacob Steenhagen. All -# Rights Reserved. -# -# Contributor(s): Jacob Steenhagen -# David D. Kilzer -# Tobias Burnus +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. # +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. package Support::Templates; +use 5.10.1; use strict; +use warnings; use lib 't'; use base qw(Exporter); -@Support::Templates::EXPORT = - qw(@languages @include_paths $english_default_include_path - %include_path @referenced_files %actual_files $num_actual_files); -use vars qw(@languages @include_paths $english_default_include_path - %include_path @referenced_files %actual_files $num_actual_files); +@Support::Templates::EXPORT = + qw(@languages @include_paths @english_default_include_paths + %include_path @referenced_files %actual_files $num_actual_files); use Bugzilla; use Bugzilla::Constants; @@ -42,33 +25,32 @@ use Support::Files; use File::Find; use File::Spec; -# The available template languages -@languages = (); +# English default include paths +our @english_default_include_paths = + (File::Spec->catdir(bz_locations()->{'templatedir'}, 'en', 'default')); -# The colon separated includepath per language -%include_path = (); - -# All include paths -@include_paths = (); - -# English default include path -$english_default_include_path = - File::Spec->catdir(bz_locations()->{'templatedir'}, 'en', 'default'); +# And the extensions too +foreach my $extension (@Support::Files::extensions) { + my $dir = File::Spec->catdir($extension, 'template', 'en', 'default'); + if (-e $dir) { + push @english_default_include_paths, $dir; + } +} # Files which are referenced in the cgi files -@referenced_files = (); +our @referenced_files = (); # All files sorted by include_path -%actual_files = (); +our %actual_files = (); # total number of actual_files -$num_actual_files = 0; +our $num_actual_files = 0; # Set the template available languages and include paths -@languages = @{ Bugzilla->languages }; -@include_paths = @{ template_include_path({ language => Bugzilla->languages }) }; +our @languages = @{ Bugzilla->languages }; +our @include_paths = @{ template_include_path({ language => Bugzilla->languages }) }; -my @files; +our @files; # Local subroutine used with File::Find sub find_templates { -- cgit v1.2.3-24-g4f1b