Commit 87bb4367 authored by sikeda's avatar sikeda
Browse files

[-dev] --with option to enable optional packages.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12152 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 1acc4da6
......@@ -5,10 +5,41 @@
use lib qw(src/lib);
use strict;
use warnings;
use English qw(-no_match_vars);
use Text::Wrap qw();
use Sympa::Constants;
use Sympa::ModDef;
my %m = %Sympa::ModDef::cpan_modules;
my @args;
while (my $arg = shift) {
if ($arg =~ /\A--with=([-\w]+)\z/) {
my $package = $1;
if (grep { $_->{package_name} eq $package and not $_->{mandatory} }
grep { $_->{package_name} } values %m
) {
map { $_->{mandatory} = 1 }
grep { $_->{package_name} and $_->{package_name} eq $package }
values %m;
push @args, $arg;
} else {
warn "Unknown or mandatory package $package\n";
}
} elsif ($arg eq '-h' or $arg eq '--help') {
print "Usage: $0 [ --with=Package-Name ... ]\n";
exit 0;
} else {
warn "Unknown option $arg\n";
}
}
my $commandline = Text::Wrap::wrap(
'# Generated by: ',
'# ', sprintf '%s %s',
$PROGRAM_NAME, join ' ', @args
);
my $requires =
sprintf('Requires: perl >= %s', $m{perl}->{required_version}) . "\n"
. join(
......@@ -34,12 +65,14 @@ my $version = Sympa::Constants::VERSION();
undef $/;
$_ = <DATA>;
s/\@COMMANDLINE\@/$commandline/;
s/\@VERSION\@/$version/;
s/\@REQUIRES\@/$requires/;
print $_;
__END__
# RPM spec file for Sympa.
@COMMANDLINE@
%define name sympa
%define version @VERSION@
......
Supports Markdown
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