pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   rillig
Date:           Tue May  5 05:55:26 UTC 2020

Modified Files:
        pkgsrc/mk/check: check-portability.mk check-portability.sh
        pkgsrc/regress/infra-unittests: check-portability.sh

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 pkgsrc/mk/check/check-portability.mk
cvs rdiff -u -r1.21 -r1.22 pkgsrc/mk/check/check-portability.sh
cvs rdiff -u -r1.2 -r1.3 pkgsrc/regress/infra-unittests/check-portability.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/check/check-portability.mk
diff -u pkgsrc/mk/check/check-portability.mk:1.15 pkgsrc/mk/check/check-portability.mk:1.16
--- pkgsrc/mk/check/check-portability.mk:1.15   Mon May  4 21:32:48 2020
+++ pkgsrc/mk/check/check-portability.mk        Tue May  5 05:55:26 2020
@@ -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 @@ _check-portability:
        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

Index: pkgsrc/mk/check/check-portability.sh
diff -u pkgsrc/mk/check/check-portability.sh:1.21 pkgsrc/mk/check/check-portability.sh:1.22
--- pkgsrc/mk/check/check-portability.sh:1.21   Mon May  4 21:48:18 2020
+++ pkgsrc/mk/check/check-portability.sh        Tue May  5 05:55:26 2020
@@ -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 @@ find ./* -type f -print 2>/dev/null \
                (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

Index: pkgsrc/regress/infra-unittests/check-portability.sh
diff -u pkgsrc/regress/infra-unittests/check-portability.sh:1.2 pkgsrc/regress/infra-unittests/check-portability.sh:1.3
--- pkgsrc/regress/infra-unittests/check-portability.sh:1.2     Mon May  4 21:48:18 2020
+++ pkgsrc/regress/infra-unittests/check-portability.sh Tue May  5 05:55:25 2020
@@ -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 @@ set -eu
 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 @@ if test_case_begin 'configure patched, c
        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 @@ if test_case_begin 'configure patched an
                '#! /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 @@ fi
 
 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 @@ if test_case_begin 'special characters i
                '#! /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 @@ if test_case_begin 'no patches'; then
 
        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