[1/2] perl.req: Allow filtering the found requirements.
Commit Message
The filter mechanism easy can be used by adding something like
the following example in the corresponding nm file.
export FILTER_PERL_REQUIRES = \
Some::Module \
Example:: \
abc
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
src/scripts/perl.req | 12 ++++++++++++
1 file changed, 12 insertions(+)
@@ -20,6 +20,8 @@
# then these are treated as additional names which are required by the
# file and are printed as well.
+my @filter = split(/ /, $ENV{'FILTER_PERL_REQUIRES'});
+
my $BUILDROOT = shift;
# Check if BUILDROOT is set
@@ -45,6 +47,8 @@ foreach my $perlver (sort keys %perlreq) {
}
foreach my $module (sort keys %global_require) {
+ next if (&is_filtered($module));
+
if (length($global_require{$module}) == 0) {
print "perl($module)\n";
@@ -388,3 +392,11 @@ sub process_file {
return;
}
+
+sub is_filtered($) {
+ my ($module) = @_;
+
+ foreach my $item (@filter) {
+ return 1 if (index($module, $item) != -1);
+ }
+}