Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc mk/check/check-portability: opt-in for newer portabili...
details: https://anonhg.NetBSD.org/pkgsrc/rev/41b806541b86
branches: trunk
changeset: 430854:41b806541b86
user: rillig <rillig%pkgsrc.org@localhost>
date: Tue May 05 05:55:25 2020 +0000
description:
mk/check/check-portability: opt-in for newer portability checks
There are a few portability checks that have been existing for years.
Later additions need an opt-in phase to avoid breaking existing usages.
https://mail-index.netbsd.org/tech-pkg/2020/05/04/msg023084.html
diffstat:
mk/check/check-portability.mk | 10 ++++++++-
mk/check/check-portability.sh | 5 ++-
regress/infra-unittests/check-portability.sh | 31 ++++++++++++++++++++++-----
3 files changed, 37 insertions(+), 9 deletions(-)
diffs (126 lines):
diff -r 686b1cd33737 -r 41b806541b86 mk/check/check-portability.mk
--- a/mk/check/check-portability.mk Tue May 05 05:53:38 2020 +0000
+++ b/mk/check/check-portability.mk Tue May 05 05:55:25 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-portability.mk,v 1.15 2020/05/04 21:32:48 rillig Exp $
+# $NetBSD: check-portability.mk,v 1.16 2020/05/05 05:55:26 rillig Exp $
#
# This file contains some checks that are applied to the configure
# scripts to check for certain constructs that are known to cause
@@ -13,6 +13,13 @@
#
# Default value: yes for PKG_DEVELOPERs, no otherwise.
#
+# CHECK_PORTABILITY_EXPERIMENTAL
+# Enable additional experimental portability checks. New checks
+# may be added without further notice, so expect some packages
+# that previously succeeded to suddenly fail to build.
+#
+# Default value: no
+#
# Package-settable variables:
#
# CHECK_PORTABILITY_SKIP
@@ -44,4 +51,5 @@
env SKIP_FILTER=${CHECK_PORTABILITY_SKIP:@p@${p}) skip=yes;;@:Q} \
PREFIX=${PREFIX} \
PATCHDIR=${PATCHDIR} \
+ CHECK_PORTABILITY_EXPERIMENTAL=${CHECK_PORTABILITY_EXPERIMENTAL:Uno} \
sh ${PKGSRCDIR}/mk/check/check-portability.sh
diff -r 686b1cd33737 -r 41b806541b86 mk/check/check-portability.sh
--- a/mk/check/check-portability.sh Tue May 05 05:53:38 2020 +0000
+++ b/mk/check/check-portability.sh Tue May 05 05:55:25 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-portability.sh,v 1.21 2020/05/04 21:48:18 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.22 2020/05/05 05:55:26 rillig Exp $
#
# This program checks all files in the current directory and any
# subdirectories for portability issues that are likely to result in
@@ -80,7 +80,8 @@
(c|C|cc|cxx|f|go|pl|py|ac|m4) continue ;;
esac
- if [ $skip_shebang_test = yes ]; then
+ if [ "$CHECK_PORTABILITY_EXPERIMENTAL" = yes ] &&
+ [ $skip_shebang_test = yes ]; then
check_shell "$fname"
continue
fi
diff -r 686b1cd33737 -r 41b806541b86 regress/infra-unittests/check-portability.sh
--- a/regress/infra-unittests/check-portability.sh Tue May 05 05:53:38 2020 +0000
+++ b/regress/infra-unittests/check-portability.sh Tue May 05 05:55:25 2020 +0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# $NetBSD: check-portability.sh,v 1.2 2020/05/04 21:48:18 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.3 2020/05/05 05:55:25 rillig Exp $
#
# Test cases for mk/check/check-portability.*.
#
@@ -12,6 +12,7 @@
check_portability_sh() {
env PATCHDIR='patches' \
PREFIX='/nonexistent' \
+ "$@" \
sh "$pkgsrcdir/mk/check/check-portability.sh" \
1>"$tmpdir/out" 2>&1 \
&& exitcode=0 || exitcode=$?
@@ -109,7 +110,8 @@
create_file_lines 'work/configure.in' \
'test a == b'
- check_portability_sh
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=yes'
assert_that "out" --file-is-empty
assert_that $exitcode --equals 0
@@ -126,7 +128,8 @@
'#! /bin/sh' \
'test a == b'
- check_portability_sh
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=yes'
create_file 'expected' <<'EOF'
ERROR: [check-portability.awk] => Found test ... == ...:
@@ -159,8 +162,8 @@
if test_case_begin 'special characters in filenames'; then
- # Ensure that the filename matching does not treat special
- # characters as shell commands.
+ # Ensure that the filename matching for patched files
+ # does not treat special characters as shell metacharacters.
create_file_lines 'work/patches/patch-aa' \
'+++ [[[[(`" 2020-05-04'
@@ -168,7 +171,8 @@
'#! /bin/sh' \
'test a = b'
- check_portability_sh
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=yes'
assert_that 'out' --file-is-empty
assert_that $exitcode --equals 0
@@ -193,3 +197,18 @@
test_case_end
fi
+
+
+if test_case_begin 'no experimental by default'; then
+
+ create_file_lines 'configure.in' \
+ 'test a == b'
+
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=no'
+
+ assert_that 'out' --file-is-empty
+ assert_that $exitcode --equals 0
+
+ test_case_end
+fi
Home |
Main Index |
Thread Index |
Old Index