From fe668307e129013f764d655fb4c3416872970de4 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Mon, 16 May 2022 23:13:53 +0000
Subject: x11-misc/alock: avoid using which in configure

Closes: https://bugs.gentoo.org/844886
Signed-off-by: Sam James <sam@gentoo.org>
---
 x11-misc/alock/alock-1.0.0-r1.ebuild |  3 ++-
 x11-misc/alock/files/no-which.patch  | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 x11-misc/alock/files/no-which.patch

diff --git a/x11-misc/alock/alock-1.0.0-r1.ebuild b/x11-misc/alock/alock-1.0.0-r1.ebuild
index 33a86aadaf0a..476253fafdaa 100644
--- a/x11-misc/alock/alock-1.0.0-r1.ebuild
+++ b/x11-misc/alock/alock-1.0.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -33,6 +33,7 @@ PATCHES=(
 	"${FILESDIR}"/tidy-printf.patch
 	"${FILESDIR}"/fix-aliasing.patch
 	"${FILESDIR}"/no-xf86misc.patch
+	"${FILESDIR}"/no-which.patch
 )
 
 src_configure() {
diff --git a/x11-misc/alock/files/no-which.patch b/x11-misc/alock/files/no-which.patch
new file mode 100644
index 000000000000..1764be32c82d
--- /dev/null
+++ b/x11-misc/alock/files/no-which.patch
@@ -0,0 +1,30 @@
+https://bugs.gentoo.org/844886
+--- a/configure
++++ b/configure
+@@ -26,7 +26,7 @@ msg_chkfor() {
+ check_docs() {
+ 
+     msg_chkfor "asciidoc"
+-    if which asciidoc 1> /dev/null 2>&3
++    if command -v asciidoc 1> /dev/null 2>&3
+     then
+         echo "ok."
+         echo "#_______________________" >&4
+@@ -40,7 +40,7 @@ check_docs() {
+ check_tools() {
+ 
+     msg_chkfor "compiler $CC"
+-    if which "$CC" 1> /dev/null 2>&3
++    if command -v "$CC" 1> /dev/null 2>&3
+     then
+         echo "ok."
+         echo "---------------------------------" 1>&3
+@@ -56,7 +56,7 @@ check_tools() {
+ check_imlib2() {
+ 
+     msg_chkfor "imlib2-config"
+-    if which imlib2-config 1> /dev/null 2>&3
++    if command -v imlib2-config 1> /dev/null 2>&3
+     then
+         echo "ok."
+         cat << EOF > tmp.c
-- 
cgit v1.2.3-65-gdbad


From f9a50f89252523542011b4ec28d467c30a855fb7 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 7 May 2022 07:46:18 +0100
Subject: autotools.eclass: egrep -> grep -E

Deprecated for a while but newer grep emits deprecation warnings.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/autotools.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index b8eeb55fd8f2..d6c5b7f0ec0d 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -283,7 +283,7 @@ _at_uses_pkg() {
 		for macro ; do
 			args+=( -e "^[[:space:]]*${macro}\>" )
 		done
-		egrep -q "${args[@]}" configure.??
+		grep -E -q "${args[@]}" configure.??
 	fi
 }
 _at_uses_autoheader()  { _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}; }
-- 
cgit v1.2.3-65-gdbad


From 76e219513367c692e7d46082ec5a6772e41edec0 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 7 May 2022 07:46:30 +0100
Subject: epatch.eclass: egrep -> grep -E

Deprecated for a while but newer grep emits deprecation	warnings.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/epatch.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/epatch.eclass b/eclass/epatch.eclass
index 5d18befe55b9..6a9c460da0a3 100644
--- a/eclass/epatch.eclass
+++ b/eclass/epatch.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: epatch.eclass
@@ -285,13 +285,13 @@ epatch() {
 		# people could (accidently) patch files in the root filesystem.
 		# Or trigger other unpleasantries #237667.  So disallow -p0 on
 		# such patches.
-		local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }')
+		local abs_paths=$(grep -E -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }')
 		if [[ -n ${abs_paths} ]] ; then
 			count=1
 			printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}"
 		fi
 		# Similar reason, but with relative paths.
-		local rel_paths=$(egrep -n '^[-+]{3} [^	]*[.][.]/' "${PATCH_TARGET}")
+		local rel_paths=$(grep -E -n '^[-+]{3} [^	]*[.][.]/' "${PATCH_TARGET}")
 		if [[ -n ${rel_paths} ]] ; then
 			echo
 			eerror "Rejected Patch: ${patchname}!"
-- 
cgit v1.2.3-65-gdbad


From 35f856adc153ee2697e71a280f80613ad3dedb20 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 7 May 2022 07:46:38 +0100
Subject: haskell-cabal.eclass: egrep -> grep -E

Deprecated for a while but newer grep emits deprecation	warnings.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/haskell-cabal.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index ae3229cc2676..64dcabb852b1 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: haskell-cabal.eclass
@@ -288,8 +288,8 @@ cabal-show-brokens() {
 	elog "ghc-pkg check: 'checking for other broken packages:'"
 	# pretty-printer
 	$(ghc-getghcpkg) check 2>&1 \
-		| egrep -v '^Warning: haddock-(html|interfaces): ' \
-		| egrep -v '^Warning: include-dirs: ' \
+		| grep -E -v '^Warning: haddock-(html|interfaces): ' \
+		| grep -E -v '^Warning: include-dirs: ' \
 		| head -n 20
 
 	cabal-die-if-nonempty 'broken' \
-- 
cgit v1.2.3-65-gdbad


From 3732ab5e6d4768c172627f39ae6269d1bf7f06c1 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 7 May 2022 07:47:21 +0100
Subject: ruby-ng.eclass: fgrep -> grep -F

Deprecated for a while but newer grep emits deprecation	warnings.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 70cb5be74b87..f0d6c4f6f6c4 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -604,7 +604,7 @@ _each_ruby_check_install() {
 	# that's what changes between two implementations (otherwise you'd get false
 	# positives now that Ruby 1.9.2 installs with the same sitedir as 1.8)
 	${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \
-		| fgrep -v "${libruby_soname}" \
+		| grep -F -v "${libruby_soname}" \
 		| grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \
 		> "${T}"/ruby-ng-${_ruby_implementation}-mislink.log
 
-- 
cgit v1.2.3-65-gdbad


From 9bc832c6d39b7b27314d7e08cd34fcd08713fe7f Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Sun, 15 May 2022 19:10:57 +0200
Subject: toolchain-funcs.eclass: deprecate tc-has-openmp

Signed-off-by: David Seifert <soap@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/toolchain-funcs.eclass | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 77fb304940b2..9ad5e224b03e 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2021 Gentoo Authors
+# Copyright 2002-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: toolchain-funcs.eclass
@@ -569,11 +569,12 @@ tc-ld-force-bfd() {
 	fi
 }
 
-# @FUNCTION: tc-has-openmp
+# @FUNCTION: _tc-has-openmp
+# @INTERNAL
 # @USAGE: [toolchain prefix]
 # @DESCRIPTION:
 # See if the toolchain supports OpenMP.
-tc-has-openmp() {
+_tc-has-openmp() {
 	local base="${T}/test-tc-openmp"
 	cat <<-EOF > "${base}.c"
 	#include <omp.h>
@@ -593,6 +594,16 @@ tc-has-openmp() {
 	return ${ret}
 }
 
+# @FUNCTION: tc-has-openmp
+# @DEPRECATED: tc-check-openmp
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# See if the toolchain supports OpenMP.  This function is deprecated and will be
+# removed on 2023-01-01.
+tc-has-openmp() {
+	_tc-has-openmp "$@"
+}
+
 # @FUNCTION: tc-check-openmp
 # @DESCRIPTION:
 # Test for OpenMP support with the current compiler and error out with
@@ -601,7 +612,7 @@ tc-has-openmp() {
 # to test for OpenMP support should be preferred over tc-has-openmp and
 # printing a custom message, as it presents a uniform interface to the user.
 tc-check-openmp() {
-	if ! tc-has-openmp; then
+	if ! _tc-has-openmp; then
 		eerror "Your current compiler does not support OpenMP!"
 
 		if tc-is-gcc; then
-- 
cgit v1.2.3-65-gdbad


From 571dd66bedd32f3f5fdf4a1609e2edfa3b76a0e9 Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Sun, 15 May 2022 19:10:57 +0200
Subject: toolchain-funcs.eclass: document proper tc-check-openmp use

Signed-off-by: David Seifert <soap@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/25498
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/toolchain-funcs.eclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 9ad5e224b03e..54d4b0912a6e 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -611,6 +611,19 @@ tc-has-openmp() {
 # OpenMP support that has been requested by the ebuild. Using this function
 # to test for OpenMP support should be preferred over tc-has-openmp and
 # printing a custom message, as it presents a uniform interface to the user.
+#
+# You should test for any necessary OpenMP support in pkg_pretend in order to
+# warn the user of required toolchain changes.  You must still check for OpenMP
+# support at build-time, e.g.
+# @CODE
+# pkg_pretend() {
+#	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+# }
+#
+# pkg_setup() {
+#	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+# }
+# @CODE
 tc-check-openmp() {
 	if ! _tc-has-openmp; then
 		eerror "Your current compiler does not support OpenMP!"
-- 
cgit v1.2.3-65-gdbad


From 949f1967cfbe394838ddaa39678b908f3e50bccf Mon Sep 17 00:00:00 2001
From: Ulrich Müller <ulm@gentoo.org>
Date: Sun, 15 May 2022 13:19:55 +0000
Subject: user.eclass: Avoid reserved function name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Names that contain "ebuild" are reserved for package manager use.

Closes: https://bugs.gentoo.org/843707
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/user.eclass | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/eclass/user.eclass b/eclass/user.eclass
index aab549d0c473..906e84e83c69 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -31,12 +31,12 @@ _USER_ECLASS=1
 
 inherit user-info
 
-# @FUNCTION: _assert_pkg_ebuild_phase
+# @FUNCTION: _user_assert_pkg_phase
 # @INTERNAL
 # @USAGE: <calling func name>
 # @DESCRIPTION:
 # Raises an alert if the phase is not suitable for user.eclass usage.
-_assert_pkg_ebuild_phase() {
+_user_assert_pkg_phase() {
 	case ${EBUILD_PHASE} in
 	setup|preinst|postinst|prerm|postrm) ;;
 	*)
@@ -89,7 +89,7 @@ enewuser() {
 		ewarn "Insufficient privileges to execute ${FUNCNAME[0]}"
 		return 0
 	fi
-	_assert_pkg_ebuild_phase ${FUNCNAME}
+	_user_assert_pkg_phase ${FUNCNAME}
 
 	local create_home=1 force_uid=
 	while [[ ${1} == -* ]]; do
@@ -262,7 +262,7 @@ enewgroup() {
 		ewarn "Insufficient privileges to execute ${FUNCNAME[0]}"
 		return 0
 	fi
-	_assert_pkg_ebuild_phase ${FUNCNAME}
+	_user_assert_pkg_phase ${FUNCNAME}
 
 	local force_gid=
 	while [[ ${1} == -* ]]; do
@@ -365,7 +365,7 @@ enewgroup() {
 # If the new home directory does not exist, it is created.
 # Any previously existing home directory is NOT moved.
 esethome() {
-	_assert_pkg_ebuild_phase ${FUNCNAME}
+	_user_assert_pkg_phase ${FUNCNAME}
 
 	# get the username
 	local euser=${1}; shift
@@ -451,7 +451,7 @@ esethome() {
 # Required parameters is the username and the new shell.
 # Specify -1 if you want to set shell to platform-specific nologin.
 esetshell() {
-	_assert_pkg_ebuild_phase ${FUNCNAME}
+	_user_assert_pkg_phase ${FUNCNAME}
 
 	# get the username
 	local euser=${1}; shift
@@ -528,7 +528,7 @@ esetshell() {
 # Update the comment field in a platform-agnostic way.
 # Required parameters is the username and the new comment.
 esetcomment() {
-	_assert_pkg_ebuild_phase ${FUNCNAME}
+	_user_assert_pkg_phase ${FUNCNAME}
 
 	# get the username
 	local euser=${1}; shift
@@ -602,7 +602,7 @@ esetcomment() {
 # Required parameters is the username and the new list of groups,
 # primary group first.
 esetgroups() {
-	_assert_pkg_ebuild_phase ${FUNCNAME}
+	_user_assert_pkg_phase ${FUNCNAME}
 
 	[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <user> <groups>"
 
-- 
cgit v1.2.3-65-gdbad