summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2020-05-04 21:32:48 +0000
committerrillig <rillig@pkgsrc.org>2020-05-04 21:32:48 +0000
commit99b51b6a50f6c98eb0f96faf4495952c9ad93cca (patch)
tree622b393f570eaf7a25d21b49766efb9c08c4bf9e /mk
parentbf0362f9e937027115286a73a1792b216899f97c (diff)
downloadpkgsrc-99b51b6a50f6c98eb0f96faf4495952c9ad93cca.tar.gz
mk/check/check-portability: skip X.in if X is patched
A commonly occuring scenario is that a package patches the configure script, but that the corresponding configure.in contains shell code that is not portable. In cases like these, configure.in is typically not used during the build, therefore there is no need to check it for portability. This also applies to all other combinations where a file is patched and the corresponding file.in contains unportable shell code.
Diffstat (limited to 'mk')
-rw-r--r--mk/check/check-portability.mk3
-rw-r--r--mk/check/check-portability.sh9
-rw-r--r--mk/check/check-subr.awk4
3 files changed, 12 insertions, 4 deletions
diff --git a/mk/check/check-portability.mk b/mk/check/check-portability.mk
index 7d19b7fbbd8..fdc4b1ca508 100644
--- a/mk/check/check-portability.mk
+++ b/mk/check/check-portability.mk
@@ -1,4 +1,4 @@
-# $NetBSD: check-portability.mk,v 1.14 2020/03/13 08:11:36 rillig Exp $
+# $NetBSD: check-portability.mk,v 1.15 2020/05/04 21:32:48 rillig Exp $
#
# This file contains some checks that are applied to the configure
# scripts to check for certain constructs that are known to cause
@@ -43,4 +43,5 @@ _check-portability:
cd ${WRKSRC}; \
env SKIP_FILTER=${CHECK_PORTABILITY_SKIP:@p@${p}) skip=yes;;@:Q} \
PREFIX=${PREFIX} \
+ PATCHDIR=${PATCHDIR} \
sh ${PKGSRCDIR}/mk/check/check-portability.sh
diff --git a/mk/check/check-portability.sh b/mk/check/check-portability.sh
index c4a7e3ca882..87cf1461501 100644
--- a/mk/check/check-portability.sh
+++ b/mk/check/check-portability.sh
@@ -1,4 +1,4 @@
-# $NetBSD: check-portability.sh,v 1.19 2020/03/13 08:11:36 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.20 2020/05/04 21:32:48 rillig Exp $
#
# This program checks all files in the current directory and any
# subdirectories for portability issues that are likely to result in
@@ -34,6 +34,8 @@ check_shell() {
fi
}
+patched_files=",$(awk 'BEGIN { ORS = "," } /^\+\+\+ / { print $2 }' "$PATCHDIR"/patch-*),"
+
find ./* -type f -print 2>/dev/null \
| sed 's,$,_,' \
| {
@@ -44,6 +46,11 @@ find ./* -type f -print 2>/dev/null \
skip=no
eval "case \"\$fname\" in $SKIP_FILTER *.orig) skip=yes;; esac"
+ case "$fname" in *.in)
+ case ",$patched_files," in *,"${fname%.in}",*)
+ skip=yes
+ esac
+ esac
[ $skip = no ] || continue
skip_shebang_test=no
diff --git a/mk/check/check-subr.awk b/mk/check/check-subr.awk
index 70a7d2381ee..a713068c7db 100644
--- a/mk/check/check-subr.awk
+++ b/mk/check/check-subr.awk
@@ -1,4 +1,4 @@
-# $NetBSD: check-subr.awk,v 1.3 2006/12/31 13:35:10 rillig Exp $
+# $NetBSD: check-subr.awk,v 1.4 2020/05/04 21:32:48 rillig Exp $
#
# This file contains functions that are used by the various awk
# programs that check things in pkgsrc. All these programs must be
@@ -7,7 +7,7 @@
# CK_FNAME
# The name of the file that is checked. Since awk interprets
# command line arguments in a weird way, the input file must be
-# passed via stdin.
+# passed via the environment.
#
# CK_PROGNAME
# The program name to be used in diagnostic messages.