Commit 8e899a8e authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 1158563: makedocs.pl is unable to load File::Copy::Recursive installed in bugzilla/lib/

r=dkl a=glob
parent a75e0696
...@@ -426,6 +426,7 @@ use constant FEATURE_FILES => ( ...@@ -426,6 +426,7 @@ use constant FEATURE_FILES => (
moving => ['importxml.pl'], moving => ['importxml.pl'],
auth_ldap => ['Bugzilla/Auth/Verify/LDAP.pm'], auth_ldap => ['Bugzilla/Auth/Verify/LDAP.pm'],
auth_radius => ['Bugzilla/Auth/Verify/RADIUS.pm'], auth_radius => ['Bugzilla/Auth/Verify/RADIUS.pm'],
documentation => ['docs/makedocs.pl'],
inbound_email => ['email_in.pl'], inbound_email => ['email_in.pl'],
jobqueue => ['Bugzilla/Job/*', 'Bugzilla/JobQueue.pm', jobqueue => ['Bugzilla/Job/*', 'Bugzilla/JobQueue.pm',
'Bugzilla/JobQueue/*', 'jobqueue.pl'], 'Bugzilla/JobQueue/*', 'jobqueue.pl'],
......
...@@ -9,6 +9,7 @@ package Pod::Simple::HTML::Bugzilla; ...@@ -9,6 +9,7 @@ package Pod::Simple::HTML::Bugzilla;
use 5.10.1; use 5.10.1;
use strict; use strict;
use warnings;
use parent qw(Pod::Simple::HTML); use parent qw(Pod::Simple::HTML);
......
...@@ -9,6 +9,7 @@ package Pod::Simple::HTMLBatch::Bugzilla; ...@@ -9,6 +9,7 @@ package Pod::Simple::HTMLBatch::Bugzilla;
use 5.10.1; use 5.10.1;
use strict; use strict;
use warnings;
use parent qw(Pod::Simple::HTMLBatch); use parent qw(Pod::Simple::HTMLBatch);
......
#!/usr/bin/perl -w #!/usr/bin/perl
# This Source Code Form is subject to the terms of the Mozilla Public # 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 # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
...@@ -25,36 +25,23 @@ ...@@ -25,36 +25,23 @@
use 5.10.1; use 5.10.1;
use strict; use strict;
use warnings;
use Cwd;
use File::Find;
use File::Basename; use File::Basename;
use File::Copy::Recursive qw(rcopy); BEGIN { chdir dirname($0); }
# We need to be in this directory to use our libraries.
BEGIN {
require File::Basename;
import File::Basename qw(dirname);
chdir dirname($0);
}
use lib qw(.. ../lib lib); use lib qw(.. ../lib lib);
# We only compile our POD if Pod::Simple is installed. We do the checks use Cwd;
# this way so that if there's a compile error in Pod::Simple::HTML::Bugzilla, use File::Copy::Recursive qw(rcopy);
# makedocs doesn't just silently fail, but instead actually tells us there's use File::Find;
# a compile error.
my $pod_simple;
if (eval { require Pod::Simple }) {
require Pod::Simple::HTMLBatch::Bugzilla;
require Pod::Simple::HTML::Bugzilla;
$pod_simple = 1;
};
use Bugzilla::Constants qw(BUGZILLA_VERSION bz_locations);
use File::Path qw(rmtree); use File::Path qw(rmtree);
use File::Which qw(which); use File::Which qw(which);
use Pod::Simple;
use Bugzilla::Constants qw(BUGZILLA_VERSION bz_locations);
use Pod::Simple::HTMLBatch::Bugzilla;
use Pod::Simple::HTML::Bugzilla;
############################################################################### ###############################################################################
# Subs # Subs
...@@ -65,8 +52,8 @@ sub MakeDocs { ...@@ -65,8 +52,8 @@ sub MakeDocs {
my ($name, $cmdline) = @_; my ($name, $cmdline) = @_;
say "Creating $name documentation ..." if defined $name; say "Creating $name documentation ..." if defined $name;
say "$cmdline\n"; say "make $cmdline\n";
system($cmdline) == 0 system('make', $cmdline) == 0
or $error_found = 1; or $error_found = 1;
print "\n"; print "\n";
} }
...@@ -125,7 +112,7 @@ my $docparent = getcwd(); ...@@ -125,7 +112,7 @@ my $docparent = getcwd();
foreach my $lang (@langs) { foreach my $lang (@langs) {
chdir "$docparent/$lang"; chdir "$docparent/$lang";
make_pod() if $pod_simple; make_pod();
next if grep { $_ eq '--pod-only' } @ARGV; next if grep { $_ eq '--pod-only' } @ARGV;
...@@ -144,10 +131,7 @@ foreach my $lang (@langs) { ...@@ -144,10 +131,7 @@ foreach my $lang (@langs) {
} }
# Collect up local extension documentation into the extensions/ dir. # Collect up local extension documentation into the extensions/ dir.
# Clear out old extensions docs rmtree("$lang/rst/extensions", 0, 1);
# For the life of me, I cannot get rmtree() to work here. It just returns
# silently without deleting anything - no errors.
system("rm -rf $lang/rst/extensions/*");
foreach my $ext_name (keys %extensions) { foreach my $ext_name (keys %extensions) {
my $src = $extensions{$ext_name} . "/*"; my $src = $extensions{$ext_name} . "/*";
...@@ -158,16 +142,16 @@ foreach my $lang (@langs) { ...@@ -158,16 +142,16 @@ foreach my $lang (@langs) {
chdir "$docparent/$lang"; chdir "$docparent/$lang";
MakeDocs('HTML', 'make html'); MakeDocs('HTML', 'html');
MakeDocs('TXT', 'make text'); MakeDocs('TXT', 'text');
if (grep { $_ eq '--with-pdf' } @ARGV) { if (grep { $_ eq '--with-pdf' } @ARGV) {
if (which('pdflatex')) { if (which('pdflatex')) {
MakeDocs('PDF', 'make latexpdf'); MakeDocs('PDF', 'latexpdf');
} }
elsif (which('rst2pdf')) { elsif (which('rst2pdf')) {
rmtree('pdf', 0, 1); rmtree('pdf', 0, 1);
MakeDocs('PDF', 'make pdf'); MakeDocs('PDF', 'pdf');
} }
else { else {
say 'pdflatex or rst2pdf not found. Skipping PDF file creation'; say 'pdflatex or rst2pdf not found. Skipping PDF file creation';
......
...@@ -49,6 +49,7 @@ use constant MODULE_WHITELIST => qw( ...@@ -49,6 +49,7 @@ use constant MODULE_WHITELIST => qw(
Bugzilla::Extension:: Bugzilla::Extension::
Bugzilla::Job:: Bugzilla::Job::
Bugzilla::Migrate:: Bugzilla::Migrate::
docs::lib::Pod::Simple::
); );
# Capture the TESTOUT from Test::More or Test::Builder for printing errors. # Capture the TESTOUT from Test::More or Test::Builder for printing errors.
......
...@@ -17,8 +17,8 @@ use File::Find; ...@@ -17,8 +17,8 @@ use File::Find;
our @additional_files = (); our @additional_files = ();
our @files = glob('*'); our @files = glob('*');
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla'); find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, qw(Bugzilla docs));
push(@files, 'extensions/create.pl'); push(@files, 'extensions/create.pl', 'docs/makedocs.pl');
our @extensions = our @extensions =
grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" } grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment