edos2unix.eclass: New eclass, split off from eutils.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
This commit is contained in:
Ulrich Müller
2020-09-09 17:16:27 +02:00
parent db20484e0e
commit 80f9e1b405
2 changed files with 24 additions and 15 deletions

21
eclass/edos2unix.eclass Normal file
View File

@@ -0,0 +1,21 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: edos2unix.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @BLURB: convert files from DOS CRLF to UNIX LF line endings
# @FUNCTION: edos2unix
# @USAGE: <file> [more files ...]
# @DESCRIPTION:
# A handy replacement for dos2unix, recode, fixdos, etc... This allows
# you to remove all of these text utilities from DEPEND variables
# because this is a script based solution. Just give it a list of files
# to convert and they will all be changed from the DOS CRLF format to
# the UNIX LF format.
edos2unix() {
[[ $# -eq 0 ]] && return 0
sed -i 's/\r$//' -- "$@" || die
}

View File

@@ -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: