|
Revision 24509, 1.1 KB
(checked in by pipping@…, 5 years ago)
|
- fix bug reported by boeyms@ (thanks a lot!):
\b matches a dash, hence 'gimp-print' would match gimp\b
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #! /usr/bin/env perl |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use warnings; |
|---|
| 5 | |
|---|
| 6 | my $port = $ARGV[0]; |
|---|
| 7 | |
|---|
| 8 | # prepare frequently used regexes |
|---|
| 9 | my $trailing_comment = qr{;(?>\s*)#(?>.*)}; |
|---|
| 10 | my $leading_comment = qr{(?:^|\n)(?>\s*)#(?>.*)}; |
|---|
| 11 | my $connecting_backslash = qr{\s*\\\n\s*}; |
|---|
| 12 | |
|---|
| 13 | my $quick_check = qr{:$port}io; |
|---|
| 14 | my $dependency = qr{ |
|---|
| 15 | (?=[plb])(?:port|(?:path|lib|bin):[^:]+) # kind |
|---|
| 16 | : # separator |
|---|
| 17 | (?i:$port)(\s|\n|$) # name |
|---|
| 18 | }xo; |
|---|
| 19 | |
|---|
| 20 | $/ = ".\n"; |
|---|
| 21 | |
|---|
| 22 | while (defined(my $portfile = <*/*/Portfile>)) { |
|---|
| 23 | @ARGV = $portfile; |
|---|
| 24 | |
|---|
| 25 | while (<>) { |
|---|
| 26 | # make a quick and dirty check if the port has a remote chance of |
|---|
| 27 | # depending on $port |
|---|
| 28 | if ( m{$quick_check} ) { |
|---|
| 29 | |
|---|
| 30 | s{$connecting_backslash}{ }; # merge backslash-connected lines |
|---|
| 31 | s{$leading_comment}{}; # remove leading comments |
|---|
| 32 | s{$trailing_comment}{}; # remove trailing comments |
|---|
| 33 | |
|---|
| 34 | if ( m{$dependency} ) { |
|---|
| 35 | $portfile =~ s{/Portfile$}{}; # remove trailing '/Portfile' |
|---|
| 36 | print "$portfile\n"; |
|---|
| 37 | } |
|---|
| 38 | } |
|---|
| 39 | } |
|---|
| 40 | } |
|---|