Module Name:    src
Committed By:   sjg
Date:           Fri Sep  9 18:36:16 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: Makefile export.mk make-exported.mk

Log Message:
Handle deprecation of egrep


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/export.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/make-exported.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.324 src/usr.bin/make/unit-tests/Makefile:1.325
--- src/usr.bin/make/unit-tests/Makefile:1.324	Sat Sep  3 15:03:32 2022
+++ src/usr.bin/make/unit-tests/Makefile	Fri Sep  9 18:36:15 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.324 2022/09/03 15:03:32 sjg Exp $
+# $NetBSD: Makefile,v 1.325 2022/09/09 18:36:15 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -673,7 +673,15 @@ TMPDIR:=	/tmp/uid${.MAKE.UID}
 _!= mkdir -p ${TMPDIR}
 .endif
 
-MAKE_TEST_ENV=	MALLOC_OPTIONS="JA"	# for jemalloc 100
+# Some systems have deprecated egrep for grep -E
+# but not everyone supports that
+.if ${.MAKE.OS:NLinux} == ""
+EGREP= grep -E
+.endif
+EGREP?= egrep
+
+MAKE_TEST_ENV=  EGREP="${EGREP}"
+MAKE_TEST_ENV+=	MALLOC_OPTIONS="JA"	# for jemalloc 100
 MAKE_TEST_ENV+=	MALLOC_CONF="junk:true"	# for jemalloc 510
 MAKE_TEST_ENV+= TMPDIR=${TMPDIR}
 
@@ -722,6 +730,7 @@ _SED_CMDS+=	-e 's,${.CURDIR},<curdir>,g'
 _SED_CMDS+=	-e 's,<curdir>/,,g'
 _SED_CMDS+=	-e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
 _SED_CMDS+=	-e '/MAKE_VERSION/d'
+_SED_CMDS+=	-e '/EGREP=/d'
 
 .rawout.out:
 	@${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.PREFIX:T}} \

Index: src/usr.bin/make/unit-tests/export.mk
diff -u src/usr.bin/make/unit-tests/export.mk:1.11 src/usr.bin/make/unit-tests/export.mk:1.12
--- src/usr.bin/make/unit-tests/export.mk:1.11	Sun Dec  5 14:57:36 2021
+++ src/usr.bin/make/unit-tests/export.mk	Fri Sep  9 18:36:15 2022
@@ -1,4 +1,4 @@
-# $NetBSD: export.mk,v 1.11 2021/12/05 14:57:36 rillig Exp $
+# $NetBSD: export.mk,v 1.12 2022/09/09 18:36:15 sjg Exp $
 
 UT_TEST=	export
 UT_FOO=		foo${BAR}
@@ -40,7 +40,7 @@ BAR=	bar is ${UT_FU}
 
 .MAKE.EXPORTED+=	UT_ZOO UT_TEST
 
-FILTER_CMD?=	egrep -v '^(MAKEFLAGS|MALLOC_.*|PATH|PWD|SHLVL|_|&)='
+FILTER_CMD?=	${EGREP} -v '^(MAKEFLAGS|MALLOC_.*|PATH|PWD|SHLVL|_|&)='
 
 all:
 	@env | ${FILTER_CMD} | sort

Index: src/usr.bin/make/unit-tests/make-exported.mk
diff -u src/usr.bin/make/unit-tests/make-exported.mk:1.6 src/usr.bin/make/unit-tests/make-exported.mk:1.7
--- src/usr.bin/make/unit-tests/make-exported.mk:1.6	Mon Oct  5 19:27:48 2020
+++ src/usr.bin/make/unit-tests/make-exported.mk	Fri Sep  9 18:36:15 2022
@@ -1,4 +1,4 @@
-# $NetBSD: make-exported.mk,v 1.6 2020/10/05 19:27:48 rillig Exp $
+# $NetBSD: make-exported.mk,v 1.7 2022/09/09 18:36:15 sjg Exp $
 #
 # As of 2020-08-09, the code in Var_Export is shared between the .export
 # directive and the .MAKE.EXPORTED variable.  This leads to non-obvious
@@ -22,4 +22,4 @@ UT_VAR=		${UNEXPANDED}
 .MAKE.EXPORTED=		-literal UT_VAR
 
 all:
-	@env | sort | grep -E '^UT_|make-exported-value' || true
+	@env | sort | ${EGREP} '^UT_|make-exported-value' || true

Reply via email to