From e748ba9741f6540f4675c23e3e37b73e822c13a4 Mon Sep 17 00:00:00 2001
From: V3n3RiX <venerix@redcorelinux.org>
Date: Mon, 31 May 2021 20:59:14 +0100
Subject: gentoo resync : 31.05.2021

---
 eclass/Manifest.gz            | Bin 35848 -> 35853 bytes
 eclass/ada.eclass             |  19 ++-
 eclass/common-lisp-3.eclass   |   1 +
 eclass/go-module.eclass       |  47 +++++-
 eclass/gstreamer-meson.eclass | 373 +++++++++++++++++++++++++++++++++++++++++
 eclass/kernel-2.eclass        | 382 +++++++++++++++---------------------------
 eclass/meson.eclass           |  10 +-
 eclass/nsplugins.eclass       |  80 ---------
 8 files changed, 572 insertions(+), 340 deletions(-)
 create mode 100644 eclass/gstreamer-meson.eclass
 delete mode 100644 eclass/nsplugins.eclass

(limited to 'eclass')

diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index ef4696e6746a..51639cd64a3c 100644
Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ
diff --git a/eclass/ada.eclass b/eclass/ada.eclass
index 2e409fd93050..1876a963496e 100644
--- a/eclass/ada.eclass
+++ b/eclass/ada.eclass
@@ -58,7 +58,7 @@ EXPORT_FUNCTIONS pkg_setup
 # @DESCRIPTION:
 # All supported Ada implementations, most preferred last.
 _ADA_ALL_IMPLS=(
-	gnat_2016 gnat_2017 gnat_2018 gnat_2019 gnat_2020
+	gnat_2016 gnat_2017 gnat_2018 gnat_2019 gnat_2020 gnat_2021
 )
 readonly _ADA_ALL_IMPLS
 
@@ -86,7 +86,7 @@ _ada_impl_supported() {
 		gnat_201[6789])
 			return 0
 			;;
-		gnat_2020)
+		gnat_202[01])
 			return 0
 			;;
 		*)
@@ -184,7 +184,7 @@ ada_export() {
 			impl=${1}
 			shift
 			;;
-		gnat_2020)
+		gnat_202[01])
 			impl=${1}
 			shift
 			;;
@@ -198,24 +198,35 @@ ada_export() {
 	debug-print "${FUNCNAME}: implementation: ${impl}"
 
 	local gcc_pv
+	local slot
 	case "${impl}" in
 		gnat_2016)
 			gcc_pv=4.9.4
+			slot=4.9.4
 			;;
 		gnat_2017)
 			gcc_pv=6.3.0
+			slot=6.3.0
 			;;
 		gnat_2018)
 			gcc_pv=7.3.1
+			slot=7.3.1
 			;;
 		gnat_2019)
 			gcc_pv=8.3.1
+			slot=8.3.1
 			;;
 		gnat_2020)
 			gcc_pv=9.3.1
+			slot=9.3.1
+			;;
+		gnat_2021)
+			gcc_pv=10.3.1
+			slot=10
 			;;
 		*)
 			gcc_pv="9.9.9"
+			slot=9.9.9
 			;;
 	esac
 
@@ -258,7 +269,7 @@ ada_export() {
 				debug-print "${FUNCNAME}: GNATCHOP = ${GNATCHOP}"
 				;;
 			ADA_PKG_DEP)
-				ADA_PKG_DEP="dev-lang/gnat-gpl:${gcc_pv}"
+				ADA_PKG_DEP="dev-lang/gnat-gpl:${slot}"
 
 				# use-dep
 				if [[ ${ADA_REQ_USE} ]]; then
diff --git a/eclass/common-lisp-3.eclass b/eclass/common-lisp-3.eclass
index 334444e16326..2ad4e243a846 100644
--- a/eclass/common-lisp-3.eclass
+++ b/eclass/common-lisp-3.eclass
@@ -197,6 +197,7 @@ common-lisp-export-impl-args() {
 	CL_BINARY="${1}"
 	case "${CL_BINARY}" in
 		sbcl)
+			CL_BINARY="${CL_BINARY} --non-interactive"
 			CL_NORC="--sysinit /dev/null --userinit /dev/null"
 			CL_LOAD="--load"
 			CL_EVAL="--eval"
diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index c9a7ab12eaf0..c11895944cdc 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -232,10 +232,54 @@ go-module_set_globals() {
 	readonly EGO_SUM_SRC_URI
 	readonly _GOMODULE_GOSUM_REVERSE_MAP
 
+	# export the GOPROXY setting
+	export GOPROXY="file://${T}/go-proxy"
+
 	# Set the guard that we are safe
 	_GO_MODULE_SET_GLOBALS_CALLED=1
 }
 
+# @FUNCTION: go-module_setup_proxy
+# @DESCRIPTION:
+# If your ebuild redefines src_unpack and uses EGO_SUM you need to call
+# this function in src_unpack.
+# It sets up the go module proxy in the appropriate location.
+go-module_setup_proxy() {
+	# shellcheck disable=SC2120
+	debug-print-function "${FUNCNAME}" "$@"
+
+	if [[ ! ${_GO_MODULE_SET_GLOBALS_CALLED} ]]; then
+		die "go-module_set_globals must be called in global scope"
+	fi
+
+	local goproxy_dir="${GOPROXY/file:\/\//}"
+	mkdir -p "${goproxy_dir}" || die
+
+	# For each Golang module distfile, look up where it's supposed to go and
+	# symlink it into place.
+	local f
+	local goproxy_mod_dir
+	for f in ${A}; do
+		goproxy_mod_path="${_GOMODULE_GOSUM_REVERSE_MAP["${f}"]}"
+		if [[ -n "${goproxy_mod_path}" ]]; then
+			debug-print-function "Populating go proxy for ${goproxy_mod_path}"
+			# Build symlink hierarchy
+			goproxy_mod_dir=$( dirname "${goproxy_dir}"/"${goproxy_mod_path}" )
+			mkdir -p "${goproxy_mod_dir}" || die
+			ln -sf "${DISTDIR}"/"${f}" "${goproxy_dir}/${goproxy_mod_path}" ||
+				die "Failed to ln"
+			local v=${goproxy_mod_path}
+			v="${v%.mod}"
+			v="${v%.zip}"
+			v="${v//*\/}"
+			_go-module_gosum_synthesize_files "${goproxy_mod_dir}" "${v}"
+		fi
+	done
+
+	# Validate the gosum now
+	_go-module_src_unpack_verify_gosum
+}
+
 # @FUNCTION: go-module_src_unpack
 # @DESCRIPTION:
 # If EGO_SUM is set, unpack the base tarball(s) and set up the
@@ -268,7 +312,7 @@ _go-module_src_unpack_gosum() {
 		die "go-module_set_globals must be called in global scope"
 	fi
 
-	local goproxy_dir="${T}/go-proxy"
+	local goproxy_dir="${GOPROXY/file:\/\//}"
 	mkdir -p "${goproxy_dir}" || die
 
 	# For each Golang module distfile, look up where it's supposed to go, and
@@ -293,7 +337,6 @@ _go-module_src_unpack_gosum() {
 			unpack "$f"
 		fi
 	done
-	export GOPROXY="file://${goproxy_dir}"
 
 	# Validate the gosum now
 	_go-module_src_unpack_verify_gosum
diff --git a/eclass/gstreamer-meson.eclass b/eclass/gstreamer-meson.eclass
new file mode 100644
index 000000000000..f1962073fd2b
--- /dev/null
+++ b/eclass/gstreamer-meson.eclass
@@ -0,0 +1,373 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: gstreamer-meson.eclass
+# @MAINTAINER:
+# gstreamer@gentoo.org
+# @AUTHOR:
+# Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+# Michał Górny <mgorny@gentoo.org>
+# Gilles Dartiguelongue <eva@gentoo.org>
+# Saleem Abdulrasool <compnerd@gentoo.org>
+# foser <foser@gentoo.org>
+# zaheerm <zaheerm@gentoo.org>
+# Steven Newbury
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Helps building core & split gstreamer plugins
+# @DESCRIPTION:
+# Eclass to make external gst-plugins emergable on a per-plugin basis
+# and to solve the problem with gst-plugins generating far too much
+# unneeded dependencies.
+#
+# GStreamer consuming applications should depend on the specific plugins
+# they need as defined in their source code. Usually you can find that
+# out by grepping the source tree for 'factory_make'. If it uses playbin
+# plugin, consider adding media-plugins/gst-plugins-meta dependency, but
+# also list any packages that provide explicitly requested plugins.
+
+# multilib-minimal goes last
+inherit meson multilib toolchain-funcs virtualx xdg-utils multilib-minimal
+
+case "${EAPI:-0}" in
+	7)
+		;;
+	*)
+		die "EAPI=\"${EAPI}\" is not supported"
+		;;
+esac
+
+# @ECLASS-VARIABLE: GST_PLUGINS_ENABLED
+# @DESCRIPTION:
+# Defines the plugins to be built.
+# May be set by an ebuild and contain more than one indentifier, space
+# separated (only src_configure can handle mutiple plugins at this time).
+
+# @ECLASS-VARIABLE: GST_PLUGINS_NOAUTO
+# @DESCRIPTION:
+# Space-separated list defined by the ebuild for plugin options which shouldn't
+# be automatically defined by gstreamer_multilib_src_configure.
+
+# @FUNCTION: gstreamer_get_default_enabled_plugins
+# @INTERNAL
+# @DESCRIPTION:
+# Get the list of plugins to be built by default, meaning the ones with no
+# external dependencies for base packages and the name of the package for
+# split ones.
+gstreamer_get_default_enabled_plugins() {
+	if [[ "${GST_ORG_MODULE}" == "${PN}" ]]; then
+		gstreamer_get_plugins
+		echo "${GST_PLUGINS_NO_EXT_DEPS}" | tr '\n' ' '
+	else
+		echo "${PN/gst-plugins-/}"
+	fi
+}
+
+# @FUNCTION: gstreamer_get_plugins
+# @INTERNAL
+# @DESCRIPTION:
+# Get the list of all plugins, with and without external dependencies.
+# Must be called from src_prepare/src_configure
+gstreamer_get_plugins() {
+	GST_PLUGINS_NO_EXT_DEPS=$(sed -rn \
+		"/^# Feature options for plugins with(out| no) external deps$/,/^#.*$/s;^option\('([^']*)'.*;\1;p" \
+		"${S}/meson_options.txt" || die "Failed to extract options for plugins without external deps"
+	)
+
+	GST_PLUGINS_EXT_DEPS=$(sed -rn \
+		"/^# Feature options for plugins (with|that need) external deps$/,/^#.*$/s;^option\('([^']*)'.*;\1;p" \
+		"${S}/meson_options.txt" || die "Failed to extract options for plugins with external deps"
+	)
+}
+
+# @ECLASS-VARIABLE: GST_PLUGINS_BUILD_DIR
+# @DESCRIPTION:
+# Actual build directories of the plugins.
+# Most often the same as the configure switch name.
+# FIXME: Change into a bash array
+: ${GST_PLUGINS_BUILD_DIR:=${PN/gst-plugins-/}}
+
+# @ECLASS-VARIABLE: GST_TARBALL_SUFFIX
+# @DESCRIPTION:
+# Most projects hosted on gstreamer.freedesktop.org mirrors provide
+# tarballs as tar.bz2 or tar.xz. This eclass defaults to xz. This is
+# because the gstreamer mirrors are moving to only have xz tarballs for
+# new releases.
+: ${GST_TARBALL_SUFFIX:="xz"}
+
+# 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 [[ ${GST_TARBALL_SUFFIX} == "xz" ]]; then
+	BDEPEND="${BDEPEND} app-arch/xz-utils"
+fi
+
+# @ECLASS-VARIABLE: GST_ORG_MODULE
+# @DESCRIPTION:
+# Name of the module as hosted on gstreamer.freedesktop.org mirrors.
+# Leave unset if package name matches module name.
+: ${GST_ORG_MODULE:=${PN}}
+
+# @ECLASS-VARIABLE: GST_ORG_PVP
+# @INTERNAL
+# @DESCRIPTION:
+# Major and minor numbers of the version number.
+: ${GST_ORG_PVP:=$(ver_cut 1-2)}
+
+
+DESCRIPTION="${BUILD_GST_PLUGINS} plugin for gstreamer"
+HOMEPAGE="https://gstreamer.freedesktop.org/"
+SRC_URI="https://gstreamer.freedesktop.org/src/${GST_ORG_MODULE}/${GST_ORG_MODULE}-${PV}.tar.${GST_TARBALL_SUFFIX}"
+S="${WORKDIR}/${GST_ORG_MODULE}-${PV}"
+
+LICENSE="GPL-2"
+case ${GST_ORG_PVP} in
+	1.*) SLOT="1.0"; GST_MIN_PV="1.2.4-r1" ;;
+	*) die "Unkown gstreamer release."
+esac
+
+RDEPEND="
+	>=dev-libs/glib-2.40.0:2[${MULTILIB_USEDEP}]
+"
+BDEPEND="
+	>=sys-apps/sed-4
+	virtual/pkgconfig
+	virtual/perl-JSON-PP
+"
+
+if [[ "${PN}" != "gstreamer" ]]; then
+	RDEPEND="
+		${RDEPEND}
+		>=media-libs/gstreamer-${GST_MIN_PV}:${SLOT}[${MULTILIB_USEDEP}]
+	"
+fi
+
+# Export common multilib phases.
+multilib_src_configure() { gstreamer_multilib_src_configure; }
+multilib_src_compile() { gstreamer_multilib_src_compile; }
+multilib_src_install() { gstreamer_multilib_src_install; }
+
+if [[ "${PN}" != "${GST_ORG_MODULE}" ]]; then
+	# Do not run test phase for invididual plugin ebuilds.
+	RESTRICT="test"
+	RDEPEND="${RDEPEND}
+		>=media-libs/${GST_ORG_MODULE}-${PV}:${SLOT}[${MULTILIB_USEDEP}]"
+
+	# Export multilib phases used for split builds.
+	multilib_src_install_all() { gstreamer_multilib_src_install_all; }
+else
+	local extra_deps=""
+
+	IUSE="nls test"
+	RESTRICT="!test? ( test )"
+	if [[ "${PN}" != "gstreamer" ]]; then
+		BDEPEND="${BDEPEND}
+			nls? ( >=sys-devel/gettext-0.17 )
+			test? ( media-libs/gstreamer[test] )
+		"
+	else
+		BDEPEND="${BDEPEND}
+			nls? ( >=sys-devel/gettext-0.17 )
+		"
+	fi
+
+	multilib_src_test() { gstreamer_multilib_src_test; }
+fi
+
+DEPEND="${DEPEND} ${RDEPEND}"
+
+# @FUNCTION: gstreamer_get_plugin_dir
+# @USAGE: gstreamer_get_plugin_dir [<build_dir>]
+# @INTERNAL
+# @DESCRIPTION:
+# Finds plugin build directory and output it.
+# Defaults to ${GST_PLUGINS_BUILD_DIR} if argument is not provided
+gstreamer_get_plugin_dir() {
+	local build_dir=${1:-${GST_PLUGINS_BUILD_DIR}}
+
+	if [[ ! -d ${S}/ext/${build_dir} ]]; then
+		if [[ ! -d ${S}/sys/${build_dir} ]]; then
+			ewarn "No such plugin directory"
+			die
+		fi
+		einfo "Got system plugin in ${build_dir}..." >&2
+		echo sys/${build_dir}
+	else
+		einfo "Got external plugin in ${build_dir}..." >&2
+		echo ext/${build_dir}
+	fi
+}
+
+# @VARIABLE: GST_PLUGINS_ENOAUTO
+# @INTERNAL
+# @DESCRIPTION:
+# Contains false-positives.
+# - gst-plugins-bad puts "shm" in external deps
+GST_PLUGINS_ENOAUTO="shm"
+
+# @FUNCTION: gstreamer_multilib_src_configure
+# @DESCRIPTION:
+# Handles logic common to configuring gstreamer plugins
+gstreamer_multilib_src_configure() {
+	local plugin gst_conf=( ) EMESON_SOURCE=${EMESON_SOURCE:-${S}}
+
+	gstreamer_get_plugins
+	xdg_environment_reset
+
+	GST_PLUGINS_ENABLED=${GST_PLUGINS_ENABLED:-$(gstreamer_get_default_enabled_plugins)}
+
+	for plugin in ${GST_PLUGINS_NO_EXT_DEPS} ${GST_PLUGINS_EXT_DEPS} ; do
+		if has ${plugin} ${GST_PLUGINS_NOAUTO} ${GST_PLUGINS_ENOAUTO}; then
+			: # noop
+		elif has ${plugin} ${GST_PLUGINS_ENABLED} ; then
+			gst_conf+=( -D${plugin}=enabled )
+		else
+			gst_conf+=( -D${plugin}=disabled )
+		fi
+	done
+
+	if grep -q "option('orc'" "${EMESON_SOURCE}"/meson_options.txt ; then
+		if in_iuse orc ; then
+			gst_conf+=( -Dorc=$(usex orc enabled disabled) )
+		else
+			gst_conf+=( -Dorc=disabled )
+			eqawarn "QA: IUSE=orc is missing while plugin supports it"
+		fi
+	else
+		if in_iuse orc ; then
+			eqawarn "QA: IUSE=orc is present while plugin does not support it"
+		fi
+	fi
+
+	if grep -q "option('introspection'" "${EMESON_SOURCE}"/meson_options.txt ; then
+		if in_iuse introspection ; then
+			gst_conf+=( -Dintrospection=$(multilib_native_usex introspection enabled disabled) )
+		else
+			gst_conf+=( -Dintrospection=disabled )
+			eqawarn "QA: IUSE=introspection is missing while plugin supports it"
+		fi
+	else
+		if in_iuse introspection ; then
+			eqawarn "QA: IUSE=introspection is present while plugin does not support it"
+		fi
+	fi
+
+	if grep -q "option('maintainer-mode'" "${EMESON_SOURCE}"/meson_options.txt ; then
+		gst_conf+=( -Dmaintainer-mode=disabled )
+	fi
+
+	if grep -q "option('schemas-compile'" "${EMESON_SOURCE}"/meson_options.txt ; then
+		gst_conf+=( -Dschemas-compile=disabled )
+	fi
+
+	if grep -q "option('examples'" "${EMESON_SOURCE}"/meson_options.txt ; then
+		gst_conf+=( -Dexamples=disabled )
+	fi
+
+	if [[ ${PN} == ${GST_ORG_MODULE} ]]; then
+		if grep -q "option('nls'" "${EMESON_SOURCE}"/meson_options.txt ; then
+			gst_conf+=( $(meson_feature nls) )
+		fi
+
+		if grep -q "option('tests'" "${EMESON_SOURCE}"/meson_options.txt ; then
+			gst_conf+=( $(meson_feature test tests) )
+		fi
+	fi
+
+	einfo "Configuring to build ${GST_PLUGINS_ENABLED} plugin(s) ..."
+	gst_conf+=(
+		-Dpackage-name="Gentoo GStreamer ebuild"
+		-Dpackage-origin="https://www.gentoo.org"
+		"${@}"
+	)
+	meson_src_configure "${gst_conf[@]}"
+}
+
+
+# @FUNCTION: _gstreamer_get_target_filename
+# @INTERNAL
+# @DESCRIPTION:
+# Looks for first argument being present as a substring in install targets
+# Got ported from python to perl for greater language-stability
+_gstreamer_get_target_filename() {
+	cat >"${WORKDIR}/_gstreamer_get_target_filename.pl" <<"EOF"
+#!/usr/bin/env perl
+use strict;
+use utf8;
+use JSON::PP;
+
+open(my $targets_file, '<:encoding(UTF-8)', 'meson-info/intro-targets.json') || die $!;
+my $data = decode_json <$targets_file>;
+close($targets_file) || die $!;
+
+if(!$ARGV[0]) {
+	die "Requires a target as argument";
+}
+
+foreach my $target (@{$data}) {
+	if($target->{'installed'}
+		and (index($target->{'filename'}[0], $ARGV[0]) != -1)
+	) {
+		printf "%s:%s\n", $target->{'filename'}[0], $target->{'install_filename'}[0];
+	}
+}
+EOF
+
+	chmod +x "${WORKDIR}/_gstreamer_get_target_filename.pl" || die
+
+	perl "${WORKDIR}/_gstreamer_get_target_filename.pl" $@ \
+		|| die "Failed to extract target filenames from meson-info"
+}
+
+# @FUNCTION: gstreamer_multilib_src_compile
+# @DESCRIPTION:
+# Compiles requested gstreamer plugin.
+gstreamer_multilib_src_compile() {
+	if [[ "${PN}" == "${GST_ORG_MODULE}" ]]; then
+		eninja
+	else
+		local plugin_dir plugin
+
+		for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+			plugin=$(_gstreamer_get_target_filename $(gstreamer_get_plugin_dir ${plugin_dir}))
+			plugin_path="${plugin%%:*}"
+			eninja "${plugin_path/"${BUILD_DIR}/"}"
+		done
+	fi
+}
+
+# @FUNCTION: gstreamer_multilib_src_test
+# @DESCRIPTION:
+# Tests the gstreamer plugin (non-split)
+gstreamer_multilib_src_test() {
+	GST_GL_WINDOW=x11 virtx eninja test
+}
+
+# @FUNCTION: gstreamer_multilib_src_install
+# @DESCRIPTION:
+# Installs requested gstreamer plugin.
+gstreamer_multilib_src_install() {
+	if [[ "${PN}" == "${GST_ORG_MODULE}" ]]; then
+		DESTDIR="${D}" eninja install
+	else
+		local plugin_dir plugin
+
+		for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+			for plugin in $(_gstreamer_get_target_filename $(gstreamer_get_plugin_dir ${plugin_dir})); do
+				local install_filename="${plugin##*:}"
+				insinto "${install_filename%/*}"
+				doins "${plugin%%:*}"
+			done
+		done
+	fi
+}
+
+# @FUNCTION: gstreamer_multilib_src_install_all
+# @DESCRIPTION:
+# Installs documentation for requested gstreamer plugin
+gstreamer_multilib_src_install_all() {
+	local plugin_dir
+
+	for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+		local dir=$(gstreamer_get_plugin_dir ${plugin_dir})
+		[[ -e ${dir}/README ]] && dodoc "${dir}"/README
+	done
+}
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index f1f23f6a0e46..2d721ffca878 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -8,7 +8,7 @@
 # John Mylchreest <johnm@gentoo.org>
 # Mike Pagano <mpagano@gentoo.org>
 # <so many, many others, please add yourself>
-# @SUPPORTED_EAPIS: 2 3 4 5 6
+# @SUPPORTED_EAPIS: 6 7
 # @BLURB: Eclass for kernel packages
 # @DESCRIPTION:
 # This is the kernel.eclass rewrite for a clean base regarding the 2.6
@@ -28,7 +28,7 @@
 # @ECLASS-VARIABLE:  K_NODRYRUN
 # @DEFAULT_UNSET
 # @DESCRIPTION:
-# if this is set then patch --dry-run will not 
+# if this is set then patch --dry-run will not
 # be run. Certain patches will fail with this parameter
 # See bug #507656
 
@@ -198,11 +198,10 @@
 # If you do change them, there is a chance that we will not fix resulting bugs;
 # that of course does not mean we're not willing to help.
 
-inherit toolchain-funcs
-[[ ${EAPI:-0} == [012345] ]] && inherit epatch
-[[ ${EAPI:-0} == [0123456] ]] && inherit estack eapi7-ver
+inherit estack toolchain-funcs
+[[ ${EAPI:-0} == 6 ]] && inherit eapi7-ver
 case ${EAPI:-0} in
-	2|3|4|5|6)
+	6|7)
 		EXPORT_FUNCTIONS src_{unpack,prepare,compile,install,test} \
 			pkg_{setup,preinst,postinst,postrm} ;;
 	*) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
@@ -211,7 +210,7 @@ esac
 # Added by Daniel Ostrow <dostrow@gentoo.org>
 # This is an ugly hack to get around an issue with a 32-bit userland on ppc64.
 # I will remove it when I come up with something more reasonable.
-[[ ${PROFILE_ARCH} == "ppc64" ]] && CHOST="powerpc64-${CHOST#*-}"
+[[ ${PROFILE_ARCH} == ppc64 ]] && CHOST="powerpc64-${CHOST#*-}"
 
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then
@@ -290,17 +289,17 @@ handle_genpatches() {
 
 		local use_cond_start="" use_cond_end=""
 
-		if [[ "${i}" == "experimental" && -z ${K_EXP_GENPATCHES_PULL} && -z ${K_EXP_GENPATCHES_NOUSE} ]] ; then
+		if [[ ${i} == experimental && -z ${K_EXP_GENPATCHES_PULL} && -z ${K_EXP_GENPATCHES_NOUSE} ]]; then
 			use_cond_start="experimental? ( "
 			use_cond_end=" )"
 
-			if [[ -n ${want_unipatch_list} ]] && use experimental ; then
+			if [[ -n ${want_unipatch_list} ]] && use experimental; then
 				UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
-				debug-print "genpatches tarball: $tarball"
+				debug-print "genpatches tarball: ${tarball}"
 			fi
 		elif [[ -n ${want_unipatch_list} ]]; then
 			UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
-			debug-print "genpatches tarball: $tarball"
+			debug-print "genpatches tarball: ${tarball}"
 		fi
 		GENPATCHES_URI+=" ${use_cond_start}$(echo https://dev.gentoo.org/~{alicef,mpagano,whissi}/dist/genpatches/${tarball})${use_cond_end}"
 	done
@@ -314,7 +313,6 @@ handle_genpatches() {
 # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
 # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
 detect_version() {
-
 	# We've already run, so nothing to do here.
 	[[ -n ${KV_FULL} ]] && return 0
 
@@ -367,7 +365,7 @@ detect_version() {
 		done
 	fi
 
-	[[ $n -eq 1 ]] && \
+	[[ ${n} -eq 1 ]] && \
 		eerror "Missing variables: ${missing}" && \
 		die "Failed to extract kernel version (try explicit CKV in ebuild)!"
 	unset v n missing
@@ -380,7 +378,7 @@ detect_version() {
 		# 3.x directory, may need to revisit when 4.x is released
 		KERNEL_BASE_URI="https://www.kernel.org/pub/linux/kernel/v${KV_MAJOR}.x"
 
-		[[ -n "${K_LONGTERM}" ]] &&
+		[[ -n ${K_LONGTERM} ]] &&
 			KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}"
 	else
 		#KERNEL_BASE_URI="https://www.kernel.org/pub/linux/kernel/v${KV_MAJOR}.0"
@@ -391,14 +389,14 @@ detect_version() {
 			KERNEL_BASE_URI="https://www.kernel.org/pub/linux/kernel/v${KV_MAJOR}.${KV_MINOR}"
 		fi
 
-		[[ -n "${K_LONGTERM}" ]] &&
+		[[ -n ${K_LONGTERM} ]] &&
 			#KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm"
 			KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
 	fi
 
 	debug-print "KERNEL_BASE_URI is ${KERNEL_BASE_URI}"
 
-	if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
+	if [[ ${#OKV_ARRAY[@]} -ge 3 && ${KV_MAJOR} -ge 3 ]]; then
 		# handle non genpatch using sources correctly
 		if [[ -z ${K_WANT_GENPATCHES} && -z ${K_GENPATCHES_VER} && ${KV_PATCH} -gt 0 ]]; then
 			KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.xz"
@@ -416,7 +414,7 @@ detect_version() {
 	# We cannot trivally call kernel_is here, because it calls us to detect the
 	# version
 	#kernel_is ge 2 6 && RELEASE=${RELEASE/-pre/-git}
-	[ $(($KV_MAJOR * 1000 + ${KV_MINOR:-0})) -ge 2006 ] && RELEASE=${RELEASE/-pre/-git}
+	(( KV_MAJOR * 1000 + ${KV_MINOR:-0} >= 2006 )) && RELEASE=${RELEASE/-pre/-git}
 	RELEASETYPE=${RELEASE//[0-9]}
 
 	# Now we know that RELEASE is the -rc/-git
@@ -425,16 +423,16 @@ detect_version() {
 	# first of all, we add the release
 	EXTRAVERSION="${RELEASE}"
 	debug-print "0 EXTRAVERSION:${EXTRAVERSION}"
-	[[ -n ${KV_EXTRA} ]] && [[ ${KV_MAJOR} -lt 3 ]] && EXTRAVERSION=".${KV_EXTRA}${EXTRAVERSION}"
+	[[ -n ${KV_EXTRA} && ${KV_MAJOR} -lt 3 ]] && EXTRAVERSION=".${KV_EXTRA}${EXTRAVERSION}"
 
 	debug-print "1 EXTRAVERSION:${EXTRAVERSION}"
-	if [[ -n "${K_NOUSEPR}" ]]; then
+	if [[ -n ${K_NOUSEPR} ]]; then
 		# Don't add anything based on PR to EXTRAVERSION
 		debug-print "1.0 EXTRAVERSION:${EXTRAVERSION}"
 	elif [[ -n ${K_PREPATCHED} ]]; then
 		debug-print "1.1 EXTRAVERSION:${EXTRAVERSION}"
 		EXTRAVERSION="${EXTRAVERSION}-${PN/-*}${PR/r}"
-	elif [[ "${ETYPE}" = "sources" ]]; then
+	elif [[ ${ETYPE} = sources ]]; then
 		debug-print "1.2 EXTRAVERSION:${EXTRAVERSION}"
 		# For some sources we want to use the PV in the extra version
 		# This is because upstream releases with a completely different
@@ -444,9 +442,9 @@ detect_version() {
 		  vserver) K_USEPV=1;;
 		esac
 
-		[[ -z "${K_NOUSENAME}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*}"
-		[[ -n "${K_USEPV}" ]]     && EXTRAVERSION="${EXTRAVERSION}-${PV//_/-}"
-		[[ -n "${PR//r0}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
+		[[ -z ${K_NOUSENAME} ]] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*}"
+		[[ -n ${K_USEPV} ]]     && EXTRAVERSION="${EXTRAVERSION}-${PV//_/-}"
+		[[ -n ${PR//r0} ]] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
 	fi
 	debug-print "2 EXTRAVERSION:${EXTRAVERSION}"
 
@@ -481,7 +479,7 @@ detect_version() {
 
 	if [[ ${KV_MAJOR}${KV_MINOR} -eq 26 ]]; then
 
-		if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
+		if [[ ${RELEASETYPE} == -rc || ${RELEASETYPE} == -pre ]]; then
 			OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
 			KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
 						${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
@@ -508,9 +506,9 @@ detect_version() {
 		# the different majorminor versions have different patch start versions
 		OKV_DICT=(["2"]="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))" ["3"]="2.6.39" ["4"]="3.19")
 
-		if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
+		if [[ ${RELEASETYPE} == -rc || ${RELEASETYPE} == -pre ]]; then
 
-			OKV=${K_BASE_VER:-$OKV_DICT["${KV_MAJOR}"]}
+			OKV=${K_BASE_VER:-${OKV_DICT["${KV_MAJOR}"]}}
 
 			# as of 12/5/2017, the rc patch is no longer offered as a compressed
 			# file, and no longer is it mirrored on kernel.org
@@ -532,15 +530,13 @@ detect_version() {
 		fi
 
 		if [[ ${RELEASETYPE} == -rc-git ]]; then
-			OKV=${K_BASE_VER:-$OKV_DICT["${KV_MAJOR}"]}
+			OKV=${K_BASE_VER:-${OKV_DICT["${KV_MAJOR}"]}}
 			KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz
 						${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz
 						${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
 
 			UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz"
 		fi
-
-
 	fi
 
 	debug-print-kernel2-variables
@@ -561,7 +557,7 @@ kernel_is() {
 	# some of the sources have in the past had only one set.
 	local v n=0
 	for v in OKV KV_{MAJOR,MINOR,PATCH} ; do [[ -z ${!v} ]] && n=1 ; done
-	[[ $n -eq 1 ]] && detect_version
+	[[ ${n} -eq 1 ]] && detect_version
 	unset v n
 
 	# Now we can continue
@@ -582,28 +578,10 @@ kernel_is() {
 	[ ${test} ${operator} ${value} ]
 }
 
-# @FUNCTION: kernel_is_2_4
-# @USAGE:
-# @DESCRIPTION:
-# return true if kernel is version 2.4
-kernel_is_2_4() {
-	kernel_is 2 4
-}
-
-# @FUNCTION: kernel_is_2_6
-# @USAGE:
-# @DESCRIPTION:
-# return true if kernel is version 2.6
-kernel_is_2_6() {
-	kernel_is 2 6 || kernel_is 2 5
-}
-
 # Capture the sources type and set DEPENDs
 if [[ ${ETYPE} == sources ]]; then
-	DEPEND="!build? (
-		sys-apps/sed
-		>=sys-devel/binutils-2.11.90.0.31
-	)"
+	[[ ${EAPI} == 6 ]] && DEPEND="!build? ( sys-apps/sed )" ||
+	BDEPEND="!build? ( sys-apps/sed )"
 	RDEPEND="!build? (
 		dev-lang/perl
 		sys-devel/bc
@@ -620,13 +598,13 @@ if [[ ${ETYPE} == sources ]]; then
 	IUSE="symlink build"
 
 	# Bug #266157, deblob for libre support
-	if [[ -z ${K_PREDEBLOBBED} ]] ; then
+	if [[ -z ${K_PREDEBLOBBED} ]]; then
 		# Bug #359865, force a call to detect_version if needed
 		kernel_is ge 2 6 27 && \
-			[[ -z "${K_DEBLOB_AVAILABLE}" ]] && \
+			[[ -z ${K_DEBLOB_AVAILABLE} ]] && \
 				kernel_is le 2 6 ${DEBLOB_MAX_VERSION} && \
 					K_DEBLOB_AVAILABLE=1
-		if [[ ${K_DEBLOB_AVAILABLE} == "1" ]] ; then
+		if [[ ${K_DEBLOB_AVAILABLE} == 1 ]]; then
 			PYTHON_COMPAT=( python2_7 )
 
 			inherit python-any-r1
@@ -638,7 +616,8 @@ if [[ ${ETYPE} == sources ]]; then
 			# tree has been dropped from the kernel.
 			kernel_is lt 4 14 && LICENSE+=" !deblob? ( linux-firmware )"
 
-			DEPEND+=" deblob? ( ${PYTHON_DEPS} )"
+			[[ ${EAPI} == 6 ]] && DEPEND+=" deblob? ( ${PYTHON_DEPS} )" ||
+			BDEPEND+=" deblob? ( ${PYTHON_DEPS} )"
 
 			if [[ -n KV_MINOR ]]; then
 				DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
@@ -715,54 +694,15 @@ env_setup_xmakeopts() {
 	# When cross-compiling, we need to set the ARCH/CROSS_COMPILE
 	# variables properly or bad things happen !
 	xmakeopts="ARCH=${KARCH}"
-	if [[ ${CTARGET} != ${CHOST} ]] && ! cross_pre_c_headers ; then
+	if [[ ${CTARGET} != ${CHOST} ]] && ! cross_pre_c_headers; then
 		xmakeopts="${xmakeopts} CROSS_COMPILE=${CTARGET}-"
-	elif type -p ${CHOST}-ar > /dev/null ; then
+	elif type -p ${CHOST}-ar >/dev/null; then
 		xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
 	fi
 	xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC)"
 	export xmakeopts
 }
 
-# @FUNCTION: unpack_2_4
-# @USAGE:
-# @DESCRIPTION:
-# unpack and generate .config for 2.4 kernels
-
-unpack_2_4() {
-	# this file is required for other things to build properly,
-	# so we autogenerate it
-	make -s mrproper ${xmakeopts} || die "make mrproper failed"
-	make -s symlinks ${xmakeopts} || die "make symlinks failed"
-	make -s include/linux/version.h ${xmakeopts} || die "make include/linux/version.h failed"
-	echo ">>> version.h compiled successfully."
-}
-
-# @FUNCTION: unpack_2_6
-# @USAGE:
-# @DESCRIPTION:
-# unpack and generate .config for 2.6 kernels
-
-unpack_2_6() {
-	# this file is required for other things to build properly, so we
-	# autogenerate it ... generate a .config to keep version.h build from
-	# spitting out an annoying warning
-	make -s mrproper ${xmakeopts} 2>/dev/null \
-		|| die "make mrproper failed"
-
-	# quick fix for bug #132152 which triggers when it cannot include linux
-	# headers (ie, we have not installed it yet)
-	if ! make -s defconfig ${xmakeopts} &>/dev/null 2>&1 ; then
-		touch .config
-		eerror "make defconfig failed."
-		eerror "assuming you dont have any headers installed yet and continuing"
-	fi
-
-	make -s include/linux/version.h ${xmakeopts} 2>/dev/null \
-		|| die "make include/linux/version.h failed"
-	rm -f .config >/dev/null
-}
-
 # @FUNCTION: universal_unpack
 # @USAGE:
 # @DESCRIPTION:
@@ -774,20 +714,20 @@ universal_unpack() {
 	local OKV_ARRAY
 	IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
 
-	cd "${WORKDIR}"
-	if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
+	cd "${WORKDIR}" || die
+	if [[ ${#OKV_ARRAY[@]} -ge 3 && ${KV_MAJOR} -ge 3 ]]; then
 		unpack linux-${KV_MAJOR}.${KV_MINOR}.tar.xz
 	else
 		unpack linux-${OKV}.tar.xz
 	fi
 
-	if [[ -d "linux" ]]; then
+	if [[ -d linux ]]; then
 		debug-print "Moving linux to linux-${KV_FULL}"
 		mv linux linux-${KV_FULL} \
 			|| die "Unable to move source tree to ${KV_FULL}."
-	elif [[ "${OKV}" != "${KV_FULL}" ]]; then
-		if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]] &&
-			[[ "${ETYPE}" = "sources" ]]; then
+	elif [[ ${OKV} != ${KV_FULL} ]]; then
+		if [[ ${#OKV_ARRAY[@]} -ge 3 && ${KV_MAJOR} -ge 3 ]] &&
+			[[ ${ETYPE} = sources ]]; then
 			debug-print "moving linux-${KV_MAJOR}.${KV_MINOR} to linux-${KV_FULL} "
 			mv linux-${KV_MAJOR}.${KV_MINOR} linux-${KV_FULL} \
 				|| die "Unable to move source tree to ${KV_FULL}."
@@ -796,14 +736,14 @@ universal_unpack() {
 			mv linux-${OKV} linux-${KV_FULL} \
 				|| die "Unable to move source tree to ${KV_FULL}."
 		fi
-	elif [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
+	elif [[ ${#OKV_ARRAY[@]} -ge 3 && ${KV_MAJOR} -ge 3 ]]; then
 		mv linux-${KV_MAJOR}.${KV_MINOR} linux-${KV_FULL} \
 			|| die "Unable to move source tree to ${KV_FULL}."
 	fi
-	cd "${S}"
+	cd "${S}" || die
 
 	# remove all backup files
-	find . -iname "*~" -exec rm {} \; 2> /dev/null
+	find . -iname "*~" -exec rm {} \; 2>/dev/null
 
 }
 
@@ -813,9 +753,7 @@ universal_unpack() {
 # handle EXTRAVERSION
 
 unpack_set_extraversion() {
-	cd "${S}"
-	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
-	cd "${OLDPWD}"
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" "${S}"/Makefile || die
 }
 
 # @FUNCTION: unpack_fix_install_path
@@ -825,8 +763,7 @@ unpack_set_extraversion() {
 # Otherwise patches that modify the same area of Makefile will fail
 
 unpack_fix_install_path() {
-	cd "${S}"
-	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
+	sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' "${S}"/Makefile || die
 }
 
 # Compile Functions
@@ -846,7 +783,7 @@ compile_headers() {
 
 	if kernel_is 2 4; then
 		yes "" | make oldconfig ${xmakeopts}
-		echo ">>> make oldconfig complete"
+		elog ">>> make oldconfig complete"
 		make dep ${xmakeopts}
 	elif kernel_is 2 6; then
 		# 2.6.18 introduces headers_install which means we dont need any
@@ -855,17 +792,17 @@ compile_headers() {
 
 		# autoconf.h isnt generated unless it already exists. plus, we have
 		# no guarantee that any headers are installed on the system...
-		[[ -f ${EROOT}usr/include/linux/autoconf.h ]] \
-			|| touch include/linux/autoconf.h
+		[[ -f ${EROOT%/}/usr/include/linux/autoconf.h ]] \
+			|| touch include/linux/autoconf.h || die
 
 		# if K_DEFCONFIG isn't set, force to "defconfig"
 		# needed by mips
 		if [[ -z ${K_DEFCONFIG} ]]; then
-			if kernel_is ge 2 6 16 ; then
+			if kernel_is ge 2 6 16; then
 				case ${CTARGET} in
 					powerpc64*)	K_DEFCONFIG="ppc64_defconfig";;
 					powerpc*)	K_DEFCONFIG="pmac32_defconfig";;
-					*)			K_DEFCONFIG="defconfig";;
+					*)		K_DEFCONFIG="defconfig";;
 				esac
 			else
 				K_DEFCONFIG="defconfig"
@@ -880,7 +817,7 @@ compile_headers() {
 		cross_pre_c_headers && return 0
 
 		make ${K_DEFCONFIG} HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "defconfig failed (${K_DEFCONFIG})"
-		if compile_headers_tweak_config ; then
+		if compile_headers_tweak_config; then
 			yes "" | make oldconfig HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "2nd oldconfig failed"
 		fi
 		make prepare HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
@@ -914,10 +851,8 @@ compile_headers_tweak_config() {
 # Fix permissions in tarball
 
 install_universal() {
-	cd "${WORKDIR}"
-	chown -R 0:0 * >& /dev/null
-	chmod -R a+r-w+X,u+w *
-	cd ${OLDPWD}
+	chown -R 0:0 "${WORKDIR}"/* &>/dev/null
+	chmod -R a+r-w+X,u+w "${WORKDIR}"/*
 }
 
 # @FUNCTION: install_headers
@@ -930,34 +865,34 @@ install_headers() {
 
 	# 2.6.18 introduces headers_install which means we dont need any
 	# of this crap anymore :D
-	if kernel_is ge 2 6 18 ; then
+	if kernel_is ge 2 6 18; then
 		env_setup_xmakeopts
-		emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts} || die
+		emake headers_install INSTALL_HDR_PATH="${ED%/}"${ddir}/.. ${xmakeopts}
 
 		# let other packages install some of these headers
-		rm -rf "${ED}"${ddir}/scsi || die #glibc/uclibc/etc...
+		rm -rf "${ED%/}"${ddir}/scsi || die #glibc/uclibc/etc...
 		return 0
 	fi
 
 	# Do not use "linux/*" as that can cause problems with very long
 	# $S values where the cmdline to cp is too long
-	pushd "${S}" >/dev/null
+	pushd "${S}" >/dev/null || die
 	dodir ${ddir}/linux
-	cp -pPR "${S}"/include/linux "${ED}"${ddir}/ || die
-	rm -rf "${ED}"${ddir}/linux/modules || die
+	cp -pPR "${S}"/include/linux "${ED%/}"${ddir}/ || die
+	rm -rf "${ED%/}"${ddir}/linux/modules || die
 
 	dodir ${ddir}/asm
-	cp -pPR "${S}"/include/asm/* "${ED}"${ddir}/asm || die
+	cp -pPR "${S}"/include/asm/* "${ED%/}"${ddir}/asm || die
 
-	if kernel_is 2 6 ; then
+	if kernel_is 2 6; then
 		dodir ${ddir}/asm-generic
-		cp -pPR "${S}"/include/asm-generic/* "${ED}"${ddir}/asm-generic || die
+		cp -pPR "${S}"/include/asm-generic/* "${ED%/}"${ddir}/asm-generic || die
 	fi
 
 	# clean up
-	find "${D}" -name '*.orig' -exec rm -f {} \;
+	find "${D}" -name '*.orig' -exec rm -f {} \; || die
 
-	popd >/dev/null
+	popd >/dev/null || die
 }
 
 # @FUNCTION: install_sources
@@ -968,9 +903,9 @@ install_headers() {
 install_sources() {
 	local file
 
-	cd "${S}"
+	cd "${S}" || die
 	dodir /usr/src
-	echo ">>> Copying sources ..."
+	elog ">>> Copying sources ..."
 
 	file="$(find ${WORKDIR} -iname "docs" -type d)"
 	if [[ -n ${file} ]]; then
@@ -983,9 +918,9 @@ install_sources() {
 		done
 	fi
 
-	mv "${WORKDIR}"/linux* "${ED}"usr/src || die
+	mv "${WORKDIR}"/linux* "${ED%/}"/usr/src || die
 
-	if [[ -n "${UNIPATCH_DOCS}" ]] ; then
+	if [[ -n ${UNIPATCH_DOCS} ]]; then
 		for i in ${UNIPATCH_DOCS}; do
 			dodoc "${T}"/${i}
 		done
@@ -1019,42 +954,40 @@ postinst_sources() {
 	# If some particular kernel version doesn't have security
 	# supported because of USE=deblob or otherwise, one can still
 	# set K_SECURITY_UNSUPPORTED on a per ebuild basis.
-	#[[ $K_DEBLOB_AVAILABLE == 1 ]] && \
+	#[[ ${K_DEBLOB_AVAILABLE} == 1 ]] && \
 	#	use deblob && \
 	#	K_SECURITY_UNSUPPORTED=deblob
 
 	# if we are to forcably symlink, delete it if it already exists first.
 	if [[ ${K_SYMLINK} -gt 0 ]]; then
-		[[ -h ${EROOT}usr/src/linux ]] && { rm "${EROOT}"usr/src/linux || die; }
+		[[ -h ${EROOT%/}/usr/src/linux ]] && { rm "${EROOT%/}"/usr/src/linux || die; }
 		MAKELINK=1
 	fi
 
 	# if the link doesnt exist, lets create it
-	[[ ! -h ${EROOT}usr/src/linux ]] && MAKELINK=1
+	[[ ! -h ${EROOT%/}/usr/src/linux ]] && MAKELINK=1
 
 	if [[ ${MAKELINK} == 1 ]]; then
-		ln -sf linux-${KV_FULL} "${EROOT}"usr/src/linux || die
+		ln -sf linux-${KV_FULL} "${EROOT%/}"/usr/src/linux || die
 	fi
 
 	# Don't forget to make directory for sysfs
-	[[ ! -d ${EROOT}sys ]] && kernel_is 2 6 && { mkdir "${EROOT}"sys || die ; }
+	[[ ! -d ${EROOT%/}/sys ]] && kernel_is 2 6 && { mkdir "${EROOT%/}"/sys || die ; }
 
-	echo
 	elog "If you are upgrading from a previous kernel, you may be interested"
 	elog "in the following document:"
 	elog "  - General upgrade guide: https://wiki.gentoo.org/wiki/Kernel/Upgrade"
-	echo
 
 	# if K_EXTRAEINFO is set then lets display it now
 	if [[ -n ${K_EXTRAEINFO} ]]; then
 		echo ${K_EXTRAEINFO} | fmt |
-		while read -s ELINE; do	einfo "${ELINE}"; done
+		while read -s ELINE; do einfo "${ELINE}"; done
 	fi
 
 	# if K_EXTRAELOG is set then lets display it now
 	if [[ -n ${K_EXTRAELOG} ]]; then
 		echo ${K_EXTRAELOG} | fmt |
-		while read -s ELINE; do	elog "${ELINE}"; done
+		while read -s ELINE; do elog "${ELINE}"; done
 	fi
 
 	# if K_EXTRAEWARN is set then lets display it now
@@ -1071,12 +1004,10 @@ postinst_sources() {
 	#  And now the general message.
 	if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
 		ewarn "This means that it is likely to be vulnerable to recent security issues."
-		echo
 		ewarn "Upstream kernel developers recommend always running the latest "
 		ewarn "release of any current long term supported Linux kernel version."
 		ewarn "To see a list of these versions, their most current release and "
 		ewarn "long term support status, please go to https://www.kernel.org ."
-		echo
 		ewarn "For specific information on why this kernel is unsupported, please read:"
 		ewarn "https://wiki.gentoo.org/wiki/Project:Kernel_Security"
 	fi
@@ -1085,10 +1016,9 @@ postinst_sources() {
 	KV_MAJOR=$(ver_cut 1 ${OKV})
 	KV_MINOR=$(ver_cut 2 ${OKV})
 	KV_PATCH=$(ver_cut 3 ${OKV})
-	if [[ "$(tc-arch)" = "sparc" ]]; then
+	if [[ $(tc-arch) = sparc ]]; then
 		if [[ $(gcc-major-version) -lt 4 && $(gcc-minor-version) -lt 4 ]]; then
-			if [[ ${KV_MAJOR} -ge 3 ]] || ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -gt 2.6.24 ; then
-				echo
+			if [[ ${KV_MAJOR} -ge 3 ]] || ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -gt 2.6.24; then
 				elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that"
 				elog "you now need to do"
 				elog "  make CROSS_COMPILE=sparc64-unknown-linux-gnu-"
@@ -1096,7 +1026,6 @@ postinst_sources() {
 				elog "  make"
 				elog "to compile the kernel. For more information please browse to"
 				elog "https://bugs.gentoo.org/show_bug.cgi?id=214765"
-				echo
 			fi
 		fi
 	fi
@@ -1112,11 +1041,10 @@ postinst_sources() {
 setup_headers() {
 	[[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/}
 	for i in ${H_SUPPORTEDARCH}; do
-		[[ $(tc-arch) == "${i}" ]] && H_ACCEPT_ARCH="yes"
+		[[ $(tc-arch) == ${i} ]] && H_ACCEPT_ARCH="yes"
 	done
 
-	if [[ ${H_ACCEPT_ARCH} != "yes" ]]; then
-		echo
+	if [[ ${H_ACCEPT_ARCH} != yes ]]; then
 		eerror "This version of ${PN} does not support $(tc-arch)."
 		eerror "Please merge the appropriate sources, in most cases"
 		eerror "(but not all) this will be called $(tc-arch)-headers."
@@ -1139,8 +1067,8 @@ unipatch() {
 	LC_ALL="C"
 	LANG=""
 
-	[ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
-	[ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
+	[[ -z ${KPATCH_DIR} ]] && KPATCH_DIR="${WORKDIR}/patches/"
+	[[ ! -d ${KPATCH_DIR} ]] && mkdir -p ${KPATCH_DIR}
 
 	# We're gonna need it when doing patches with a predefined patchlevel
 	eshopts_push -s extglob
@@ -1155,8 +1083,8 @@ unipatch() {
 
 	#unpack any passed tarballs
 	for i in ${UNIPATCH_LIST}; do
-		if echo ${i} | grep -qs -e "\.tar" -e "\.tbz" -e "\.tgz" ; then
-			if [ -n "${UNIPATCH_STRICTORDER}" ]; then
+		if echo ${i} | grep -qs -e "\.tar" -e "\.tbz" -e "\.tgz"; then
+			if [[ -n ${UNIPATCH_STRICTORDER} ]]; then
 				unset z
 				STRICT_COUNT=$((10#${STRICT_COUNT:=0} + 1))
 				for((y=0; y<$((6 - ${#STRICT_COUNT})); y++));
@@ -1165,16 +1093,16 @@ unipatch() {
 				PATCH_ORDER="${z}${STRICT_COUNT}"
 
 				mkdir -p "${KPATCH_DIR}/${PATCH_ORDER}"
-				pushd "${KPATCH_DIR}/${PATCH_ORDER}" >/dev/null
+				pushd "${KPATCH_DIR}/${PATCH_ORDER}" >/dev/null || die
 				unpack ${i##*/}
-				popd >/dev/null
+				popd >/dev/null || die
 			else
-				pushd "${KPATCH_DIR}" >/dev/null
+				pushd "${KPATCH_DIR}" >/dev/null || die
 				unpack ${i##*/}
-				popd >/dev/null
+				popd >/dev/null || die
 			fi
 
-			[[ ${i} == *:* ]] && echo ">>> Strict patch levels not currently supported for tarballed patchsets"
+			[[ ${i} == *:* ]] && elog ">>> Strict patch levels not currently supported for tarballed patchsets"
 		else
 			extention=${i/*./}
 			extention=${extention/:*/}
@@ -1195,9 +1123,8 @@ unipatch() {
 			x=${i/*\//}
 			x=${x/\.${extention}/}
 
-			if [ -n "${PIPE_CMD}" ]; then
-				if [ ! -r "${i}" ]; then
-					echo
+			if [[ -n ${PIPE_CMD} ]]; then
+				if [[ ! -r ${i} ]]; then
 					eerror "FATAL: unable to locate:"
 					eerror "${i}"
 					eerror "for read-only. The file either has incorrect permissions"
@@ -1205,7 +1132,7 @@ unipatch() {
 					die Unable to locate ${i}
 				fi
 
-				if [ -n "${UNIPATCH_STRICTORDER}" ]; then
+				if [[ -n ${UNIPATCH_STRICTORDER} ]]; then
 					unset z
 					STRICT_COUNT=$((10#${STRICT_COUNT:=0} + 1))
 					for((y=0; y<$((6 - ${#STRICT_COUNT})); y++));
@@ -1222,7 +1149,7 @@ unipatch() {
 		fi
 
 		# If experimental was not chosen by the user, drop experimental patches not in K_EXP_GENPATCHES_LIST.
-		if [[ "${i}" == *"genpatches-"*".experimental."* && -n ${K_EXP_GENPATCHES_PULL} ]] ; then
+		if [[ ${i} == *genpatches-*.experimental.* && -n ${K_EXP_GENPATCHES_PULL} ]]; then
 			if [[ -z ${K_EXP_GENPATCHES_NOUSE} ]] && use experimental; then
 				continue
 			fi
@@ -1230,13 +1157,13 @@ unipatch() {
 			local j
 			for j in ${KPATCH_DIR}/*/50*_*.patch*; do
 				for k in ${K_EXP_GENPATCHES_LIST} ; do
-					[[ "$(basename ${j})" == ${k}* ]] && continue 2
+					[[ $(basename ${j}) == ${k}* ]] && continue 2
 				done
 				UNIPATCH_DROP+=" $(basename ${j})"
 			done
 		else
 			UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
-			debug-print "genpatches tarball: $tarball"
+			debug-print "genpatches tarball: ${tarball}"
 
 			local GCC_MAJOR_VER=$(gcc-major-version)
 			local GCC_MINOR_VER=$(gcc-minor-version)
@@ -1246,7 +1173,7 @@ unipatch() {
 			# 5.12.0 and gcc >= 9  The patch now handles the
 			# gcc version enabled on the system through the Kconfig file as
 			# 'depends'. The legacy section can hopefully be retired in the future
-			# Note the patch for 4.19-5.8 version are the same and the patch for 
+			# Note the patch for 4.19-5.8 version are the same and the patch for
 			# 5.8+ version is the same
 			# eventually we can remove everything except the gcc ver <9 check
 			# based on stablization, time, kernel removals or a combo of all three
@@ -1267,23 +1194,23 @@ unipatch() {
 				# optimization patch for gcc < 8.X and kernel > 4.13 and <  4.19
 			elif kernel_is ge 4 13; then
 				UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
-				if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ ${GCC_MAJOR_VER} -gt 4 ]]; then
+				if [[ ${GCC_MAJOR_VER} -lt 8 && ${GCC_MAJOR_VER} -gt 4 ]]; then
 					UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
 					UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
 					UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
 				# optimization patch for gcc >= 8 and kernel ge 4.13
-				elif [[ "${GCC_MAJOR_VER}" -eq 8 ]]; then
+				elif [[ ${GCC_MAJOR_VER} -eq 8 ]]; then
 					# support old kernels for a period. For now, remove as all gcc versions required are masked
 					UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
 					UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
 					UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
 					UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
-				elif [[ "${GCC_MAJOR_VER}" -eq 9 ]] && [[ ${GCC_MINOR_VER} -ge 1 ]]; then
+				elif [[ ${GCC_MAJOR_VER} -eq 9 && ${GCC_MINOR_VER} -ge 1 ]]; 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"
 					UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
-				elif [[ "${GCC_MAJOR_VER}" -eq 10 ]] && [[ ${GCC_MINOR_VER} -ge 1 ]]; then
+				elif [[ ${GCC_MAJOR_VER} -eq 10 && ${GCC_MINOR_VER} -ge 1 ]]; 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"
@@ -1313,21 +1240,6 @@ unipatch() {
 		KPATCH_DIR="${KPATCH_DIR} ${i}"
 	done
 
-	# do not apply fbcondecor patch to sparc/sparc64 as it breaks boot
-	# bug #272676
-	if [[ "$(tc-arch)" = "sparc" || "$(tc-arch)" = "sparc64" ]]; then
-		if [[ ${KV_MAJOR} -ge 3 ]] || ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -gt 2.6.28 ; then
-			if [[ ! -z ${K_WANT_GENPATCHES} ]] ; then
-				UNIPATCH_DROP="${UNIPATCH_DROP} *_fbcondecor*.patch"
-				echo
-				ewarn "fbcondecor currently prevents sparc/sparc64 from booting"
-				ewarn "for kernel versions >= 2.6.29. Removing fbcondecor patch."
-				ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=272676 for details"
-				echo
-			fi
-		fi
-	fi
-
 	#so now lets get rid of the patchno's we want to exclude
 	UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
 	for i in ${UNIPATCH_DROP}; do
@@ -1342,14 +1254,14 @@ unipatch() {
 			STDERR_T="${T}/${i/*\//}"
 			STDERR_T="${STDERR_T/.patch*/.err}"
 
-			[ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/}
-			#[ -z ${i/*.diff*/} ]  && PATCH_DEPTH=${i/*.diff/}
+			[[ -z ${i/*.patch*/} ]] && PATCH_DEPTH=${i/*.patch/}
+			#[[ -z ${i/*.diff*/} ]]  && PATCH_DEPTH=${i/*.diff/}
 
-			if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi
+			if [[ -z ${PATCH_DEPTH} ]]; then PATCH_DEPTH=0; fi
 
 			####################################################################
-			# IMPORTANT: This code is to support kernels which cannot be	   #
-			# tested with the --dry-run parameter									   #	
+			# IMPORTANT: This code is to support kernels which cannot be       #
+			# tested with the --dry-run parameter                              #
 			#                                                                  #
 			# These patches contain a removal of a symlink, followed by        #
 			# addition of a file with the same name as the symlink in the      #
@@ -1357,9 +1269,10 @@ unipatch() {
 			#                                                                  #
 			# https://bugs.gentoo.org/show_bug.cgi?id=507656                   #
 			####################################################################
-			if [[ -n ${K_NODRYRUN} ]] ; then
+			if [[ -n ${K_NODRYRUN} ]]; then
 				ebegin "Applying ${i/*\//} (-p1)"
-				if [ $(patch -p1 --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}) "$?" -le 2 ]; then
+				patch -p1 --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}
+				if [[ $? -le 2 ]]; then
 					eend 0
 					rm ${STDERR_T} || die
 				else
@@ -1372,16 +1285,18 @@ unipatch() {
 			fi
 			####################################################################
 
-			while [ ${PATCH_DEPTH} -lt 5 ] && [ -z ${K_NODRYRUN} ]; do
+			while [[ ${PATCH_DEPTH} -lt 5 && -z ${K_NODRYRUN} ]]; do
 				echo "Attempting Dry-run:" >> ${STDERR_T}
 				echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i}" >> ${STDERR_T}
 				echo "=======================================================" >> ${STDERR_T}
-				if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]; then
+				patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i} >> ${STDERR_T}
+				if [[ $? -eq 0 ]]; then
 					ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH})"
 					echo "Attempting patch:" > ${STDERR_T}
 					echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i}" >> ${STDERR_T}
 					echo "=======================================================" >> ${STDERR_T}
-					if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]; then
+					patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}
+					if [[ $? -eq 0 ]]; then
 						eend 0
 						rm ${STDERR_T} || die
 						break
@@ -1396,7 +1311,7 @@ unipatch() {
 					PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
 				fi
 			done
-			if [ ${PATCH_DEPTH} -eq 5 ]; then
+			if [[ ${PATCH_DEPTH} -eq 5 ]]; then
 				eerror "Failed to dry-run patch ${i/*\//}"
 				eerror "Please attach ${STDERR_T} to any bug you may post."
 				eshopts_pop
@@ -1407,7 +1322,7 @@ unipatch() {
 
 	# When genpatches is used, we want to install 0000_README which documents
 	# the patches that were used; such that the user can see them, bug #301478.
-	if [[ ! -z ${K_WANT_GENPATCHES} ]] ; then
+	if [[ ! -z ${K_WANT_GENPATCHES} ]]; then
 		UNIPATCH_DOCS="${UNIPATCH_DOCS} 0000_README"
 	fi
 
@@ -1417,7 +1332,7 @@ unipatch() {
 	local tmp
 	for x in ${KPATCH_DIR}; do
 		for i in ${UNIPATCH_DOCS}; do
-			if [[ -f ${x}/${i} ]] ; then
+			if [[ -f ${x}/${i} ]]; then
 				tmp="${tmp} ${i}"
 				cp -f "${x}/${i}" "${T}"/ || die
 			fi
@@ -1439,22 +1354,18 @@ unipatch() {
 # pulled from linux-info
 
 getfilevar() {
-	local workingdir basefname basedname xarch=$(tc-arch-kernel)
+	local basefname basedname xarch=$(tc-arch-kernel)
 
-	if [[ -z ${1} ]] && [[ ! -f ${2} ]]; then
-		echo -e "\n"
+	if [[ -z ${1} && ! -f ${2} ]]; then
 		eerror "getfilevar requires 2 variables, with the second a valid file."
 		eerror "   getfilevar <VARIABLE> <CONFIGFILE>"
 	else
-		workingdir=${PWD}
 		basefname=$(basename ${2})
 		basedname=$(dirname ${2})
 		unset ARCH
 
-		cd ${basedname}
-		echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" | \
-			make ${BUILD_FIXES} -s -f - e 2>/dev/null
-		cd ${workingdir}
+		echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" |
+			make -C "${basedname}" ${BUILD_FIXES} -s -f - e 2>/dev/null
 
 		ARCH=${xarch}
 	fi
@@ -1468,7 +1379,6 @@ getfilevar() {
 # patchsets.
 
 detect_arch() {
-
 	local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
 
 	# COMPAT_URI is the contents of ${ARCH}_URI
@@ -1542,18 +1452,9 @@ kernel-2_src_unpack() {
 
 	# Setup xmakeopts and cd into sourcetree.
 	env_setup_xmakeopts
-	cd "${S}"
-
-	# We dont need a version.h for anything other than headers
-	# at least, I should hope we dont. If this causes problems
-	# take out the if/fi block and inform me please.
-	# unpack_2_6 should now be 2.6.17 safe anyways
-	if [[ ${ETYPE} == headers ]]; then
-		kernel_is 2 4 && unpack_2_4
-		kernel_is 2 6 && unpack_2_6
-	fi
+	cd "${S}" || die
 
-	if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
+	if [[ ${K_DEBLOB_AVAILABLE} == 1 ]] && use deblob; then
 		cp "${DISTDIR}/${DEBLOB_A}" "${T}" || die "cp ${DEBLOB_A} failed"
 		cp "${DISTDIR}/${DEBLOB_CHECK_A}" "${T}/deblob-check" || die "cp ${DEBLOB_CHECK_A} failed"
 		chmod +x "${T}/${DEBLOB_A}" "${T}/deblob-check" || die "chmod deblob scripts failed"
@@ -1562,7 +1463,7 @@ kernel-2_src_unpack() {
 	# fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
 	# only do this for kernel < 2.6.27 since this file does not exist in later
 	# kernels
-	if [[ -n ${KV_MINOR} ]] && ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -lt 2.6.27 ; then
+	if [[ -n ${KV_MINOR} ]] && ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -lt 2.6.27; then
 		sed -i \
 			-e 's|TOUT      := .tmp_gas_check|TOUT  := $(T).tmp_gas_check|' \
 			"${S}"/arch/ppc/Makefile
@@ -1579,14 +1480,8 @@ kernel-2_src_unpack() {
 # Apply any user patches
 
 kernel-2_src_prepare() {
-
 	debug-print "Applying any user patches"
-
-	# apply any user patches
-	case ${EAPI:-0} in
-		0|1|2|3|4|5) epatch_user ;;
-		6) eapply_user ;;
-	esac
+	eapply_user
 }
 
 # @FUNCTION: kernel-2_src_compile
@@ -1595,11 +1490,11 @@ kernel-2_src_prepare() {
 # conpile headers or run deblob script
 
 kernel-2_src_compile() {
-	cd "${S}"
+	cd "${S}" || die
 	[[ ${ETYPE} == headers ]] && compile_headers
 
-	if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
-		echo ">>> Running deblob script ..."
+	if [[ ${K_DEBLOB_AVAILABLE} == 1 ]] && use deblob; then
+		elog ">>> Running deblob script ..."
 		python_setup
 		sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
 	fi
@@ -1651,27 +1546,15 @@ kernel-2_pkg_postinst() {
 # if necessary
 
 kernel-2_pkg_setup() {
-	if kernel_is 2 4; then
-		if [[ $(gcc-major-version) -ge 4 ]] ; then
-			echo
-			ewarn "Be warned !! >=sys-devel/gcc-4.0.0 isn't supported with linux-2.4!"
-			ewarn "Either switch to another gcc-version (via gcc-config) or use a"
-			ewarn "newer kernel that supports >=sys-devel/gcc-4."
-			echo
-			ewarn "Also, be aware that bug reports about gcc-4 not working"
-			ewarn "with linux-2.4 based ebuilds will be closed as INVALID!"
-			echo
-		fi
-	fi
 
 	ABI="${KERNEL_ABI}"
-	if [[ ${ETYPE} != sources ]] && [[ ${ETYPE} != headers ]]; then
+	if [[ ${ETYPE} != sources && ${ETYPE} != headers ]]; then
 		eerror "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
 		die "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
 	fi
 
 	[[ ${ETYPE} == headers ]] && setup_headers
-	[[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..."
+	[[ ${ETYPE} == sources ]] && elog ">>> Preparing to unpack ..."
 }
 
 # @FUNCTION: kernel-2_pkg_postrm
@@ -1685,15 +1568,12 @@ kernel-2_pkg_postrm() {
 	[[ ${ETYPE} == headers ]] && return 0
 
 	# If there isn't anything left behind, then don't complain.
-	[[ -e ${EROOT}usr/src/linux-${KV_FULL} ]] || return 0
-	echo
+	[[ -e ${EROOT%/}/usr/src/linux-${KV_FULL} ]] || return 0
 	ewarn "Note: Even though you have successfully unmerged "
 	ewarn "your kernel package, directories in kernel source location: "
-	ewarn "${EROOT}usr/src/linux-${KV_FULL}"
+	ewarn "${EROOT%/}/usr/src/linux-${KV_FULL}"
 	ewarn "with modified files will remain behind. By design, package managers"
 	ewarn "will not remove these modified files and the directories they reside in."
-	echo
 	ewarn "For more detailed kernel removal instructions, please see: "
 	ewarn "https://wiki.gentoo.org/wiki/Kernel/Removal"
-	echo
 }
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index d87d61f44ae4..0acc490452f2 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -54,7 +54,7 @@ EXPORT_FUNCTIONS src_configure src_compile src_test src_install
 if [[ -z ${_MESON_ECLASS} ]]; then
 _MESON_ECLASS=1
 
-MESON_DEPEND=">=dev-util/meson-0.54.0
+MESON_DEPEND=">=dev-util/meson-0.56.0
 	>=dev-util/ninja-1.8.2
 	dev-util/meson-format-array
 "
@@ -180,7 +180,7 @@ _meson_create_cross_file() {
 	strip = $(_meson_env_array "$(tc-getSTRIP)")
 	windres = $(_meson_env_array "$(tc-getRC)")
 
-	[properties]
+	[built-in options]
 	c_args = $(_meson_env_array "${CFLAGS} ${CPPFLAGS}")
 	c_link_args = $(_meson_env_array "${CFLAGS} ${LDFLAGS}")
 	cpp_args = $(_meson_env_array "${CXXFLAGS} ${CPPFLAGS}")
@@ -191,6 +191,8 @@ _meson_create_cross_file() {
 	objc_link_args = $(_meson_env_array "${OBJCFLAGS} ${LDFLAGS}")
 	objcpp_args = $(_meson_env_array "${OBJCXXFLAGS} ${CPPFLAGS}")
 	objcpp_link_args = $(_meson_env_array "${OBJCXXFLAGS} ${LDFLAGS}")
+
+	[properties]
 	needs_exe_wrapper = true
 	sys_root = '${SYSROOT}'
 	pkg_config_libdir = '${PKG_CONFIG_LIBDIR:-${EPREFIX}/usr/$(get_libdir)/pkgconfig}'
@@ -232,7 +234,7 @@ _meson_create_native_file() {
 	strip = $(_meson_env_array "$(tc-getBUILD_STRIP)")
 	windres = $(_meson_env_array "$(tc-getBUILD_PROG RC windres)")
 
-	[properties]
+	[built-in options]
 	c_args = $(_meson_env_array "${BUILD_CFLAGS} ${BUILD_CPPFLAGS}")
 	c_link_args = $(_meson_env_array "${BUILD_CFLAGS} ${BUILD_LDFLAGS}")
 	cpp_args = $(_meson_env_array "${BUILD_CXXFLAGS} ${BUILD_CPPFLAGS}")
@@ -243,6 +245,8 @@ _meson_create_native_file() {
 	objc_link_args = $(_meson_env_array "${BUILD_OBJCFLAGS} ${BUILD_LDFLAGS}")
 	objcpp_args = $(_meson_env_array "${BUILD_OBJCXXFLAGS} ${BUILD_CPPFLAGS}")
 	objcpp_link_args = $(_meson_env_array "${BUILD_OBJCXXFLAGS} ${BUILD_LDFLAGS}")
+
+	[properties]
 	needs_exe_wrapper = false
 	pkg_config_libdir = '${BUILD_PKG_CONFIG_LIBDIR:-${EPREFIX}/usr/$(get_libdir)/pkgconfig}'
 
diff --git a/eclass/nsplugins.eclass b/eclass/nsplugins.eclass
deleted file mode 100644
index b4dd39e7493b..000000000000
--- a/eclass/nsplugins.eclass
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-#
-# @DEAD
-# @ECLASS: nsplugins.eclass
-# @MAINTAINER:
-# Mozilla Team <mozilla@gentoo.org>
-# @AUTHOR:
-# Original Author: Martin Schlemmer <azarah@gentoo.org>
-# @BLURB: reusable functions for netscape/moz plugin sharing
-# @DESCRIPTION:
-# Reusable functions that promote sharing of netscape/moz plugins, also provides
-# share_plugins_dir function for mozilla applications.
-
-inherit eutils multilib versionator mozextension
-
-PLUGINS_DIR="nsbrowser/plugins"
-
-# This function move the plugin dir in src_install() to
-# ${D}/usr/$(get_libdir)/${PLUGIN_DIR}.  First argument should be
-# the full path (without $D) to old plugin dir.
-src_mv_plugins() {
-	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
-
-	# Move plugins dir.  We use keepdir so that it might not be unmerged
-	# by mistake ...
-	keepdir /usr/$(get_libdir)/${PLUGINS_DIR}
-	cp -a "${ED}"/$1/* "${ED}"/usr/$(get_libdir)/${PLUGINS_DIR}
-	rm -rf "${ED}"/$1
-	dosym /usr/$(get_libdir)/${PLUGINS_DIR} $1
-}
-
-# This function move plugins in pkg_preinst() in old dir to
-# ${ROOT}/usr/$(get_libdir)/${PLUGIN_DIR}.  First argument should be
-# the full path (without $ROOT) to old plugin dir.
-pkg_mv_plugins() {
-	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${ROOT}"
-
-	# Move old plugins dir
-	if [ -d "${ROOT}/$1" -a ! -L "${ROOT}/$1" ]
-	then
-		mkdir -p "${EROOT}"/usr/$(get_libdir)/${PLUGINS_DIR}
-		cp -a "${EROOT}"/$1/* "${EROOT}"/usr/$(get_libdir)/${PLUGINS_DIR}
-		rm -rf "${EROOT}"/$1
-	fi
-}
-
-# This function installs a plugin with dosym to PLUGINS_DIR.
-# First argument should be the plugin file.
-inst_plugin() {
-	if [[ -z "${1}" ]]; then
-		eerror "The plugin file \"${1}\" does not exist."
-		die "No such file or directory."
-	fi
-
-	dodir /usr/$(get_libdir)/${PLUGINS_DIR}
-	dosym ${1} /usr/$(get_libdir)/${PLUGINS_DIR}/$(basename ${1})
-}
-
-# This function ensures we use proper plugin path for Gentoo.
-# This should only be used by mozilla packages.
-# ${MOZILLA_FIVE_HOME} must be defined in src_install to support
-share_plugins_dir() {
-	if [[ ${PN} == seamonkey ]] ; then
-		rm -rf "${D}"${MOZILLA_FIVE_HOME}/plugins \
-			|| die "failed to remove existing plugins dir"
-	fi
-
-	if [[ ${PN} == *-bin ]] ; then
-		PLUGIN_BASE_PATH="/usr/$(get_libdir)"
-	else
-		PLUGIN_BASE_PATH=".."
-	fi
-
-	if $(mozversion_extension_location) ; then
-		dosym "${PLUGIN_BASE_PATH}/nsbrowser/plugins" "${MOZILLA_FIVE_HOME}/browser/plugins"
-	else
-		dosym "${PLUGIN_BASE_PATH}/nsbrowser/plugins" "${MOZILLA_FIVE_HOME}/plugins"
-	fi
-}
-- 
cgit v1.2.3