summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-04-13 19:17:10 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-04-13 19:17:52 +0200
commitab7e4149471d48fb00bcbbf59ceafdde87782c51 (patch)
treee9008a640be00ff9e5a1d32dcaf8aa5ef2893ea7 /Bugzilla
parent7b7e0cc4000fa15305a8f76f580b3a2dd22a04ee (diff)
downloadbugzilla-ab7e4149471d48fb00bcbbf59ceafdde87782c51.tar.gz
bugzilla-ab7e4149471d48fb00bcbbf59ceafdde87782c51.tar.xz
Bug 1152360: backport upstream bug 1143005 that adds a parameter to checksetup.pl for generating cpanfile for dependency resolution
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Install/Requirements.pm44
1 files changed, 44 insertions, 0 deletions
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 6bb012230..fe66b581b 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -29,6 +29,7 @@ use version;
use Bugzilla::Constants;
use Bugzilla::Install::Util qw(vers_cmp install_string bin_loc
extension_requirement_packages);
+use File::Slurp;
use List::Util qw(max);
use Safe;
use Term::ANSIColor;
@@ -48,6 +49,7 @@ our @EXPORT = qw(
check_requirements
check_graphviz
+ export_cpanfile
have_vers
install_command
map_files_to_features
@@ -790,6 +792,48 @@ sub map_files_to_features {
return \%files;
}
+sub export_cpanfile {
+ my $cpanfile;
+ # Required modules
+ foreach my $module (@{ REQUIRED_MODULES() }) {
+ my $requires = "requires '" . $module->{module} . "'";
+ $requires .= ", '" . $module->{version} . "'" if $module->{version};
+ $requires .= ";\n";
+ $cpanfile .= $requires;
+ }
+ # Recommended modules
+ foreach my $module (@{ OPTIONAL_MODULES() }) {
+ my $recommends = "";
+ if (exists $module->{feature}) {
+ foreach my $feature (@{ $module->{feature} }) {
+ $recommends .= "feature '" . $feature . "', '" . $module->{package} . "' => sub {\n";
+ $recommends .= " recommends '" . $module->{module} . "'";
+ $recommends .= ", '" . $module->{version} . "'" if $module->{version};
+ $recommends .= ";\n};\n";
+ }
+ }
+ else {
+ $recommends .= "recommends '" . $module->{module} . "'";
+ $recommends .= ", '" . $module->{version} . "'" if $module->{version};
+ $recommends .= ";\n";
+ }
+ $cpanfile .= $recommends;
+ }
+ # Database modules
+ foreach my $db (keys %{ DB_MODULE() }) {
+ next if !exists DB_MODULE->{$db}->{dbd};
+ my $dbd = DB_MODULE->{$db}->{dbd};
+ my $recommends .= "feature '$db', '" . $dbd->{package} . "' => sub {\n";
+ $recommends .= " recommends '" . $dbd->{module} . "'";
+ $recommends .= ", '" . $dbd->{version} . "'" if $dbd->{version};
+ $recommends .= ";\n};\n";
+ $cpanfile .= $recommends;
+ }
+
+ # Write out the cpanfile to the document root
+ write_file(bz_locations()->{'libpath'} . '/cpanfile', \$cpanfile);
+}
+
1;
__END__