diff options
author | rillig <rillig@pkgsrc.org> | 2007-07-15 22:13:46 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-07-15 22:13:46 +0000 |
commit | d74b4b023a3086bb7153b7ad27ab8383f780127a (patch) | |
tree | 7c8d9341c6bc70ae75a03e977d3b078bc27238aa /pkgtools | |
parent | 18373871b37ae274d376fb7b1d3ac4ee0bc1dddc (diff) | |
download | pkgsrc-d74b4b023a3086bb7153b7ad27ab8383f780127a.tar.gz |
Added support for SUBST_VARS.*.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index eee68cb4ea7..1791e6d4458 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.712 2007/07/10 15:27:57 joerg Exp $ +# $NetBSD: pkglint.pl,v 1.713 2007/07/15 22:13:46 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -1294,7 +1294,7 @@ use enum qw(:SUBST_ ID CLASS STAGE MESSAGE FILES SED VARS FILTER_CMD); sub new($) { my ($class) = @_; - my ($self) = ([undef, undef, undef, undef, [], [], undef, undef]); + my ($self) = ([undef, undef, undef, undef, [], [], [], undef]); bless($self, $class); return $self; } @@ -1304,19 +1304,21 @@ sub subst_stage($) { return shift(@_)->[SUBST_STAGE]; } sub subst_message($) { return shift(@_)->[SUBST_MESSAGE]; } sub subst_files($) { return shift(@_)->[SUBST_FILES]; } sub subst_sed($) { return shift(@_)->[SUBST_SED]; } +sub subst_vars($) { return shift(@_)->[SUBST_VARS]; } sub subst_filter_cmd($) { return shift(@_)->[SUBST_FILTER_CMD]; } sub subst_id($) { return shift(@_)->[SUBST_ID]; } sub init($) { my ($self) = @_; + $self->[SUBST_ID] = undef; $self->[SUBST_CLASS] = undef; $self->[SUBST_STAGE] = undef; $self->[SUBST_MESSAGE] = undef; $self->[SUBST_FILES] = []; $self->[SUBST_SED] = []; + $self->[SUBST_VARS] = []; $self->[SUBST_FILTER_CMD] = undef; - $self->[SUBST_ID] = undef; } sub check_end($$) { @@ -1333,8 +1335,8 @@ sub check_end($$) { if (@{$self->subst_files} == 0) { $line->log_warning("Incomplete SUBST block: SUBST_FILES missing."); } - if (@{$self->subst_sed} == 0 && !defined($self->subst_filter_cmd)) { - $line->log_warning("Incomplete SUBST block: SUBST_SED missing."); + if (@{$self->subst_sed} == 0 && @{$self->subst_vars} == 0 && !defined($self->subst_filter_cmd)) { + $line->log_warning("Incomplete SUBST block: SUBST_SED or SUBST_VARS missing."); } $self->init(); } @@ -1345,7 +1347,7 @@ sub is_complete($) { return false unless defined($self->subst_id); return false unless defined($self->subst_class); return false unless defined($self->subst_files); - return false unless defined($self->subst_sed); + return false if @{$self->subst_sed} == 0 && @{$self->subst_vars} == 0; return true; } @@ -1372,7 +1374,7 @@ sub check_varassign($$$$$) { $id = $self->subst_id; - if ($varname =~ qr"^(SUBST_(?:STAGE|MESSAGE|FILES|SED|FILTER_CMD))\.([\-\w_]+)$") { + if ($varname =~ qr"^(SUBST_(?:STAGE|MESSAGE|FILES|SED|VARS|FILTER_CMD))\.([\-\w_]+)$") { ($varbase, $varparam) = ($1, $2); if (!defined($id)) { @@ -1441,6 +1443,14 @@ sub check_varassign($$$$$) { $self->[SUBST_FILTER_CMD] = $value; } + } elsif ($varbase eq "SUBST_VARS") { + if (@{$self->subst_vars} > 0) { + if ($op ne "+=") { + $line->log_warning("All but the first SUBST_VARS line should use the \"+=\" operator."); + } + } + push(@{$self->subst_vars}, $value); + } else { $line->log_warning("Foreign variable in SUBST block."); } |