summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorEd Morley <emorley@mozilla.com>2015-06-19 20:11:58 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-06-19 20:52:45 +0200
commit655f7628e9d88609c41a36d3c27ed41ea5997401 (patch)
treeeff1f366213ffa1cb197d9dfd2bed0666626f922 /Bugzilla
parentde934d20fd826ac47b459ab2967bf5849e70870b (diff)
downloadbugzilla-655f7628e9d88609c41a36d3c27ed41ea5997401.tar.gz
bugzilla-655f7628e9d88609c41a36d3c27ed41ea5997401.tar.xz
Bug 1175644: backport upstream bug 1174695 to bmo/master to improve cpanfile created by checksetup.pl
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Install/Requirements.pm27
1 files changed, 21 insertions, 6 deletions
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 22eb4f0c9..1b610287d 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -803,28 +803,43 @@ sub export_cpanfile {
$cpanfile .= $requires;
}
# Recommended modules
+ $cpanfile .= "\n# Optional\n";
+ my %features;
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";
+ # cpanm requires that each feature only be defined in the cpanfile
+ # once, so we use an intermediate hash to consolidate/de-dupe the
+ # modules associated with each feature.
+ $features{$feature}{$module->{module}} = $module->{version};
}
}
else {
+ my $recommends = "";
$recommends .= "recommends '" . $module->{module} . "'";
$recommends .= ", '" . $module->{version} . "'" if $module->{version};
$recommends .= ";\n";
+ $cpanfile .= $recommends;
+ }
+ }
+ foreach my $feature (sort keys %features) {
+ my $recommends = "";
+ $recommends .= "feature '" . $feature . "' => sub {\n";
+ foreach my $module (sort keys %{ $features{$feature} }) {
+ my $version = $features{$feature}{$module};
+ $recommends .= " recommends '" . $module . "'";
+ $recommends .= ", '$version'" if $version;
+ $recommends .= ";\n";
}
+ $recommends .= "};\n";
$cpanfile .= $recommends;
}
# Database modules
+ $cpanfile .= "\n# Database support\n";
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";
+ my $recommends .= "feature '$db' => sub {\n";
$recommends .= " recommends '" . $dbd->{module} . "'";
$recommends .= ", '" . $dbd->{version} . "'" if $dbd->{version};
$recommends .= ";\n};\n";