eclass/portability: Sync with gentoo

It's from gentoo commit 5eae2995e46c6dc23f85bd0839eb9a1028ebea91.
This commit is contained in:
Krzesimir Nowak 2022-02-17 11:31:51 +01:00
parent d692f0b456
commit c6a76af95b

View File

@ -1,4 +1,4 @@
# Copyright 1999-2014 Gentoo Foundation
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: portability.eclass
@ -6,14 +6,19 @@
# base-system@gentoo.org
# @AUTHOR:
# Diego Pettenò <flameeyes@gentoo.org>
# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: This eclass is created to avoid using non-portable GNUisms inside ebuilds
case ${EAPI:-0} in
[567]) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_PORTABILITY_ECLASS} ]]; then
_PORTABILITY_ECLASS=1
# @FUNCTION: treecopy
# @USAGE: <orig1> [orig2 orig3 ....] <dest>
# @RETURN:
# @DESCRIPTION:
# mimic cp --parents copy, but working on BSD userland as well
treecopy() {
@ -67,8 +72,8 @@ seq() {
# Screw it, do the output ourselves
while :; do
[[ $max < $min && $step > 0 ]] && break
[[ $min < $max && $step < 0 ]] && break
[[ $max -lt $min && $step -gt 0 ]] && break
[[ $min -lt $max && $step -gt 0 ]] && break
echo $min
: $(( min += step ))
done
@ -118,7 +123,6 @@ get_bmake() {
# @FUNCTION: get_mounts
# @USAGE:
# @RETURN: table of mounts in form "point node fs opts"
# @MAINTAINER:
# @DESCRIPTION:
# Portable method of getting mount names and points.
# Returns as "point node fs options"