mirroring: add individual foreign vcs mirror control
[girocco.git] / toolbox / check-perl-modules.pl
blobc1801d0e1ad063daa8c152d78494ed3bb4a92744
1 #!/usr/bin/perl
3 # check-perl-modules.pl -- check for modules used by Girocco
4 # Copyright (c) 2013 Kyle J. McKay. All rights reserved.
5 # License GPLv2+: GNU GPL version 2 or later.
6 # www.gnu.org/licenses/gpl-2.0.html
7 # This is free software: you are free to change and redistribute it.
8 # There is NO WARRANTY, to the extent permitted by law.
10 # Attempt to require all the modules used by Perl anywhere in Girocco and
11 # report the failures. There is special handling for the SHA-1 functions
12 # and some other optional modules.
14 # These ones are not errors
16 eval {require Proc::ProcessTable; 1} or
17 print "Warning: missing Perl module Proc::ProcessTable, optional ".
18 "toolbox/kill-stale-daemons.pl will not function\n";
20 eval {require HTML::Entities; 1} or
21 print "Warning: missing Perl module HTML::Entities, gitweb ".
22 "email obfuscation will be partially disabled\n";
24 eval {require HTML::TagCloud; 1} or
25 print "Warning: missing Perl module HTML::TagCloud, optional gitweb tag cloud ".
26 "display will be all one size\n";
28 eval {require HTTP::Date; 1} ||
29 eval {require Time::ParseDate; 1} or
30 print "Warning: missing Perl module HTTP::Date and Time::ParseDate, gitweb ".
31 "will always return true to if-modified-since feed requests\n";
33 # These ones are required
35 my $errors = 0;
37 # For SHA1, any of Digest::SHA, Digest::SHA1 or Digest::SHA::PurePerl will do
39 eval {require Digest::SHA; 1} ||
40 eval {require Digest::SHA1; 1} ||
41 eval {require Digest::SHA::PurePerl; 1} or
42 ++$errors,
43 print STDERR "One of the Perl modules Digest::SHA or Digest::SHA1 or "
44 . "Digest::SHA::PurePerl must be available\n";
46 my @modules = qw(
47 CGI
48 CGI::Carp
49 CGI::Util
50 Digest::MD5
51 Encode
52 Errno
53 Fcntl
54 File::Basename
55 File::Find
56 File::Spec
57 File::stat
58 Getopt::Long
59 IO::Handle
60 IO::Socket
61 IPC::Open2
62 JSON
63 LWP::UserAgent
64 MIME::Base64
65 Pod::Usage
66 POSIX
67 RPC::XML
68 RPC::XML::Client
69 Socket
70 Storable
71 Time::Local
74 foreach my $module (@modules) {
75 eval "require $module; 1" or
76 ++$errors, print STDERR "Missing required Perl module $module\n";
79 eval {require JSON; 1} &&
80 eval {require LWP::UserAgent; 1} &&
81 eval {require RPC::XML; 1} &&
82 eval {require RPC::XML::Client; 1} or
83 print STDERR "Note that Perl modules JSON, LWP::UserAgent, RPC::XML and RPC::".
84 "XML::Client are required by the ref-change notification mechanism\n";
86 exit($errors ? 1 : 0);