Improve the name-version regex
[gentoo.git] / eclass / eutils.eclass
index 9b4767e1874af58b390bf2df1e77fcbb786c3a80..20dec774f2f5d995c2332243ffada52375238c38 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: eutils.eclass
@@ -25,19 +25,6 @@ case ${EAPI:-0} in
        ;;
 esac
 
-# @FUNCTION: eqawarn
-# @USAGE: [message]
-# @DESCRIPTION:
-# Proxy to ewarn for package managers that don't provide eqawarn and use the PM
-# implementation if available. Reuses PORTAGE_ELOG_CLASSES as set by the dev
-# profile.
-if ! declare -F eqawarn >/dev/null ; then
-       eqawarn() {
-               has qa ${PORTAGE_ELOG_CLASSES} && ewarn "$@"
-               :
-       }
-fi
-
 # @FUNCTION: emktemp
 # @USAGE: [temp dir]
 # @DESCRIPTION:
@@ -181,33 +168,11 @@ make_wrapper() {
        fi
 }
 
-# @FUNCTION: path_exists
-# @USAGE: [-a|-o] <paths>
-# @DESCRIPTION:
-# Check if the specified paths exist.  Works for all types of paths
-# (files/dirs/etc...).  The -a and -o flags control the requirements
-# of the paths.  They correspond to "and" and "or" logic.  So the -a
-# flag means all the paths must exist while the -o flag means at least
-# one of the paths must exist.  The default behavior is "and".  If no
-# paths are specified, then the return value is "false".
 path_exists() {
-       local opt=$1
-       [[ ${opt} == -[ao] ]] && shift || opt="-a"
-
-       # no paths -> return false
-       # same behavior as: [[ -e "" ]]
-       [[ $# -eq 0 ]] && return 1
-
-       local p r=0
-       for p in "$@" ; do
-               [[ -e ${p} ]]
-               : $(( r += $? ))
-       done
-
-       case ${opt} in
-               -a) return $(( r != 0 )) ;;
-               -o) return $(( r == $# )) ;;
-       esac
+       eerror "path_exists has been removed.  Please see the following post"
+       eerror "for a replacement snippet:"
+       eerror "https://blogs.gentoo.org/mgorny/2018/08/09/inlining-path_exists/"
+       die "path_exists is banned"
 }
 
 # @FUNCTION: use_if_iuse
@@ -266,53 +231,6 @@ optfeature() {
        fi
 }
 
-case ${EAPI:-0} in
-0|1|2)
-
-# @FUNCTION: epause
-# @USAGE: [seconds]
-# @DESCRIPTION:
-# Sleep for the specified number of seconds (default of 5 seconds).  Useful when
-# printing a message the user should probably be reading and often used in
-# conjunction with the ebeep function.  If the EPAUSE_IGNORE env var is set,
-# don't wait at all. Defined in EAPIs 0 1 and 2.
-epause() {
-       [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5}
-}
-
-# @FUNCTION: ebeep
-# @USAGE: [number of beeps]
-# @DESCRIPTION:
-# Issue the specified number of beeps (default of 5 beeps).  Useful when
-# printing a message the user should probably be reading and often used in
-# conjunction with the epause function.  If the EBEEP_IGNORE env var is set,
-# don't beep at all. Defined in EAPIs 0 1 and 2.
-ebeep() {
-       local n
-       if [[ -z ${EBEEP_IGNORE} ]] ; then
-               for ((n=1 ; n <= ${1:-5} ; n++)) ; do
-                       echo -ne "\a"
-                       sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null
-                       echo -ne "\a"
-                       sleep 1
-               done
-       fi
-}
-
-;;
-*)
-
-ebeep() {
-       ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
-}
-
-epause() {
-       ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
-}
-
-;;
-esac
-
 case ${EAPI:-0} in
 0|1|2|3|4)
 
@@ -415,4 +333,23 @@ in_iuse() {
 ;;
 esac
 
+case ${EAPI:-0} in
+0|1|2|3|4|5|6)
+
+# @FUNCTION: eqawarn
+# @USAGE: [message]
+# @DESCRIPTION:
+# Proxy to ewarn for package managers that don't provide eqawarn and use the PM
+# implementation if available. Reuses PORTAGE_ELOG_CLASSES as set by the dev
+# profile.
+if ! declare -F eqawarn >/dev/null ; then
+       eqawarn() {
+               has qa ${PORTAGE_ELOG_CLASSES} && ewarn "$@"
+               :
+       }
+fi
+
+;;
+esac
+
 fi