Signed-off-by: Ulrich Müller <u...@gentoo.org> --- eclass/edos2unix.eclass | 21 +++++++++++++++++++++ eclass/eutils.eclass | 18 +++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 eclass/edos2unix.eclass
diff --git a/eclass/edos2unix.eclass b/eclass/edos2unix.eclass new file mode 100644 index 000000000000..8b774844cb8a --- /dev/null +++ b/eclass/edos2unix.eclass @@ -0,0 +1,21 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: edos2unix.eclass +# @MAINTAINER: +# base-sys...@gentoo.org +# @BLURB: convert files from DOS CRLF to UNIX LF line endings + +# @FUNCTION: edos2unix +# @USAGE: <file> [more files ...] +# @DESCRIPTION: +# A handy replacement for dos2unix, recode, fixdos, etc... This allows +# you to remove all of these text utilities from DEPEND variables +# because this is a script based solution. Just give it a list of files +# to convert and they will all be changed from the DOS CRLF format to +# the UNIX LF format. + +edos2unix() { + [[ $# -eq 0 ]] && return 0 + sed -i 's/\r$//' -- "$@" || die +} diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index f74074fb4f16..3b3e328ba30d 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -21,10 +21,10 @@ _EUTILS_ECLASS=1 # implicitly inherited (now split) eclasses case ${EAPI:-0} in 0|1|2|3|4|5|6) - inherit desktop epatch estack ltprune multilib preserve-libs \ - toolchain-funcs vcs-clean + inherit desktop edos2unix epatch estack ltprune multilib \ + preserve-libs toolchain-funcs vcs-clean ;; - 7) ;; + 7) inherit edos2unix ;; *) die "${ECLASS} is banned in EAPI ${EAPI}" ;; esac @@ -63,18 +63,6 @@ emktemp() { fi } -# @FUNCTION: edos2unix -# @USAGE: <file> [more files ...] -# @DESCRIPTION: -# A handy replacement for dos2unix, recode, fixdos, etc... This allows you -# to remove all of these text utilities from DEPEND variables because this -# is a script based solution. Just give it a list of files to convert and -# they will all be changed from the DOS CRLF format to the UNIX LF format. -edos2unix() { - [[ $# -eq 0 ]] && return 0 - sed -i 's/\r$//' -- "$@" || die -} - # @FUNCTION: strip-linguas # @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>] # @DESCRIPTION: -- 2.28.0