* [gentoo-dev] [PATCH 1/8] eutils.eclass: Specify supported EAPIs.
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 2/8] edos2unix.eclass: New eclass, split off from eutils Ulrich Müller
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Proactively deprecate in future EAPIs, as requested by soap.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/eutils.eclass | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index c2fc05c9dbed..f74074fb4f16 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -4,6 +4,7 @@
# @ECLASS: eutils.eclass
# @MAINTAINER:
# base-system@gentoo.org
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
# @BLURB: many extra (but common) functions that are used in ebuilds
# @DESCRIPTION:
# The eutils eclass contains a suite of functions that complement
@@ -19,10 +20,12 @@ _EUTILS_ECLASS=1
# implicitly inherited (now split) eclasses
case ${EAPI:-0} in
-0|1|2|3|4|5|6)
- inherit desktop epatch estack ltprune multilib preserve-libs \
- toolchain-funcs vcs-clean
- ;;
+ 0|1|2|3|4|5|6)
+ inherit desktop epatch estack ltprune multilib preserve-libs \
+ toolchain-funcs vcs-clean
+ ;;
+ 7) ;;
+ *) die "${ECLASS} is banned in EAPI ${EAPI}" ;;
esac
# @FUNCTION: emktemp
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 2/8] edos2unix.eclass: New eclass, split off from eutils.
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 1/8] eutils.eclass: Specify supported EAPIs Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 3/8] wrapper.eclass: " Ulrich Müller
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/edos2unix.eclass | 21 +++++++++++++++++++++
eclass/eutils.eclass | 18 +++---------------
2 files changed, 24 insertions(+), 15 deletions(-)
create mode 100644 eclass/edos2unix.eclass
diff --git a/eclass/edos2unix.eclass b/eclass/edos2unix.eclass
new file mode 100644
index 000000000000..8b774844cb8a
--- /dev/null
+++ b/eclass/edos2unix.eclass
@@ -0,0 +1,21 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: edos2unix.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: convert files from DOS CRLF to UNIX LF line endings
+
+# @FUNCTION: edos2unix
+# @USAGE: <file> [more files ...]
+# @DESCRIPTION:
+# A handy replacement for dos2unix, recode, fixdos, etc... This allows
+# you to remove all of these text utilities from DEPEND variables
+# because this is a script based solution. Just give it a list of files
+# to convert and they will all be changed from the DOS CRLF format to
+# the UNIX LF format.
+
+edos2unix() {
+ [[ $# -eq 0 ]] && return 0
+ sed -i 's/\r$//' -- "$@" || die
+}
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index f74074fb4f16..3b3e328ba30d 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -21,10 +21,10 @@ _EUTILS_ECLASS=1
# implicitly inherited (now split) eclasses
case ${EAPI:-0} in
0|1|2|3|4|5|6)
- inherit desktop epatch estack ltprune multilib preserve-libs \
- toolchain-funcs vcs-clean
+ inherit desktop edos2unix epatch estack ltprune multilib \
+ preserve-libs toolchain-funcs vcs-clean
;;
- 7) ;;
+ 7) inherit edos2unix ;;
*) die "${ECLASS} is banned in EAPI ${EAPI}" ;;
esac
@@ -63,18 +63,6 @@ emktemp() {
fi
}
-# @FUNCTION: edos2unix
-# @USAGE: <file> [more files ...]
-# @DESCRIPTION:
-# A handy replacement for dos2unix, recode, fixdos, etc... This allows you
-# to remove all of these text utilities from DEPEND variables because this
-# is a script based solution. Just give it a list of files to convert and
-# they will all be changed from the DOS CRLF format to the UNIX LF format.
-edos2unix() {
- [[ $# -eq 0 ]] && return 0
- sed -i 's/\r$//' -- "$@" || die
-}
-
# @FUNCTION: strip-linguas
# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
# @DESCRIPTION:
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 3/8] wrapper.eclass: New eclass, split off from eutils.
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 1/8] eutils.eclass: Specify supported EAPIs Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 2/8] edos2unix.eclass: New eclass, split off from eutils Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 4/8] wrapper.eclass: Do not use emktemp Ulrich Müller
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/eutils.eclass | 51 ++----------------------------------
eclass/wrapper.eclass | 61 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 49 deletions(-)
create mode 100644 eclass/wrapper.eclass
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 3b3e328ba30d..0072f4ccf3e7 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -22,9 +22,9 @@ _EUTILS_ECLASS=1
case ${EAPI:-0} in
0|1|2|3|4|5|6)
inherit desktop edos2unix epatch estack ltprune multilib \
- preserve-libs toolchain-funcs vcs-clean
+ preserve-libs toolchain-funcs vcs-clean wrapper
;;
- 7) inherit edos2unix ;;
+ 7) inherit edos2unix wrapper ;;
*) die "${ECLASS} is banned in EAPI ${EAPI}" ;;
esac
@@ -112,53 +112,6 @@ strip-linguas() {
export LINGUAS=${newls:1}
}
-# @FUNCTION: make_wrapper
-# @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
-# @DESCRIPTION:
-# Create a shell wrapper script named wrapper in installpath
-# (defaults to the bindir) to execute target (default of wrapper) by
-# first optionally setting LD_LIBRARY_PATH to the colon-delimited
-# libpaths followed by optionally changing directory to chdir.
-make_wrapper() {
- local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
- local tmpwrapper=$(emktemp)
- has "${EAPI:-0}" 0 1 2 && local EPREFIX=""
-
- (
- echo '#!/bin/sh'
- if [[ -n ${libdir} ]] ; then
- local var
- if [[ ${CHOST} == *-darwin* ]] ; then
- var=DYLD_LIBRARY_PATH
- else
- var=LD_LIBRARY_PATH
- fi
- cat <<-EOF
- if [ "\${${var}+set}" = "set" ] ; then
- export ${var}="\${${var}}:${EPREFIX}${libdir}"
- else
- export ${var}="${EPREFIX}${libdir}"
- fi
- EOF
- fi
- [[ -n ${chdir} ]] && printf 'cd "%s" &&\n' "${EPREFIX}${chdir}"
- # We don't want to quote ${bin} so that people can pass complex
- # things as ${bin} ... "./someprog --args"
- printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}"
- ) > "${tmpwrapper}"
- chmod go+rx "${tmpwrapper}"
-
- if [[ -n ${path} ]] ; then
- (
- exeopts -m 0755
- exeinto "${path}"
- newexe "${tmpwrapper}" "${wrapper}"
- ) || die
- else
- newbin "${tmpwrapper}" "${wrapper}" || die
- fi
-}
-
path_exists() {
eerror "path_exists has been removed. Please see the following post"
eerror "for a replacement snippet:"
diff --git a/eclass/wrapper.eclass b/eclass/wrapper.eclass
new file mode 100644
index 000000000000..8cde94979d1a
--- /dev/null
+++ b/eclass/wrapper.eclass
@@ -0,0 +1,61 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: wrapper.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: create a shell wrapper script
+
+if [[ -z ${_WRAPPER_ECLASS} ]]; then
+_WRAPPER_ECLASS=1
+
+inherit eutils # for emktemp
+
+# @FUNCTION: make_wrapper
+# @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
+# @DESCRIPTION:
+# Create a shell wrapper script named wrapper in installpath
+# (defaults to the bindir) to execute target (default of wrapper)
+# by first optionally setting LD_LIBRARY_PATH to the colon-delimited
+# libpaths followed by optionally changing directory to chdir.
+make_wrapper() {
+ local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
+ local tmpwrapper=$(emktemp)
+ has "${EAPI:-0}" 0 1 2 && local EPREFIX=""
+
+ (
+ echo '#!/bin/sh'
+ if [[ -n ${libdir} ]] ; then
+ local var
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ var=DYLD_LIBRARY_PATH
+ else
+ var=LD_LIBRARY_PATH
+ fi
+ cat <<-EOF
+ if [ "\${${var}+set}" = "set" ] ; then
+ export ${var}="\${${var}}:${EPREFIX}${libdir}"
+ else
+ export ${var}="${EPREFIX}${libdir}"
+ fi
+ EOF
+ fi
+ [[ -n ${chdir} ]] && printf 'cd "%s" &&\n' "${EPREFIX}${chdir}"
+ # We don't want to quote ${bin} so that people can pass complex
+ # things as ${bin} ... "./someprog --args"
+ printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}"
+ ) > "${tmpwrapper}"
+ chmod go+rx "${tmpwrapper}"
+
+ if [[ -n ${path} ]] ; then
+ (
+ exeopts -m 0755
+ exeinto "${path}"
+ newexe "${tmpwrapper}" "${wrapper}"
+ ) || die
+ else
+ newbin "${tmpwrapper}" "${wrapper}" || die
+ fi
+}
+
+fi
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 4/8] wrapper.eclass: Do not use emktemp.
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
` (2 preceding siblings ...)
2020-09-10 19:08 ` [gentoo-dev] [PATCH 3/8] wrapper.eclass: " Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 5/8] l10n.eclass: Add conditional to prevent multiple inclusion Ulrich Müller
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/wrapper.eclass | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/eclass/wrapper.eclass b/eclass/wrapper.eclass
index 8cde94979d1a..399c7cc269d4 100644
--- a/eclass/wrapper.eclass
+++ b/eclass/wrapper.eclass
@@ -9,8 +9,6 @@
if [[ -z ${_WRAPPER_ECLASS} ]]; then
_WRAPPER_ECLASS=1
-inherit eutils # for emktemp
-
# @FUNCTION: make_wrapper
# @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
# @DESCRIPTION:
@@ -20,7 +18,7 @@ inherit eutils # for emktemp
# libpaths followed by optionally changing directory to chdir.
make_wrapper() {
local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
- local tmpwrapper=$(emktemp)
+ local tmpwrapper="${T}/tmp.wrapper.${wrapper##*/}"
has "${EAPI:-0}" 0 1 2 && local EPREFIX=""
(
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 5/8] l10n.eclass: Add conditional to prevent multiple inclusion.
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
` (3 preceding siblings ...)
2020-09-10 19:08 ` [gentoo-dev] [PATCH 4/8] wrapper.eclass: Do not use emktemp Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 6/8] l10n.eclass: strip-linguas() moved from eutils to here Ulrich Müller
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/l10n.eclass | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index 0b2d287afa7f..73d54ec22334 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: l10n.eclass
@@ -14,6 +14,9 @@
# determining the cross-section between the user's set LINGUAS and what
# is offered by the package.
+if [[ -z ${_L10N_ECLASS} ]]; then
+_L10N_ECLASS=1
+
# @ECLASS-VARIABLE: PLOCALES
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -120,3 +123,5 @@ l10n_get_locales() {
fi
printf "%s" "${locs}"
}
+
+fi
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 6/8] l10n.eclass: strip-linguas() moved from eutils to here.
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
` (4 preceding siblings ...)
2020-09-10 19:08 ` [gentoo-dev] [PATCH 5/8] l10n.eclass: Add conditional to prevent multiple inclusion Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 7/8] eutils.eclass: Deprecate emktemp() Ulrich Müller
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/eutils.eclass | 53 ++------------------------------------------
eclass/l10n.eclass | 47 +++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 51 deletions(-)
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 0072f4ccf3e7..cd59d3f9ccc4 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -21,10 +21,10 @@ _EUTILS_ECLASS=1
# implicitly inherited (now split) eclasses
case ${EAPI:-0} in
0|1|2|3|4|5|6)
- inherit desktop edos2unix epatch estack ltprune multilib \
+ inherit desktop edos2unix epatch estack l10n ltprune multilib \
preserve-libs toolchain-funcs vcs-clean wrapper
;;
- 7) inherit edos2unix wrapper ;;
+ 7) inherit edos2unix l10n wrapper ;;
*) die "${ECLASS} is banned in EAPI ${EAPI}" ;;
esac
@@ -63,55 +63,6 @@ emktemp() {
fi
}
-# @FUNCTION: strip-linguas
-# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
-# @DESCRIPTION:
-# Make sure that LINGUAS only contains languages that
-# a package can support. The first form allows you to
-# specify a list of LINGUAS. The -i builds a list of po
-# files found in all the directories and uses the
-# intersection of the lists. The -u builds a list of po
-# files found in all the directories and uses the union
-# of the lists.
-strip-linguas() {
- local ls newls nols
- if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
- local op=$1; shift
- ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
- local d f
- for d in "$@" ; do
- if [[ ${op} == "-u" ]] ; then
- newls=${ls}
- else
- newls=""
- fi
- for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
- if [[ ${op} == "-i" ]] ; then
- has ${f} ${ls} && newls="${newls} ${f}"
- else
- has ${f} ${ls} || newls="${newls} ${f}"
- fi
- done
- ls=${newls}
- done
- else
- ls="$@"
- fi
-
- nols=""
- newls=""
- for f in ${LINGUAS} ; do
- if has ${f} ${ls} ; then
- newls="${newls} ${f}"
- else
- nols="${nols} ${f}"
- fi
- done
- [[ -n ${nols} ]] \
- && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
- export LINGUAS=${newls:1}
-}
-
path_exists() {
eerror "path_exists has been removed. Please see the following post"
eerror "for a replacement snippet:"
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index 73d54ec22334..7bd8f382fbe3 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -124,4 +124,51 @@ l10n_get_locales() {
printf "%s" "${locs}"
}
+# @FUNCTION: strip-linguas
+# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
+# @DESCRIPTION:
+# Make sure that LINGUAS only contains languages that a package can
+# support. The first form allows you to specify a list of LINGUAS.
+# The -i builds a list of po files found in all the directories and uses
+# the intersection of the lists. The -u builds a list of po files found
+# in all the directories and uses the union of the lists.
+strip-linguas() {
+ local ls newls nols
+ if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
+ local op=$1; shift
+ ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
+ local d f
+ for d in "$@" ; do
+ if [[ ${op} == "-u" ]] ; then
+ newls=${ls}
+ else
+ newls=""
+ fi
+ for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
+ if [[ ${op} == "-i" ]] ; then
+ has ${f} ${ls} && newls="${newls} ${f}"
+ else
+ has ${f} ${ls} || newls="${newls} ${f}"
+ fi
+ done
+ ls=${newls}
+ done
+ else
+ ls="$@"
+ fi
+
+ nols=""
+ newls=""
+ for f in ${LINGUAS} ; do
+ if has ${f} ${ls} ; then
+ newls="${newls} ${f}"
+ else
+ nols="${nols} ${f}"
+ fi
+ done
+ [[ -n ${nols} ]] \
+ && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
+ export LINGUAS=${newls:1}
+}
+
fi
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 7/8] eutils.eclass: Deprecate emktemp().
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
` (5 preceding siblings ...)
2020-09-10 19:08 ` [gentoo-dev] [PATCH 6/8] l10n.eclass: strip-linguas() moved from eutils to here Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-10 19:08 ` [gentoo-dev] [PATCH 8/8] eutils.eclass: Deprecate use_if_iuse() Ulrich Müller
2020-09-12 16:22 ` [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Mueller
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/eutils.eclass | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index cd59d3f9ccc4..0a99d00ee01a 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -31,9 +31,11 @@ esac
# @FUNCTION: emktemp
# @USAGE: [temp dir]
# @DESCRIPTION:
-# Cheap replacement for when debianutils (and thus mktemp)
-# does not exist on the users system.
+# Cheap replacement for when coreutils (and thus mktemp) does not exist
+# on the user's system.
emktemp() {
+ eqawarn "emktemp is deprecated. Create a temporary file in \${T} instead."
+
local exe="touch"
[[ $1 == -d ]] && exe="mkdir" && shift
local topdir=$1
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 8/8] eutils.eclass: Deprecate use_if_iuse().
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
` (6 preceding siblings ...)
2020-09-10 19:08 ` [gentoo-dev] [PATCH 7/8] eutils.eclass: Deprecate emktemp() Ulrich Müller
@ 2020-09-10 19:08 ` Ulrich Müller
2020-09-12 16:22 ` [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Mueller
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Müller @ 2020-09-10 19:08 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
The function is not called from any ebuilds in the gentoo repository.
Inline it as "in_iuse foo && use foo" in other eclasses, or define it
as a local function when it is called multiple times.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/chromium-2.eclass | 4 +--
eclass/eutils.eclass | 3 ++
eclass/gnome2.eclass | 2 +-
eclass/mate.eclass | 4 +--
eclass/toolchain.eclass | 77 ++++++++++++++++++++++------------------
5 files changed, 51 insertions(+), 39 deletions(-)
diff --git a/eclass/chromium-2.eclass b/eclass/chromium-2.eclass
index c9cfe5acebee..b3d63f302d05 100644
--- a/eclass/chromium-2.eclass
+++ b/eclass/chromium-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: chromium-2.eclass
@@ -126,7 +126,7 @@ chromium_pkg_die() {
fi
# No ricer bugs.
- if use_if_iuse custom-cflags; then
+ if in_iuse custom-cflags && use custom-cflags; then
ewarn
ewarn "You have enabled the custom-cflags USE flag."
ewarn "Please disable it before reporting a bug."
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 0a99d00ee01a..ba6bf8178673 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -79,6 +79,9 @@ path_exists() {
#
# Note that this function should not be used in the global scope.
use_if_iuse() {
+ eqawarn "use_if_iuse is deprecated."
+ eqawarn "Define it as a local function, or inline it:"
+ eqawarn " in_iuse foo && use foo"
in_iuse $1 || return 1
use $1
}
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
index a16fc916c6d2..1a4ff451df32 100644
--- a/eclass/gnome2.eclass
+++ b/eclass/gnome2.eclass
@@ -296,7 +296,7 @@ gnome2_src_install() {
if has ${EAPI:-0} 4; then
if [[ "${GNOME2_LA_PUNT}" != "no" ]]; then
ebegin "Removing .la files"
- if ! use_if_iuse static-libs ; then
+ if ! in_iuse static-libs || ! use static-libs ; then
find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed"
fi
eend
diff --git a/eclass/mate.eclass b/eclass/mate.eclass
index d7dd2dbceec0..34d5e47acc22 100644
--- a/eclass/mate.eclass
+++ b/eclass/mate.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: mate.eclass
@@ -120,7 +120,7 @@ mate_src_configure() {
local mateconf=()
# Pass --disable-static whenever possible
- if ! use_if_iuse static-libs; then
+ if ! in_iuse static-libs || ! use static-libs; then
if grep -q "enable-static" "${ECONF_SOURCE:-.}"/configure; then
mateconf+=( --disable-static )
fi
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 6fb3eb941a2c..32996a2f8f71 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -398,10 +398,13 @@ SRC_URI=$(get_gcc_src_uri)
#---->> pkg_pretend <<----
toolchain_pkg_pretend() {
- if ! use_if_iuse cxx ; then
- use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
- use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
- use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
+ if ! _tc_use_if_iuse cxx ; then
+ _tc_use_if_iuse go && \
+ ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
+ _tc_use_if_iuse objc++ && \
+ ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
+ _tc_use_if_iuse gcj && \
+ ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
fi
want_minispecs
@@ -461,7 +464,8 @@ toolchain_src_prepare() {
*) die "Update toolchain_src_prepare() for ${EAPI}." ;;
esac
- if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
+ if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \
+ && ! use vanilla ; then
make_gcc_hard
fi
@@ -481,7 +485,7 @@ toolchain_src_prepare() {
fi
# >= gcc-4.3 doesn't bundle ecj.jar, so copy it
- if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then
+ if tc_version_is_at_least 4.3 && _tc_use_if_iuse gcj ; then
if tc_version_is_at_least 4.5 ; then
einfo "Copying ecj-4.5.jar"
cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
@@ -578,13 +582,13 @@ make_gcc_hard() {
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
if tc_version_is_at_least 6.0 ; then
- if use_if_iuse pie ; then
+ if _tc_use_if_iuse pie ; then
einfo "Updating gcc to use automatic PIE building ..."
fi
- if use_if_iuse ssp ; then
+ if _tc_use_if_iuse ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
fi
- if use_if_iuse hardened ; then
+ if _tc_use_if_iuse hardened ; then
# Will add some hardened options as default, like:
# -fstack-clash-protection
# -z now
@@ -594,7 +598,7 @@ make_gcc_hard() {
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
else
- if use_if_iuse hardened ; then
+ if _tc_use_if_iuse hardened ; then
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
if hardened_gcc_works ; then
@@ -830,12 +834,12 @@ toolchain_src_configure() {
fi
# Build compiler itself using LTO
- if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
+ if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
confgcc+=( --with-build-config=bootstrap-lto )
fi
# Support to disable pch when building libstdcxx
- if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
+ if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then
confgcc+=( --disable-libstdcxx-pch )
fi
@@ -1124,13 +1128,13 @@ toolchain_src_configure() {
fi
if tc_version_is_at_least 4.0 ; then
- if use_if_iuse libssp ; then
+ if _tc_use_if_iuse libssp ; then
confgcc+=( --enable-libssp )
else
if hardened_gcc_is_stable ssp; then
export gcc_cv_libc_provides_ssp=yes
fi
- if use_if_iuse ssp; then
+ if _tc_use_if_iuse ssp; then
# On some targets USE="ssp -libssp" is an invalid
# configuration as target libc does not provide
# stack_chk_* functions. Do not disable libssp there.
@@ -1569,7 +1573,7 @@ gcc_do_make() {
# resulting binaries natively ^^;
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
else
- if tc_version_is_at_least 3.3 && use_if_iuse pgo; then
+ if tc_version_is_at_least 3.3 && _tc_use_if_iuse pgo; then
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
else
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
@@ -1623,7 +1627,7 @@ gcc_do_make() {
emake -C gcc gnattools
fi
- if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then
+ if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then
if type -p doxygen > /dev/null ; then
if tc_version_is_at_least 4.3 ; then
cd "${CTARGET}"/libstdc++-v3/doc
@@ -2220,44 +2224,48 @@ gcc-lang-supported() {
has $1 ${TOOLCHAIN_ALLOWED_LANGS}
}
+_tc_use_if_iuse() {
+ in_iuse $1 && use $1
+}
+
is_ada() {
gcc-lang-supported ada || return 1
- use_if_iuse ada
+ _tc_use_if_iuse ada
}
is_cxx() {
gcc-lang-supported 'c++' || return 1
- use_if_iuse cxx
+ _tc_use_if_iuse cxx
}
is_d() {
gcc-lang-supported d || return 1
- use_if_iuse d
+ _tc_use_if_iuse d
}
is_f77() {
gcc-lang-supported f77 || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_f95() {
gcc-lang-supported f95 || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_fortran() {
gcc-lang-supported fortran || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_gcj() {
gcc-lang-supported java || return 1
- use_if_iuse cxx && use_if_iuse gcj
+ _tc_use_if_iuse cxx && _tc_use_if_iuse gcj
}
is_go() {
gcc-lang-supported go || return 1
- use_if_iuse cxx && use_if_iuse go
+ _tc_use_if_iuse cxx && _tc_use_if_iuse go
}
is_jit() {
@@ -2266,22 +2274,22 @@ is_jit() {
# to generate code for a target. On target like avr
# libgcclit.so can't link at all: bug #594572
is_crosscompile && return 1
- use_if_iuse jit
+ _tc_use_if_iuse jit
}
is_multilib() {
tc_version_is_at_least 3 || return 1
- use_if_iuse multilib
+ _tc_use_if_iuse multilib
}
is_objc() {
gcc-lang-supported objc || return 1
- use_if_iuse objc
+ _tc_use_if_iuse objc
}
is_objcxx() {
gcc-lang-supported 'obj-c++' || return 1
- use_if_iuse cxx && use_if_iuse objc++
+ _tc_use_if_iuse cxx && _tc_use_if_iuse objc++
}
# Grab a variable from the build system (taken from linux-info.eclass)
@@ -2306,12 +2314,12 @@ hardened_gcc_works() {
[[ ${CTARGET} == *-freebsd* ]] && return 1
want_pie || return 1
- use_if_iuse nopie && return 1
+ _tc_use_if_iuse nopie && return 1
hardened_gcc_is_stable pie
return $?
elif [[ $1 == "ssp" ]] ; then
[[ -n ${SPECS_VER} ]] || return 1
- use_if_iuse nossp && return 1
+ _tc_use_if_iuse nossp && return 1
hardened_gcc_is_stable ssp
return $?
else
@@ -2349,12 +2357,12 @@ want_minispecs() {
if tc_version_is_at_least 6.0 ; then
return 0
fi
- if tc_version_is_at_least 4.3.2 && use_if_iuse hardened ; then
+ if tc_version_is_at_least 4.3.2 && _tc_use_if_iuse hardened ; then
if ! want_pie ; then
ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."
elif use vanilla ; then
ewarn "You will not get hardened features if you have the vanilla USE-flag."
- elif use_if_iuse nopie && use_if_iuse nossp ; then
+ elif _tc_use_if_iuse nopie && _tc_use_if_iuse nossp ; then
ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
elif ! hardened_gcc_works ; then
ewarn "Your $(tc-arch) arch is not supported."
@@ -2368,11 +2376,12 @@ want_minispecs() {
}
want_pie() {
- ! use_if_iuse hardened && [[ -n ${PIE_VER} ]] && use_if_iuse nopie && return 1
+ ! _tc_use_if_iuse hardened && [[ -n ${PIE_VER} ]] \
+ && _tc_use_if_iuse nopie && return 1
[[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
tc_version_is_at_least 4.3.2 && return 1
[[ -z ${PIE_VER} ]] && return 1
- use_if_iuse nopie || return 0
+ _tc_use_if_iuse nopie || return 0
return 1
}
--
2.28.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass
2020-09-10 19:08 [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass Ulrich Müller
` (7 preceding siblings ...)
2020-09-10 19:08 ` [gentoo-dev] [PATCH 8/8] eutils.eclass: Deprecate use_if_iuse() Ulrich Müller
@ 2020-09-12 16:22 ` Ulrich Mueller
8 siblings, 0 replies; 10+ messages in thread
From: Ulrich Mueller @ 2020-09-12 16:22 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 912 bytes --]
>>>>> On Thu, 10 Sep 2020, Ulrich Müller wrote:
> Ulrich Müller (8):
> eutils.eclass: Specify supported EAPIs.
> edos2unix.eclass: New eclass, split off from eutils.
> wrapper.eclass: New eclass, split off from eutils.
> wrapper.eclass: Do not use emktemp.
> l10n.eclass: Add conditional to prevent multiple inclusion.
> l10n.eclass: strip-linguas() moved from eutils to here.
> eutils.eclass: Deprecate emktemp().
> eutils.eclass: Deprecate use_if_iuse().
Pushed to master, plus a deprecation warning in eutils.eclass.
There is no urgent action required, but please update your ebuilds if
they inherit eutils (especially in EAPI 7).
*** ATTENTION OVERLAY MAINTAINERS!!!11!!eleven!
eutils.eclass will eventually be removed, even though this will take
several years. So, start updating your ebuilds _now_ and don't complain
later. You have been warned.
:-)
Ulrich
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread