Discussion:
[Xmltv-devel] Adding an --exclude option to Makefile.PL
Chris Butler
2010-05-22 17:32:36 UTC
Permalink
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]',
--
Chris Butler <***@debian.org>
GnuPG Key ID: 4096R/49E3ACD3
Robert Eden
2010-05-23 06:11:24 UTC
Permalink
Post by Chris Butler
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?
Sounds reasonable to me. Is there a perldoc file somewhere that needs
to be updated too?
Chris Butler
2010-05-23 13:46:39 UTC
Permalink
Post by Robert Eden
Post by Chris Butler
want). I've patched Makefile.PL to add an --exclude option, included below.
Are there any objections to me committing it to CVS?
Sounds reasonable to me. Is there a perldoc file somewhere that needs
to be updated too?
Not as far as I can see (the comment above the GetOptions call says that the
options are undocumented). Perhaps the available options should be mentioned
in the README as part of the Installation instructions?

I've committed the Makefile.PL change anyway, given that none of the options
are currently documented.
--
Chris Butler <***@debian.org>
GnuPG Key ID: 4096R/49E3ACD3
Robert Eden
2010-06-04 16:40:59 UTC
Permalink
Post by Chris Butler
I've committed the Makefile.PL change anyway, given that none of the options
are currently documented
Chris, I've found a problem with your updated Makefile.

If a dependency isn't met, that grabber should default to "NO". After
your change, all grabbers are "yes".

I suggest you delete a dependency for tv_grab_it_dvb and check your script.

Robert
Chris Butler
2010-06-04 17:44:37 UTC
Permalink
Post by Robert Eden
Chris, I've found a problem with your updated Makefile.
If a dependency isn't met, that grabber should default to "NO". After
your change, all grabbers are "yes".
Ah.. looks like an operator precedence issue in the install/exclude test.
I've just committed a fix.
--
Chris Butler <***@debian.org>
GnuPG Key ID: 4096R/49E3ACD3
Loading...