1 |
The edos2unix is quite useful when handling DOS-sourced packages. |
2 |
But since it's a bash function, you can't reasonably use it from within |
3 |
find invocation. And often you hit packages which are all flooded with |
4 |
CRLFs that you need to convert. |
5 |
|
6 |
That's why I'm suggesting to make edos2unix recursive. The posted patch |
7 |
changes the function to use find+sed for the substitution, passing given |
8 |
paths as the 'path' arguments to find. |
9 |
|
10 |
Whenever files are passed, nothing changes for ebuilds. If a directory |
11 |
is passed, find converts it recursively. The only potential breakage is |
12 |
when a non-file was passed and something weird was expected of it. |
13 |
|
14 |
Any thoughts? If nobody opposes, I will commit the patch in 7 days. |
15 |
|
16 |
--- |
17 |
gx86/eclass/eutils.eclass | 9 +++++---- |
18 |
1 file changed, 5 insertions(+), 4 deletions(-) |
19 |
|
20 |
diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass |
21 |
index 467cf17..9e3a347 100644 |
22 |
--- a/gx86/eclass/eutils.eclass |
23 |
+++ b/gx86/eclass/eutils.eclass |
24 |
@@ -651,15 +651,16 @@ emktemp() { |
25 |
} |
26 |
|
27 |
# @FUNCTION: edos2unix |
28 |
-# @USAGE: <file> [more files ...] |
29 |
+# @USAGE: <path> [...] |
30 |
# @DESCRIPTION: |
31 |
# A handy replacement for dos2unix, recode, fixdos, etc... This allows you |
32 |
# to remove all of these text utilities from DEPEND variables because this |
33 |
-# is a script based solution. Just give it a list of files to convert and |
34 |
-# they will all be changed from the DOS CRLF format to the UNIX LF format. |
35 |
+# is a script based solution. Just give it a list of files or directories |
36 |
+# to convert and they will all be changed from the DOS CRLF format |
37 |
+# to the UNIX LF format recursively. |
38 |
edos2unix() { |
39 |
[[ $# -eq 0 ]] && return 0 |
40 |
- sed -i 's/\r$//' -- "$@" || die |
41 |
+ find "$@" -type f -exec sed -i 's/\r$//' -- {} + || die |
42 |
} |
43 |
|
44 |
# @FUNCTION: make_desktop_entry |
45 |
-- |
46 |
1.8.1.5 |