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:           Mon May  4 21:48:18 UTC 2020

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

Log Message:
mk/check/check-portability: fix error message when no patches are found


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 pkgsrc/mk/check/check-portability.sh
cvs rdiff -u -r1.1 -r1.2 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.sh
diff -u pkgsrc/mk/check/check-portability.sh:1.20 pkgsrc/mk/check/check-portability.sh:1.21
--- pkgsrc/mk/check/check-portability.sh:1.20   Mon May  4 21:32:48 2020
+++ pkgsrc/mk/check/check-portability.sh        Mon May  4 21:48:18 2020
@@ -1,4 +1,4 @@
-# $NetBSD: check-portability.sh,v 1.20 2020/05/04 21:32:48 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.21 2020/05/04 21:48:18 rillig Exp $
 #
 # This program checks all files in the current directory and any
 # subdirectories for portability issues that are likely to result in
@@ -34,7 +34,16 @@ check_shell() {
        fi
 }
 
-patched_files=",$(awk 'BEGIN { ORS = "," } /^\+\+\+ / { print $2 }' "$PATCHDIR"/patch-*),"
+patched_files=",$(awk '
+       BEGIN {
+               if (ARGV[1] ~ /\/patch-\*$/)
+                       exit;
+               ORS = ","
+       }
+       /^\+\+\+ / {
+               print $2
+       }' \
+       "$PATCHDIR"/patch-*),"
 
 find ./* -type f -print 2>/dev/null \
 | sed 's,$,_,' \

Index: pkgsrc/regress/infra-unittests/check-portability.sh
diff -u pkgsrc/regress/infra-unittests/check-portability.sh:1.1 pkgsrc/regress/infra-unittests/check-portability.sh:1.2
--- pkgsrc/regress/infra-unittests/check-portability.sh:1.1     Mon May  4 21:32:48 2020
+++ pkgsrc/regress/infra-unittests/check-portability.sh Mon May  4 21:48:18 2020
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: check-portability.sh,v 1.1 2020/05/04 21:32:48 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.2 2020/05/04 21:48:18 rillig Exp $
 #
 # Test cases for mk/check/check-portability.*.
 #
@@ -175,3 +175,21 @@ if test_case_begin 'special characters i
 
        test_case_end
 fi
+
+
+if test_case_begin 'no patches'; then
+
+       # Ensure that no error message is printed when there are no
+       # patch files.
+
+       create_file_lines 'file' \
+               '#! /bin/sh' \
+               'test a = b'
+
+       check_portability_sh
+
+       assert_that 'out' --file-is-empty
+       assert_that $exitcode --equals 0
+
+       test_case_end
+fi



Home | Main Index | Thread Index | Old Index