Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: "Ulrich Müller" <ulm@g.o>
Subject: [gentoo-dev] [PATCH 2/8] edos2unix.eclass: New eclass, split off from eutils.
Date: Thu, 10 Sep 2020 19:09:46
Message-Id: 20200910190834.17560-3-ulm@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/8] Split off remaining functions from eutils.eclass by "Ulrich Müller"
1 Signed-off-by: Ulrich Müller <ulm@g.o>
2 ---
3 eclass/edos2unix.eclass | 21 +++++++++++++++++++++
4 eclass/eutils.eclass | 18 +++---------------
5 2 files changed, 24 insertions(+), 15 deletions(-)
6 create mode 100644 eclass/edos2unix.eclass
7
8 diff --git a/eclass/edos2unix.eclass b/eclass/edos2unix.eclass
9 new file mode 100644
10 index 000000000000..8b774844cb8a
11 --- /dev/null
12 +++ b/eclass/edos2unix.eclass
13 @@ -0,0 +1,21 @@
14 +# Copyright 1999-2020 Gentoo Authors
15 +# Distributed under the terms of the GNU General Public License v2
16 +
17 +# @ECLASS: edos2unix.eclass
18 +# @MAINTAINER:
19 +# base-system@g.o
20 +# @BLURB: convert files from DOS CRLF to UNIX LF line endings
21 +
22 +# @FUNCTION: edos2unix
23 +# @USAGE: <file> [more files ...]
24 +# @DESCRIPTION:
25 +# A handy replacement for dos2unix, recode, fixdos, etc... This allows
26 +# you to remove all of these text utilities from DEPEND variables
27 +# because this is a script based solution. Just give it a list of files
28 +# to convert and they will all be changed from the DOS CRLF format to
29 +# the UNIX LF format.
30 +
31 +edos2unix() {
32 + [[ $# -eq 0 ]] && return 0
33 + sed -i 's/\r$//' -- "$@" || die
34 +}
35 diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
36 index f74074fb4f16..3b3e328ba30d 100644
37 --- a/eclass/eutils.eclass
38 +++ b/eclass/eutils.eclass
39 @@ -21,10 +21,10 @@ _EUTILS_ECLASS=1
40 # implicitly inherited (now split) eclasses
41 case ${EAPI:-0} in
42 0|1|2|3|4|5|6)
43 - inherit desktop epatch estack ltprune multilib preserve-libs \
44 - toolchain-funcs vcs-clean
45 + inherit desktop edos2unix epatch estack ltprune multilib \
46 + preserve-libs toolchain-funcs vcs-clean
47 ;;
48 - 7) ;;
49 + 7) inherit edos2unix ;;
50 *) die "${ECLASS} is banned in EAPI ${EAPI}" ;;
51 esac
52
53 @@ -63,18 +63,6 @@ emktemp() {
54 fi
55 }
56
57 -# @FUNCTION: edos2unix
58 -# @USAGE: <file> [more files ...]
59 -# @DESCRIPTION:
60 -# A handy replacement for dos2unix, recode, fixdos, etc... This allows you
61 -# to remove all of these text utilities from DEPEND variables because this
62 -# is a script based solution. Just give it a list of files to convert and
63 -# they will all be changed from the DOS CRLF format to the UNIX LF format.
64 -edos2unix() {
65 - [[ $# -eq 0 ]] && return 0
66 - sed -i 's/\r$//' -- "$@" || die
67 -}
68 -
69 # @FUNCTION: strip-linguas
70 # @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
71 # @DESCRIPTION:
72 --
73 2.28.0