| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: check-portability.sh,v 1.20 2020/05/04 21:32:48 rillig Exp $ | | 1 | # $NetBSD: check-portability.sh,v 1.21 2020/05/04 21:48:18 rillig Exp $ |
2 | # | | 2 | # |
3 | # This program checks all files in the current directory and any | | 3 | # This program checks all files in the current directory and any |
4 | # subdirectories for portability issues that are likely to result in | | 4 | # subdirectories for portability issues that are likely to result in |
5 | # false assumptions by the package. | | 5 | # false assumptions by the package. |
6 | # | | 6 | # |
7 | # The most prominent example is the "==" operator of test(1), which is | | 7 | # The most prominent example is the "==" operator of test(1), which is |
8 | # only implemented by bash and some versions of the ksh. | | 8 | # only implemented by bash and some versions of the ksh. |
9 | # | | 9 | # |
10 | # usage: cd $WRKSRC && [SKIP_FILTER=...] check-portability.sh | | 10 | # usage: cd $WRKSRC && [SKIP_FILTER=...] check-portability.sh |
11 | # | | 11 | # |
12 | | | 12 | |
13 | set -eu | | 13 | set -eu |
14 | | | 14 | |
| @@ -24,27 +24,36 @@ check_shell() { | | | @@ -24,27 +24,36 @@ check_shell() { |
24 | CK_FNAME="$1" \ | | 24 | CK_FNAME="$1" \ |
25 | CK_PROGNAME="check-portability.awk" \ | | 25 | CK_PROGNAME="check-portability.awk" \ |
26 | awk -f "$checkdir/check-subr.awk" \ | | 26 | awk -f "$checkdir/check-subr.awk" \ |
27 | -f "$checkdir/check-portability.awk" \ | | 27 | -f "$checkdir/check-portability.awk" \ |
28 | < "$1" 1>&2 \ | | 28 | < "$1" 1>&2 \ |
29 | || cs_exitcode=1 | | 29 | || cs_exitcode=1 |
30 | | | 30 | |
31 | if test -f "${PREFIX}/bin/check-portability"; then | | 31 | if test -f "${PREFIX}/bin/check-portability"; then |
32 | ${PREFIX}/bin/check-portability "$1" 1>&2 \ | | 32 | ${PREFIX}/bin/check-portability "$1" 1>&2 \ |
33 | || cs_exitcode=1 | | 33 | || cs_exitcode=1 |
34 | fi | | 34 | fi |
35 | } | | 35 | } |
36 | | | 36 | |
37 | patched_files=",$(awk 'BEGIN { ORS = "," } /^\+\+\+ / { print $2 }' "$PATCHDIR"/patch-*)," | | 37 | patched_files=",$(awk ' |
| | | 38 | BEGIN { |
| | | 39 | if (ARGV[1] ~ /\/patch-\*$/) |
| | | 40 | exit; |
| | | 41 | ORS = "," |
| | | 42 | } |
| | | 43 | /^\+\+\+ / { |
| | | 44 | print $2 |
| | | 45 | }' \ |
| | | 46 | "$PATCHDIR"/patch-*)," |
38 | | | 47 | |
39 | find ./* -type f -print 2>/dev/null \ | | 48 | find ./* -type f -print 2>/dev/null \ |
40 | | sed 's,$,_,' \ | | 49 | | sed 's,$,_,' \ |
41 | | { | | 50 | | { |
42 | opsys=`uname -s`-`uname -r` | | 51 | opsys=`uname -s`-`uname -r` |
43 | while read fname; do | | 52 | while read fname; do |
44 | fname="${fname#./}" | | 53 | fname="${fname#./}" |
45 | fname="${fname%_}" | | 54 | fname="${fname%_}" |
46 | | | 55 | |
47 | skip=no | | 56 | skip=no |
48 | eval "case \"\$fname\" in $SKIP_FILTER *.orig) skip=yes;; esac" | | 57 | eval "case \"\$fname\" in $SKIP_FILTER *.orig) skip=yes;; esac" |
49 | case "$fname" in *.in) | | 58 | case "$fname" in *.in) |
50 | case ",$patched_files," in *,"${fname%.in}",*) | | 59 | case ",$patched_files," in *,"${fname%.in}",*) |