eclass/epatch: Sync with gentoo

It's from gentoo commit 7a9020ea8b355ffdb03d4f9f7d7328b1e985f25b.
This commit is contained in:
Krzesimir Nowak 2021-12-21 09:55:15 +01:00
parent 5d1d909aee
commit 27432830c2

View File

@ -1,4 +1,4 @@
# Copyright 1999-2018 Gentoo Foundation # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# @ECLASS: epatch.eclass # @ECLASS: epatch.eclass
@ -6,6 +6,7 @@
# base-system@gentoo.org # base-system@gentoo.org
# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 # @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
# @BLURB: easy patch application functions # @BLURB: easy patch application functions
# @DEPRECATED: eapply from EAPI 7
# @DESCRIPTION: # @DESCRIPTION:
# An eclass providing epatch and epatch_user functions to easily apply # An eclass providing epatch and epatch_user functions to easily apply
# patches to ebuilds. Mostly superseded by eapply* in EAPI 6. # patches to ebuilds. Mostly superseded by eapply* in EAPI 6.
@ -19,6 +20,8 @@ case ${EAPI:-0} in
die "${ECLASS}: banned in EAPI=${EAPI}; use eapply* instead";; die "${ECLASS}: banned in EAPI=${EAPI}; use eapply* instead";;
esac esac
inherit estack
# @VARIABLE: EPATCH_SOURCE # @VARIABLE: EPATCH_SOURCE
# @DESCRIPTION: # @DESCRIPTION:
# Default directory to search for patches. # Default directory to search for patches.
@ -209,14 +212,13 @@ epatch() {
# Let people filter things dynamically # Let people filter things dynamically
if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]] ; then if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]] ; then
# let people use globs in the exclude # let people use globs in the exclude
local prev_noglob=$(shopt -p -o noglob) eshopts_push -o noglob
set -o noglob
local ex local ex
for ex in ${EPATCH_EXCLUDE} ; do for ex in ${EPATCH_EXCLUDE} ; do
if [[ ${patchname} == ${ex} ]] ; then if [[ ${patchname} == ${ex} ]] ; then
einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ..." einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ..."
${prev_noglob} eshopts_pop
continue 2 continue 2
fi fi
done done
@ -224,12 +226,12 @@ epatch() {
for ex in ${EPATCH_USER_EXCLUDE} ; do for ex in ${EPATCH_USER_EXCLUDE} ; do
if [[ ${patchname} == ${ex} ]] ; then if [[ ${patchname} == ${ex} ]] ; then
einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ..." einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ..."
${prev_noglob} eshopts_pop
continue 2 continue 2
fi fi
done done
${prev_noglob} eshopts_pop
fi fi
if [[ ${SINGLE_PATCH} == "yes" ]] ; then if [[ ${SINGLE_PATCH} == "yes" ]] ; then
@ -357,14 +359,14 @@ epatch() {
if [[ ${count} -ge 5 ]] ; then if [[ ${count} -ge 5 ]] ; then
echo echo
eerror "Failed Patch: ${patchname} !" eerror "Failed patch: ${patchname}!"
eerror " ( ${PATCH_TARGET} )" eerror " ( ${PATCH_TARGET} )"
eerror eerror
eerror "Include in your bug report the contents of:" eerror "Include in your bug report the contents of:"
eerror eerror
eerror " ${STDERR_TARGET}" eerror " ${STDERR_TARGET}"
echo echo
die "Failed Patch: ${patchname}!" die "Failed patch: ${patchname}!"
fi fi
# if everything worked, delete the full debug patch log # if everything worked, delete the full debug patch log
@ -387,7 +389,8 @@ epatch() {
case ${EAPI:-0} in case ${EAPI:-0} in
0|1|2|3|4|5) 0|1|2|3|4|5)
# @VARIABLE: EPATCH_USER_SOURCE # @ECLASS_VARIABLE: EPATCH_USER_SOURCE
# @USER_VARIABLE
# @DESCRIPTION: # @DESCRIPTION:
# Location for user patches, see the epatch_user function. # Location for user patches, see the epatch_user function.
# Should be set by the user. Don't set this in ebuilds. # Should be set by the user. Don't set this in ebuilds.