Chris Butler
2010-05-22 17:32:36 UTC
As part of the Debian packaging of xmltv, I needed a way to exclude
tv_grab_it_dvb from the build on the commandline for Makefile.PL. I noticed
that there was already an option to list the components you want, but not to
exclude them (I'd rather just exclude one component than list all the ones I
want). I've patched Makefile.PL to add an --exclude option, included below.
Are there any objections to me committing it to CVS?
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -59,10 +59,12 @@
my $opt_yes = 0;
my $opt_default = 0;
my $opt_components;
+my $opt_exclude;
GetOptions('strict-deps' => \$opt_strictdeps, # be strict about dependencies
yes => \$opt_yes, # answer yes to all questions
default => \$opt_default, # answer default to all questions
'components=s' => \$opt_components,
+ 'exclude=s' => \$opt_exclude,
);
our $VERSION;
@@ -751,6 +753,20 @@
END
;
+ my %by_name;
+ foreach (@opt_components) {
+ $by_name{$_->{name}} = $_;
+ $_->{exclude} = 0; # default if not mentioned
+ }
+
+ if (defined $opt_exclude) {
+ foreach (split /,/, $opt_exclude) {
+ my $i = $by_name{$_};
+ die "unknown component $_\n" if not $i;
+ $i->{exclude} = 1;
+ }
+ }
+
my $width = 0;
foreach my $info (@opt_components) {
my $w = length("$info->{blurb} ($info->{name})");
@@ -763,7 +779,7 @@
# Guess a default value for {install} based on whether
# prerequisites were found.
#
- $info->{install} = $opt_yes || not $info->{missing};
+ $info->{install} = not $info->{exclude} && ($opt_yes || not $info->{missing});
print STDERR ($s, ' ' x (1 + $width - length $s),
$info->{install} ? '[yes]' : '[no]',
tv_grab_it_dvb from the build on the commandline for Makefile.PL. I noticed
that there was already an option to list the components you want, but not to
exclude them (I'd rather just exclude one component than list all the ones I
want). I've patched Makefile.PL to add an --exclude option, included below.
Are there any objections to me committing it to CVS?
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -59,10 +59,12 @@
my $opt_yes = 0;
my $opt_default = 0;
my $opt_components;
+my $opt_exclude;
GetOptions('strict-deps' => \$opt_strictdeps, # be strict about dependencies
yes => \$opt_yes, # answer yes to all questions
default => \$opt_default, # answer default to all questions
'components=s' => \$opt_components,
+ 'exclude=s' => \$opt_exclude,
);
our $VERSION;
@@ -751,6 +753,20 @@
END
;
+ my %by_name;
+ foreach (@opt_components) {
+ $by_name{$_->{name}} = $_;
+ $_->{exclude} = 0; # default if not mentioned
+ }
+
+ if (defined $opt_exclude) {
+ foreach (split /,/, $opt_exclude) {
+ my $i = $by_name{$_};
+ die "unknown component $_\n" if not $i;
+ $i->{exclude} = 1;
+ }
+ }
+
my $width = 0;
foreach my $info (@opt_components) {
my $w = length("$info->{blurb} ($info->{name})");
@@ -763,7 +779,7 @@
# Guess a default value for {install} based on whether
# prerequisites were found.
#
- $info->{install} = $opt_yes || not $info->{missing};
+ $info->{install} = not $info->{exclude} && ($opt_yes || not $info->{missing});
print STDERR ($s, ' ' x (1 + $width - length $s),
$info->{install} ? '[yes]' : '[no]',
--
Chris Butler <***@debian.org>
GnuPG Key ID: 4096R/49E3ACD3
Chris Butler <***@debian.org>
GnuPG Key ID: 4096R/49E3ACD3