summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-07-03 22:39:47 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-07-03 22:39:47 +0100
commit7f0ccc917c7abe6223784c703d86cd14755691fb (patch)
tree8c6793f68896b341e22f33d7e6cef88e481f4a8b /eclass
parent9aa80713372911cec499b3adb2cd746790920916 (diff)
gentoo resync : 03.07.2021
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin36158 -> 36321 bytes
-rw-r--r--eclass/cargo.eclass78
-rw-r--r--eclass/docs.eclass8
-rw-r--r--eclass/findlib.eclass1
-rw-r--r--eclass/gnome.org.eclass8
-rw-r--r--eclass/java-utils-2.eclass26
-rw-r--r--eclass/kernel-2.eclass3
-rw-r--r--eclass/l10n.eclass1
-rw-r--r--eclass/mate-desktop.org.eclass8
-rw-r--r--eclass/mate.eclass10
-rw-r--r--eclass/meson-multilib.eclass12
-rw-r--r--eclass/multilib-build.eclass21
-rw-r--r--eclass/multilib-minimal.eclass11
-rw-r--r--eclass/plocale.eclass169
-rw-r--r--eclass/python-utils-r1.eclass3
-rw-r--r--eclass/systemd.eclass109
-rw-r--r--eclass/toolchain-glibc.eclass8
-rw-r--r--eclass/udev.eclass25
-rw-r--r--eclass/verify-sig.eclass16
-rw-r--r--eclass/xdg-utils.eclass38
20 files changed, 355 insertions, 200 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index ef455c6a1fbc..c33ab57758d5 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 15b9d455bdef..938511e410fc 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -7,20 +7,38 @@
# @AUTHOR:
# Doug Goldstein <cardoe@gentoo.org>
# Georgy Yakovlev <gyakovlev@genotoo.org>
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: common functions and variables for cargo builds
if [[ -z ${_CARGO_ECLASS} ]]; then
_CARGO_ECLASS=1
-# we need this for 'cargo vendor' subcommand and net.offline config knob
-RUST_DEPEND=">=virtual/rust-1.37.0"
+# check and document RUST_DEPEND and options we need below in case conditions.
+# https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md
+RUST_DEPEND="virtual/rust"
case "${EAPI:-0}" in
0|1|2|3|4|5|6)
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
;;
7)
+ # 1.37 added 'cargo vendor' subcommand and net.offline config knob
+ RUST_DEPEND=">=virtual/rust-1.37.0"
+ ;;
+
+ 8)
+ # 1.39 added --workspace
+ # 1.46 added --target dir
+ # 1.48 added term.progress config option
+ # 1.51 added split-debuginfo profile option
+ # 1.52 may need setting RUSTC_BOOTSTRAP envvar for some crates
+ # 1.53 added cargo update --offline, can be used to update vulnerable crates from pre-fetched registry without editing toml
+ RUST_DEPEND=">=virtual/rust-1.53"
+
+ if [[ -z ${CRATES} && "${PV}" != *9999* ]]; then
+ eerror "undefined CRATES variable in non-live EAPI=8 ebuild"
+ die "CRATES variable not defined"
+ fi
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
@@ -39,6 +57,24 @@ IUSE="${IUSE} debug"
ECARGO_HOME="${WORKDIR}/cargo_home"
ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
+# @ECLASS-VARIABLE: CRATES
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# bash string containing all crates package wants to download
+# used by cargo_crate_uris()
+# Example:
+# @CODE
+# CRATES="
+# metal-1.2.3
+# bar-4.5.6
+# iron_oxide-0.0.1
+# "
+# inherit cargo
+# ...
+# SRC_URI="$(cargo_crate_uris)"
+# @CODE
+
# @ECLASS-VARIABLE: CARGO_OPTIONAL
# @DEFAULT_UNSET
# @PRE_INHERIT
@@ -101,10 +137,22 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# @FUNCTION: cargo_crate_uris
# @DESCRIPTION:
# Generates the URIs to put in SRC_URI to help fetch dependencies.
+# Uses first argument as crate list.
+# If no argument provided, uses CRATES variable.
cargo_crate_uris() {
local -r regex='^([a-zA-Z0-9_\-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$'
- local crate
- for crate in "$@"; do
+ local crate crates
+
+ if [[ -n ${@} ]]; then
+ crates="$@"
+ elif [[ -n ${CRATES} ]]; then
+ crates="${CRATES}"
+ else
+ eerror "CRATES variable is not defined and nothing passed as argument"
+ die "Can't generate SRC_URI from empty input"
+ fi
+
+ for crate in ${crates}; do
local name version url
[[ $crate =~ $regex ]] || die "Could not parse name and version from crate: $crate"
name="${BASH_REMATCH[1]}"
@@ -184,15 +232,6 @@ cargo_src_unpack() {
fi
eend $?
;;
- cargo-snapshot*)
- ebegin "Unpacking ${archive}"
- mkdir -p "${S}"/target/snapshot
- tar -xzf "${DISTDIR}"/${archive} -C "${S}"/target/snapshot --strip-components 2 || die
- # cargo's makefile needs this otherwise it will try to
- # download it
- touch "${S}"/target/snapshot/bin/cargo || die
- eend $?
- ;;
*)
unpack ${archive}
;;
@@ -376,7 +415,16 @@ cargo_src_install() {
rm -f "${ED}/usr/.crates.toml" || die
rm -f "${ED}/usr/.crates2.json" || die
- [ -d "${S}/man" ] && doman "${S}/man" || return 0
+ # it turned out to be non-standard dir, so get rid of it future EAPI
+ # and only run for EAPI=7
+ # https://bugs.gentoo.org/715890
+ case ${EAPI:-0} in
+ 7)
+ if [ -d "${S}/man" ]; then
+ doman "${S}/man" || return 0
+ fi
+ ;;
+ esac
}
# @FUNCTION: cargo_src_test
diff --git a/eclass/docs.eclass b/eclass/docs.eclass
index 7ee7a11ca5e4..684ab26919ce 100644
--- a/eclass/docs.eclass
+++ b/eclass/docs.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
# Based on the work of: Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: A simple eclass to build documentation.
# @DESCRIPTION:
# A simple eclass providing basic functions and variables to build
@@ -50,7 +50,7 @@
# DOCS_DEPEND="dev-python/mkdocs-material"
# DOCS_DIR="doc"
#
-# PYTHON_COMPAT=( python3_{7,8,9} )
+# PYTHON_COMPAT=( python3_{8..10} )
#
# inherit distutils-r1 docs
#
@@ -61,7 +61,7 @@ case "${EAPI:-0}" in
0|1|2|3|4|5)
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
;;
- 6|7)
+ 6|7|8)
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
@@ -378,7 +378,7 @@ case ${DOCS_BUILDER} in
;;
esac
-if [[ ${EAPI} == [7] ]]; then
+if [[ ${EAPI} != 6 ]]; then
BDEPEND+=" doc? ( ${DOCS_DEPEND} )"
else
DEPEND+=" doc? ( ${DOCS_DEPEND} )"
diff --git a/eclass/findlib.eclass b/eclass/findlib.eclass
index e8b6e73c97af..3b19b30c57c9 100644
--- a/eclass/findlib.eclass
+++ b/eclass/findlib.eclass
@@ -29,6 +29,7 @@ IUSE="ocamlopt"
DEPEND=">=dev-ml/findlib-1.0.4-r1"
[[ ${FINDLIB_USE} ]] && DEPEND="${FINDLIB_USE}? ( ${DEPEND} )"
RDEPEND="dev-lang/ocaml:=[ocamlopt?]"
+[[ ${FINDLIB_USE} ]] && RDEPEND="${FINDLIB_USE}? ( ${RDEPEND} )"
check_ocamlfind() {
if [ ! -x "${EPREFIX}"/usr/bin/ocamlfind ] ; then
diff --git a/eclass/gnome.org.eclass b/eclass/gnome.org.eclass
index dba26155d740..7efd03bfa946 100644
--- a/eclass/gnome.org.eclass
+++ b/eclass/gnome.org.eclass
@@ -7,13 +7,13 @@
# @AUTHOR:
# Authors: Spidler <spidler@gentoo.org> with help of carparski.
# eclass variable additions and documentation: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: Helper eclass for gnome.org hosted archives
# @DESCRIPTION:
# Provide a default SRC_URI for tarball hosted on gnome.org mirrors.
-case ${EAPI:-0} in
- [567]) ;;
+case ${EAPI} in
+ 5|6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -31,7 +31,7 @@ _GNOME_ORG_ECLASS=1
# moving to only have xz tarballs for new releases.
: ${GNOME_TARBALL_SUFFIX:="xz"}
-# Even though xz-utils are in @system, they must still be added to DEPEND; see
+# Even though xz-utils are in @system, they must still be added to BDEPEND; see
# https://archives.gentoo.org/gentoo-dev/msg_a0d4833eb314d1be5d5802a3b710e0a4.xml
if [[ ${GNOME_TARBALL_SUFFIX} == "xz" ]]; then
if [[ ${EAPI} != [56] ]]; then
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 3368e6977f60..ed4951ac97b7 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -118,13 +118,29 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# Normally this is determined from the jre/jdk version specified in RDEPEND.
# See java-pkg_get-target function below.
#
-# Should generallyonly be used for testing and debugging.
+# Should generally only be used for testing and debugging.
#
# emerge bar to be compatible with 1.3
# @CODE
# JAVA_PKG_WANT_TARGET=1.3 emerge bar
# @CODE
+# @ECLASS-VARIABLE: JAVA_TEST_EXTRA_ARGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of extra arguments that should be passed to java command when running tests.
+# It is useful when you need to pass a value to a Java program that uses
+# System.getProperty(). If it uses System.getenv(), use `export var=value` instead.
+#
+# It is used only when running tests.
+#
+# @CODE
+# JAVA_TEST_EXTRA_ARGS=(
+# -Dsome.var=x
+# "-Dother.var=\"y z\""
+# )
+# @CODE
+
# @ECLASS-VARIABLE: JAVA_PKG_DEBUG
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -1797,8 +1813,8 @@ ejunit_() {
if [[ "${junit}" == "junit-4" ]] ; then
runner=org.junit.runner.JUnitCore
fi
- debug-print "Calling: java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${runner} ${@}"
- java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
+ debug-print "Calling: java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} ${@}"
+ java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} "${@}" || die "Running junit failed"
}
# @FUNCTION: ejunit
@@ -1877,9 +1893,9 @@ etestng() {
done
debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
- "-Djava.awt.headless=true ${runner}"\
+ "-Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner}"\
"-usedefaultlisteners false -testclass ${tests}"
- java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true\
+ java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]}\
${runner} -usedefaultlisteners false -testclass ${tests}\
|| die "Running TestNG failed."
}
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 1210940b1fc3..831dd5b5dd40 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1175,7 +1175,8 @@ unipatch() {
( kernel_is eq 5 4 && kernel_is gt 5 4 115 ) ||
( kernel_is eq 5 10 && kernel_is gt 5 10 33 ) ||
( kernel_is eq 5 11 && kernel_is gt 5 11 17 ) ||
- ( kernel_is eq 5 12 && kernel_is gt 5 12 0 ); then
+ ( kernel_is eq 5 12 && kernel_is gt 5 12 0 ) ||
+ ( kernel_is ge 5 13); then
UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index b1dff96ded12..f53cb3d0898b 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -8,6 +8,7 @@
# Ben de Groot <yngwin@gentoo.org>
# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: convenience functions to handle localizations
+# @DEPRECATED: plocale.eclass
# @DESCRIPTION:
# The l10n (localization) eclass offers a number of functions to more
# conveniently handle localizations (translations) offered by packages.
diff --git a/eclass/mate-desktop.org.eclass b/eclass/mate-desktop.org.eclass
index 849479d048f0..92f1d1d33d0f 100644
--- a/eclass/mate-desktop.org.eclass
+++ b/eclass/mate-desktop.org.eclass
@@ -6,7 +6,7 @@
# mate@gentoo.org
# @AUTHOR:
# Authors: NP-Hardass <NP-Hardass@gentoo.org> based upon the gnome.org eclass.
-# @SUPPORTED_EAPIS: 6
+# @SUPPORTED_EAPIS: 6 7
# @BLURB: Helper eclass for mate-desktop.org hosted archives
# @DESCRIPTION:
# Provide a default SRC_URI and EGIT_REPO_URI for MATE packages as well as
@@ -14,7 +14,7 @@
# EAPIs < 6 are banned.
case "${EAPI:-0}" in
- 6) ;;
+ 6|7) ;;
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
@@ -22,7 +22,7 @@ if [[ ${PV} == 9999 ]]; then
inherit git-r3
fi
-inherit versionator
+[[ ${EAPI:-0} -eq 6 ]] && inherit eapi7-ver
# @ECLASS-VARIABLE: MATE_TARBALL_SUFFIX
# @INTERNAL
@@ -47,7 +47,7 @@ inherit versionator
# @DESCRIPTION:
# Major and minor numbers of the version number, unless live.
# If live ebuild, will be set to '9999'.
-: ${MATE_BRANCH:=$(get_version_component_range 1-2)}
+: ${MATE_BRANCH:=$(ver_cut 1-2)}
# Set SRC_URI or EGIT_REPO_URI based on whether live
if [[ ${PV} == 9999 ]]; then
diff --git a/eclass/mate.eclass b/eclass/mate.eclass
index 34d5e47acc22..a3b4cfd0b602 100644
--- a/eclass/mate.eclass
+++ b/eclass/mate.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Authors: NP-Hardass <NP-Hardass@gentoo.org> based upon the gnome2
# and autotools-utils eclasses
-# @SUPPORTED_EAPIS: 6
+# @SUPPORTED_EAPIS: 6 7
# @BLURB: Provides phases for MATE based packages.
# @DESCRIPTION:
# Exports portage base functions used by ebuilds written for packages using the
@@ -16,7 +16,7 @@
# Check EAPI only
case "${EAPI:-0}" in
- 6) ;;
+ 6|7) ;;
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
@@ -26,8 +26,12 @@ esac
# @DESCRIPTION:
# Available values for MATE_LA_PUNT:
# - "no": will not clean any .la files
+# - In EAPI < 7:
# - "yes": will run prune_libtool_files --modules
# - If it is not set, it will run prune_libtool_files
+# - In EAPI 7:
+# - Any non-"no" value will run
+# find "${ED}" -name '*.la' -delete || die
# MATE_LA_PUNT is a stub to GNOME2_LA_PUNT
MATE_LA_PUNT=${MATE_LA_PUNT:-""}
GNOME2_LA_PUNT="${MATE_LA_PUNT}"
@@ -35,7 +39,7 @@ GNOME2_LA_PUNT="${MATE_LA_PUNT}"
inherit gnome2 autotools mate-desktop.org
case "${EAPI:-0}" in
- 6) EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_preinst pkg_postinst pkg_postrm ;;
+ 6|7) EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_preinst pkg_postinst pkg_postrm ;;
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
diff --git a/eclass/meson-multilib.eclass b/eclass/meson-multilib.eclass
index 01e14988463a..fc1ef5802f93 100644
--- a/eclass/meson-multilib.eclass
+++ b/eclass/meson-multilib.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Author: Matt Turner <mattst88@gentoo.org>
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: meson wrapper for multilib builds
# @DESCRIPTION:
# The meson-multilib.eclass provides a glue between meson.eclass(5)
@@ -20,14 +20,14 @@
# in multilib-minimal, yet they ought to call appropriate meson
# phase rather than 'default'.
+case ${EAPI} in
+ 7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
if [[ -z ${_MESON_MULTILIB_ECLASS} ]] ; then
_MESON_MULTILIB_ECLASS=1
-case ${EAPI:-0} in
- 7) ;;
- *) die "EAPI=${EAPI} is not supported" ;;
-esac
-
inherit meson multilib-minimal
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 8ba055c603be..e3e8730904ab 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -6,7 +6,7 @@
# Michał Górny <mgorny@gentoo.org>
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: flags and utility functions for building multilib packages
# @DESCRIPTION:
# The multilib-build.eclass exports USE flags and utility functions
@@ -17,15 +17,15 @@
# dependencies shall use the USE dependency string in ${MULTILIB_USEDEP}
# to properly request multilib enabled.
-if [[ ! ${_MULTILIB_BUILD} ]]; then
-
-# EAPI=4 is required for meaningful MULTILIB_USEDEP.
-case ${EAPI:-0} in
- 4|5|6|7) ;;
- *) die "EAPI=${EAPI} is not supported" ;;
+case ${EAPI} in
+ 5|6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
-[[ ${EAPI} == [45] ]] && inherit eutils
+if [[ -z ${_MULTILIB_BUILD} ]]; then
+_MULTILIB_BUILD=1
+
+[[ ${EAPI} == 5 ]] && inherit eutils
inherit multibuild multilib
# @ECLASS-VARIABLE: _MULTILIB_FLAGS
@@ -250,7 +250,7 @@ multilib_parallel_foreach_abi() {
multilib_for_best_abi() {
debug-print-function ${FUNCNAME} "${@}"
- [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead"
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead"
eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should"
eqawarn "not be used. The multilib_is_native_abi() check may be used instead."
@@ -588,7 +588,7 @@ multilib_is_native_abi() {
multilib_build_binaries() {
debug-print-function ${FUNCNAME} "${@}"
- [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead"
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead"
eqawarn "QA warning: multilib_build_binaries is deprecated. Please use the equivalent"
eqawarn "multilib_is_native_abi function instead."
@@ -671,5 +671,4 @@ multilib_native_usex() {
fi
}
-_MULTILIB_BUILD=1
fi
diff --git a/eclass/multilib-minimal.eclass b/eclass/multilib-minimal.eclass
index 8f7c7ba6fb38..6c5c754381b5 100644
--- a/eclass/multilib-minimal.eclass
+++ b/eclass/multilib-minimal.eclass
@@ -4,7 +4,7 @@
# @ECLASS: multilib-minimal.eclass
# @MAINTAINER:
# Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: wrapper for multilib builds providing convenient multilib_src_* functions
# @DESCRIPTION:
#
@@ -23,14 +23,13 @@
# If you need generic install rules, use multilib_src_install_all function.
-# EAPI=4 is required for meaningful MULTILIB_USEDEP.
-case ${EAPI:-0} in
- 4|5|6|7) ;;
- *) die "EAPI=${EAPI} is not supported" ;;
+case ${EAPI} in
+ 5|6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
-[[ ${EAPI} == [45] ]] && inherit eutils
+[[ ${EAPI} == 5 ]] && inherit eutils
inherit multilib-build
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
diff --git a/eclass/plocale.eclass b/eclass/plocale.eclass
new file mode 100644
index 000000000000..3a7b78e93ff2
--- /dev/null
+++ b/eclass/plocale.eclass
@@ -0,0 +1,169 @@
+# Copyright 2012-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: plocale.eclass
+# @MAINTAINER:
+# Ulrich Müller <ulm@gentoo.org>
+# @AUTHOR:
+# Ben de Groot <yngwin@gentoo.org>
+# @SUPPORTED_EAPIS: 6 7 8
+# @BLURB: convenience functions to handle localizations
+# @DESCRIPTION:
+# The plocale (localization) eclass offers a number of functions to more
+# conveniently handle localizations (translations) offered by packages.
+# These are meant to prevent code duplication for such boring tasks as
+# determining the cross-section between the user's set LINGUAS and what
+# is offered by the package.
+#
+# Typical usage in an ebuild looks like this:
+#
+# @CODE
+# PLOCALES="de en fr pt_BR zh_CN"
+# PLOCALE_BACKUP="en"
+# @CODE
+#
+# There, PLOCALES is the list of locales that the package supports.
+# PLOCALE_BACKUP is optional and specifies a single locale, which is
+# used as a fallback if none of the PLOCALES matches the user's
+# LINGUAS selection.
+#
+# The eclass functions then operate on the intersection of the package's
+# PLOCALES with the user's LINGUAS setting. (As a special case, if the
+# LINGUAS variable is unset then all items in PLOCALES will be used,
+# emulating the behaviour of gettext.)
+#
+# In the following simple example, locale specific README files
+# (e.g. README.de, README.en) are added to the DOCS variable:
+#
+# @CODE
+# my_add_to_docs() {
+# DOCS+=( ${1}.${2} )
+# }
+# plocale_for_each_locale my_add_to_docs README
+# @CODE
+#
+# A complementary function plocale_for_each_disabled_locale exists as
+# well, which operates on the set difference of PLOCALES and LINGUAS,
+# i.e. on the locales that the user hasn't enabled. For example, it can
+# be used to remove unnecessary locale files.
+#
+# Finally, plocale_find_changes is purely a helper function for ebuild
+# maintenance. It can be used to scan a directory for available
+# translations and check if the ebuild's PLOCALES are still up to date.
+
+case ${EAPI} in
+ 6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_PLOCALE_ECLASS} ]]; then
+_PLOCALE_ECLASS=1
+
+# @ECLASS-VARIABLE: PLOCALES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Variable listing the locales for which localizations are offered by
+# the package.
+#
+# Example: PLOCALES="cy de el_GR en_US pt_BR vi zh_CN"
+
+# @ECLASS-VARIABLE: PLOCALE_BACKUP
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# In some cases the package fails when none of the offered PLOCALES are
+# selected by the user. In that case this variable should be set to a
+# default locale (usually 'en' or 'en_US') as backup.
+#
+# Example: PLOCALE_BACKUP="en_US"
+
+# @FUNCTION: plocale_for_each_locale
+# @USAGE: <function> [<args>...]
+# @DESCRIPTION:
+# Convenience function for processing all enabled localizations.
+# The parameter should be a function (defined in the consuming eclass
+# or ebuild) which takes an individual locale as its (last) parameter.
+#
+# Example: plocale_for_each_locale install_locale
+plocale_for_each_locale() {
+ local locs x
+ locs=$(plocale_get_locales)
+ for x in ${locs}; do
+ "$@" ${x} || die "failed to process enabled ${x} locale"
+ done
+}
+
+# @FUNCTION: plocale_for_each_disabled_locale
+# @USAGE: <function> [<args>...]
+# @DESCRIPTION:
+# Complementary to plocale_for_each_locale, this function will process
+# locales that are disabled. This could be used for example to remove
+# locales from a Makefile, to prevent them from being built needlessly.
+plocale_for_each_disabled_locale() {
+ local locs x
+ locs=$(plocale_get_locales disabled)
+ for x in ${locs}; do
+ "$@" ${x} || die "failed to process disabled ${x} locale"
+ done
+}
+
+# @FUNCTION: plocale_find_changes
+# @USAGE: <translations dir> <filename pre pattern> <filename post pattern>
+# @DESCRIPTION:
+# Ebuild maintenance helper function to find changes in package offered
+# locales when doing a version bump. This could be added for example
+# to src_prepare.
+#
+# Example: plocale_find_changes "${S}/src/translations" "${PN}_" '.ts'
+plocale_find_changes() {
+ [[ $# -eq 3 ]] || die "Exactly 3 arguments are needed!"
+ ebegin "Looking in ${1} for new locales"
+ pushd "${1}" >/dev/null || die "Cannot access ${1}"
+ local current="" x
+ for x in ${2}*${3}; do
+ x=${x#"${2}"}
+ x=${x%"${3}"}
+ current+="${x} "
+ done
+ popd >/dev/null || die
+ # RHS will be sorted with single spaces so ensure the LHS is too
+ # before attempting to compare them for equality. See bug #513242.
+ # Run them both through the same sorting algorithm so we don't have
+ # to worry about them being the same.
+ [[ "$(printf '%s\n' ${PLOCALES} | LC_ALL=C sort)" \
+ == "$(printf '%s\n' ${current} | LC_ALL=C sort)" ]]
+ if ! eend $? "There are changes in locales!"; then
+ eerror "This ebuild should be updated to:"
+ eerror "PLOCALES=\"${current%[[:space:]]}\""
+ return 1
+ fi
+}
+
+# @FUNCTION: plocale_get_locales
+# @USAGE: [disabled]
+# @DESCRIPTION:
+# Determine which LINGUAS the user has enabled that are offered by the
+# package, as listed in PLOCALES, and return them. In case no locales
+# are selected, fall back on PLOCALE_BACKUP. When the disabled argument
+# is given, return the disabled locales instead of the enabled ones.
+plocale_get_locales() {
+ local loc locs
+ if [[ -z ${LINGUAS+set} ]]; then
+ # enable all if unset
+ locs=${PLOCALES}
+ else
+ for loc in ${LINGUAS}; do
+ has ${loc} ${PLOCALES} && locs+="${loc} "
+ done
+ fi
+ [[ -z ${locs} ]] && locs=${PLOCALE_BACKUP}
+ if [[ ${1} == disabled ]]; then
+ local disabled_locs
+ for loc in ${PLOCALES}; do
+ has ${loc} ${locs} || disabled_locs+="${loc} "
+ done
+ locs=${disabled_locs}
+ fi
+ printf "%s" "${locs}"
+}
+
+fi
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 7488802332f6..168c767a2eea 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1264,6 +1264,9 @@ epytest() {
-ra
# print local variables in tracebacks, useful for debugging
-l
+ # override filterwarnings=error, we do not really want -Werror
+ # for end users, as it tends to fail on new warnings from deps
+ -Wdefault
)
set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}"
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index ab0d65619843..27e4dcae1ff7 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -4,7 +4,7 @@
# @ECLASS: systemd.eclass
# @MAINTAINER:
# systemd@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: helper functions to install systemd units
# @DESCRIPTION:
# This eclass provides a set of functions to install unit files for
@@ -24,14 +24,14 @@
# }
# @CODE
-inherit toolchain-funcs
-
-case ${EAPI:-0} in
- 0|1|2|3|4|5|6|7) ;;
- *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
+case ${EAPI} in
+ 5|6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
-if [[ ${EAPI:-0} == [0123456] ]]; then
+inherit toolchain-funcs
+
+if [[ ${EAPI} == [56] ]]; then
DEPEND="virtual/pkgconfig"
else
BDEPEND="virtual/pkgconfig"
@@ -72,7 +72,6 @@ _systemd_get_systemunitdir() {
# ${D}). This function always succeeds, even if systemd is not
# installed.
systemd_get_systemunitdir() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
echo "${EPREFIX}$(_systemd_get_systemunitdir)"
@@ -82,7 +81,7 @@ systemd_get_systemunitdir() {
# @DESCRIPTION:
# Deprecated alias for systemd_get_systemunitdir.
systemd_get_unitdir() {
- [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead"
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead"
systemd_get_systemunitdir
}
@@ -101,7 +100,6 @@ _systemd_get_userunitdir() {
# ${D}). This function always succeeds, even if systemd is not
# installed.
systemd_get_userunitdir() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
echo "${EPREFIX}$(_systemd_get_userunitdir)"
@@ -121,7 +119,6 @@ _systemd_get_utildir() {
# ${D}). This function always succeeds, even if systemd is not
# installed.
systemd_get_utildir() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
echo "${EPREFIX}$(_systemd_get_utildir)"
@@ -138,10 +135,8 @@ _systemd_get_systemgeneratordir() {
# @FUNCTION: systemd_get_systemgeneratordir
# @DESCRIPTION:
# Output the path for the systemd system generator directory (not including
-# ${D}). This function always succeeds, even if systemd is not
-# installed.
+# ${D}). This function always succeeds, even if systemd is not installed.
systemd_get_systemgeneratordir() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
echo "${EPREFIX}$(_systemd_get_systemgeneratordir)"
@@ -150,8 +145,7 @@ systemd_get_systemgeneratordir() {
# @FUNCTION: systemd_dounit
# @USAGE: <unit>...
# @DESCRIPTION:
-# Install systemd unit(s). Uses doins, thus it is fatal in EAPI 4
-# and non-fatal in earlier EAPIs.
+# Install systemd unit(s). Uses doins, thus it is fatal.
systemd_dounit() {
debug-print-function ${FUNCNAME} "${@}"
@@ -165,8 +159,7 @@ systemd_dounit() {
# @FUNCTION: systemd_newunit
# @USAGE: <old-name> <new-name>
# @DESCRIPTION:
-# Install systemd unit with a new name. Uses newins, thus it is fatal
-# in EAPI 4 and non-fatal in earlier EAPIs.
+# Install systemd unit with a new name. Uses newins, thus it is fatal.
systemd_newunit() {
debug-print-function ${FUNCNAME} "${@}"
@@ -180,8 +173,7 @@ systemd_newunit() {
# @FUNCTION: systemd_douserunit
# @USAGE: <unit>...
# @DESCRIPTION:
-# Install systemd user unit(s). Uses doins, thus it is fatal in EAPI 4
-# and non-fatal in earlier EAPIs.
+# Install systemd user unit(s). Uses doins, thus it is fatal.
systemd_douserunit() {
debug-print-function ${FUNCNAME} "${@}"
@@ -196,7 +188,7 @@ systemd_douserunit() {
# @USAGE: <old-name> <new-name>
# @DESCRIPTION:
# Install systemd user unit with a new name. Uses newins, thus it
-# is fatal in EAPI 4 and non-fatal in earlier EAPIs.
+# is fatal.
systemd_newuserunit() {
debug-print-function ${FUNCNAME} "${@}"
@@ -237,54 +229,11 @@ systemd_install_serviced() {
)
}
-# @FUNCTION: systemd_dotmpfilesd
-# @USAGE: <tmpfilesd>...
-# @DESCRIPTION:
-# Deprecated in favor of tmpfiles.eclass.
-#
-# Install systemd tmpfiles.d files. Uses doins, thus it is fatal
-# in EAPI 4 and non-fatal in earlier EAPIs.
-systemd_dotmpfilesd() {
- debug-print-function ${FUNCNAME} "${@}"
-
- for f; do
- [[ ${f} == *.conf ]] \
- || die 'tmpfiles.d files need to have .conf suffix.'
- done
-
- (
- insopts -m 0644
- insinto /usr/lib/tmpfiles.d/
- doins "${@}"
- )
-}
-
-# @FUNCTION: systemd_newtmpfilesd
-# @USAGE: <old-name> <new-name>.conf
-# @DESCRIPTION:
-# Deprecated in favor of tmpfiles.eclass.
-#
-# Install systemd tmpfiles.d file under a new name. Uses newins, thus it
-# is fatal in EAPI 4 and non-fatal in earlier EAPIs.
-systemd_newtmpfilesd() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${2} == *.conf ]] \
- || die 'tmpfiles.d files need to have .conf suffix.'
-
- (
- insopts -m 0644
- insinto /usr/lib/tmpfiles.d/
- newins "${@}"
- )
-}
-
# @FUNCTION: systemd_enable_service
# @USAGE: <target> <service>
# @DESCRIPTION:
# Enable service in desired target, e.g. install a symlink for it.
-# Uses dosym, thus it is fatal in EAPI 4 and non-fatal in earlier
-# EAPIs.
+# Uses dosym, thus it is fatal.
systemd_enable_service() {
debug-print-function ${FUNCNAME} "${@}"
@@ -307,8 +256,7 @@ systemd_enable_service() {
# and name, while the remaining arguments list service units that will
# be added to that file.
#
-# Uses doins, thus it is fatal in EAPI 4 and non-fatal in earlier
-# EAPIs.
+# Uses doins, thus it is fatal.
#
# Doc: https://www.freedesktop.org/wiki/Software/systemd/timedated/
systemd_enable_ntpunit() {
@@ -363,7 +311,7 @@ systemd_enable_ntpunit() {
# argument to this function (`$(systemd_with_unitdir systemdunitdir)'). Please
# remember to report a bug upstream as well.
systemd_with_unitdir() {
- [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-${1:-systemdsystemunitdir}=\"\$(systemd_get_systemunitdir)\" instead"
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-${1:-systemdsystemunitdir}=\"\$(systemd_get_systemunitdir)\" instead"
debug-print-function ${FUNCNAME} "${@}"
local optname=${1:-systemdsystemunitdir}
@@ -380,7 +328,7 @@ systemd_with_unitdir() {
# systemd helpers. This function always succeeds. Its output may be quoted
# in order to preserve whitespace in paths.
systemd_with_utildir() {
- [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-systemdutildir=\"\$(systemd_get_utildir)\" instead"
+ [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-systemdutildir=\"\$(systemd_get_utildir)\" instead"
debug-print-function ${FUNCNAME} "${@}"
@@ -436,29 +384,6 @@ systemd_is_booted() {
return ${ret}
}
-# @FUNCTION: systemd_tmpfiles_create
-# @USAGE: <tmpfilesd> ...
-# @DESCRIPTION:
-# Deprecated in favor of tmpfiles.eclass.
-#
-# Invokes systemd-tmpfiles --create with given arguments.
-# Does nothing if ROOT != / or systemd-tmpfiles is not in PATH.
-# This function should be called from pkg_postinst.
-#
-# Generally, this function should be called with the names of any tmpfiles
-# fragments which have been installed, either by the build system or by a
-# previous call to systemd_dotmpfilesd. This ensures that any tmpfiles are
-# created without the need to reboot the system.
-systemd_tmpfiles_create() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst"
- [[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename"
- [[ ${ROOT:-/} == / ]] || return 0
- type systemd-tmpfiles &> /dev/null || return 0
- systemd-tmpfiles --create "${@}"
-}
-
# @FUNCTION: systemd_reenable
# @USAGE: <unit> ...
# @DESCRIPTION:
diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
index ffe7b9e1fd1c..e41cc7114398 100644
--- a/eclass/toolchain-glibc.eclass
+++ b/eclass/toolchain-glibc.eclass
@@ -12,8 +12,10 @@
if [[ -z ${_TOOLCHAIN_GLIBC_ECLASS} ]]; then
+TMPFILES_OPTIONAL=1
+
inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig \
- multilib systemd unpacker multiprocessing prefix
+ multilib systemd tmpfiles unpacker multiprocessing prefix
case ${EAPI:-0} in
0|1|2|3) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test \
@@ -1348,10 +1350,10 @@ toolchain-glibc_do_src_install() {
# TODO: Drop the $FILESDIR copy once 2.19 goes stable.
if version_is_at_least 2.19 ; then
systemd_dounit nscd/nscd.service || die
- systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die
+ newtmpfiles nscd/nscd.tmpfiles nscd.conf || die
else
systemd_dounit "${FILESDIR}"/nscd.service || die
- systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die
+ newtmpfiles "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die
fi
else
# Do this since extra/etc/*.conf above might have nscd.conf.
diff --git a/eclass/udev.eclass b/eclass/udev.eclass
index 2873ae9a92c3..7d5f59ab8d96 100644
--- a/eclass/udev.eclass
+++ b/eclass/udev.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: udev.eclass
# @MAINTAINER:
# udev-bugs@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: Default eclass for determining udev directories.
# @DESCRIPTION:
# Default eclass for determining udev directories.
@@ -28,18 +28,17 @@
# }
# @CODE
+case ${EAPI} in
+ 5|6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
if [[ -z ${_UDEV_ECLASS} ]]; then
_UDEV_ECLASS=1
inherit toolchain-funcs
-case ${EAPI:-0} in
- 0|1|2|3|4|5|6|7) ;;
- *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
-esac
-
-if [[ ${EAPI:-0} == [0123456] ]]; then
- RDEPEND=""
+if [[ ${EAPI} == [56] ]]; then
DEPEND="virtual/pkgconfig"
else
BDEPEND="virtual/pkgconfig"
@@ -82,8 +81,7 @@ get_udevdir() {
# @FUNCTION: udev_dorules
# @USAGE: <rule> [...]
# @DESCRIPTION:
-# Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
-# and non-fatal in earlier EAPIs.
+# Install udev rule(s). Uses doins, thus it is fatal.
udev_dorules() {
debug-print-function ${FUNCNAME} "${@}"
@@ -97,8 +95,7 @@ udev_dorules() {
# @FUNCTION: udev_newrules
# @USAGE: <oldname> <newname>
# @DESCRIPTION:
-# Install udev rule with a new name. Uses newins, thus it is fatal
-# in EAPI 4 and non-fatal in earlier EAPIs.
+# Install udev rule with a new name. Uses newins, thus it is fatal.
udev_newrules() {
debug-print-function ${FUNCNAME} "${@}"
@@ -113,7 +110,7 @@ udev_newrules() {
# @DESCRIPTION:
# Run udevadm control --reload to refresh rules and databases
udev_reload() {
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
+ if [[ -n ${ROOT%/} ]]; then
return 0
fi
diff --git a/eclass/verify-sig.eclass b/eclass/verify-sig.eclass
index e3ef7f240283..7f89e5388ba3 100644
--- a/eclass/verify-sig.eclass
+++ b/eclass/verify-sig.eclass
@@ -1,10 +1,10 @@
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: verify-sig.eclass
# @MAINTAINER:
# Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: Eclass to verify upstream signatures on distfiles
# @DESCRIPTION:
# verify-sig eclass provides a streamlined approach to verifying
@@ -32,15 +32,9 @@
# VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/example.asc
# @CODE
-case "${EAPI:-0}" in
- 0|1|2|3|4|5|6)
- die "Unsupported EAPI=${EAPI} (obsolete) for ${ECLASS}"
- ;;
- 7)
- ;;
- *)
- die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
- ;;
+case ${EAPI} in
+ 7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
EXPORT_FUNCTIONS src_unpack
diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 738df8658910..35084fc8164d 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2019 Gentoo Authors
+# Copyright 2004-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: xdg-utils.eclass
@@ -7,7 +7,7 @@
# freedesktop-bugs@gentoo.org
# @AUTHOR:
# Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: Auxiliary functions commonly used by XDG compliant packages.
# @DESCRIPTION:
# This eclass provides a set of auxiliary functions needed by most XDG
@@ -17,9 +17,9 @@
# * XDG .desktop files cache management
# * XDG mime information database management
-case "${EAPI:-0}" in
- 0|1|2|3|4|5|6|7) ;;
- *) die "EAPI=${EAPI} is not supported" ;;
+case ${EAPI} in
+ 5|6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
# @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR
@@ -57,7 +57,7 @@ xdg_environment_reset() {
# Updates the .desktop files database.
# Generates a list of mimetypes linked to applications that can handle them
xdg_desktop_database_update() {
- if [[ ${EBUILD_PHASE} != post* ]] ; then
+ if [[ ${EBUILD_PHASE} != post* ]]; then
die "xdg_desktop_database_update must be used in pkg_post* phases."
fi
@@ -76,7 +76,7 @@ xdg_desktop_database_update() {
# Updates icon theme cache files under /usr/share/icons.
# This function should be called from pkg_postinst and pkg_postrm.
xdg_icon_cache_update() {
- if [[ ${EBUILD_PHASE} != post* ]] ; then
+ if [[ ${EBUILD_PHASE} != post* ]]; then
die "xdg_icon_cache_update must be used in pkg_post* phases."
fi
@@ -86,21 +86,17 @@ xdg_icon_cache_update() {
fi
ebegin "Updating icons cache"
- local dir f retval=0
- local fails=( )
- for dir in "${EROOT%/}"/usr/share/icons/*
- do
- if [[ -f "${dir}/index.theme" ]] ; then
- local rv=0
- gtk-update-icon-cache -qf "${dir}"
- rv=$?
- if [[ ! $rv -eq 0 ]] ; then
+ local dir retval=0
+ local fails=()
+ for dir in "${EROOT%/}"/usr/share/icons/*; do
+ if [[ -f ${dir}/index.theme ]]; then
+ if ! gtk-update-icon-cache -qf "${dir}"; then
debug-print "Updating cache failed on ${dir}"
# Add to the list of failures
- fails+=( "${dir}" )
+ fails+=("${dir}")
retval=2
fi
- elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
+ elif [[ $(ls "${dir}") = icon-theme.cache ]]; then
# Clear stale cache files after theme uninstallation
rm "${dir}/icon-theme.cache"
fi
@@ -110,8 +106,8 @@ xdg_icon_cache_update() {
fi
done
eend ${retval}
- for f in "${fails[@]}" ; do
- eerror "Failed to update cache with icon $f"
+ for dir in "${fails[@]}"; do
+ eerror "Failed to update cache with icon ${dir}"
done
}
@@ -120,7 +116,7 @@ xdg_icon_cache_update() {
# Update the mime database.
# Creates a general list of mime types from several sources
xdg_mimeinfo_database_update() {
- if [[ ${EBUILD_PHASE} != post* ]] ; then
+ if [[ ${EBUILD_PHASE} != post* ]]; then
die "xdg_mimeinfo_database_update must be used in pkg_post* phases."
fi