1 |
Currently the return status of e{cvs,svn,git}_clean is not at all |
2 |
reliable, because only the last command in the pipeline is tested. |
3 |
In addition, there are two pipelines in ecvs_clean, and the exit |
4 |
status of the first one is completely ignored. |
5 |
|
6 |
Another issue is that xargs -0 is an extension not specified by POSIX. |
7 |
See patch included below, fixing both problems. (Note that this is |
8 |
close to the implementation originally proposed in bug 210708 [1].) |
9 |
|
10 |
Should we take this as an opportunity to split off these three |
11 |
functions into their own eclass, e.g. vcs-clean.eclass? |
12 |
|
13 |
Ulrich |
14 |
|
15 |
[1] https://bugs.gentoo.org/210708 |
16 |
|
17 |
|
18 |
From 83c0afbfb4ef0c501c65dcd8e0c9c8bd30cdd70a Mon Sep 17 00:00:00 2001 |
19 |
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@g.o> |
20 |
Date: Fri, 16 Feb 2018 07:47:46 +0100 |
21 |
Subject: [PATCH] eutils.eclass: More reliable return status for e*_clean. |
22 |
|
23 |
In ecvs_clean, combine the two find commands into one, so that the |
24 |
exit status of the first one won't be ignored. |
25 |
|
26 |
Also use find -exec rather then find | xargs, so we don't have to |
27 |
check the exit status of all commands in the pipeline. |
28 |
--- |
29 |
eclass/eutils.eclass | 8 ++++---- |
30 |
1 file changed, 4 insertions(+), 4 deletions(-) |
31 |
|
32 |
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
33 |
index 8bbd561015ad..bce8cf1c2610 100644 |
34 |
--- a/eclass/eutils.eclass |
35 |
+++ b/eclass/eutils.eclass |
36 |
@@ -44,8 +44,8 @@ fi |
37 |
# internal CVS directories. Defaults to $PWD. |
38 |
ecvs_clean() { |
39 |
[[ $# -eq 0 ]] && set -- . |
40 |
- find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf |
41 |
- find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf |
42 |
+ find "$@" \( -type d -name 'CVS' -prune -o -type f -name '.cvs*' \) \ |
43 |
+ -exec rm -rf '{}' \+ |
44 |
} |
45 |
|
46 |
# @FUNCTION: esvn_clean |
47 |
@@ -55,7 +55,7 @@ ecvs_clean() { |
48 |
# internal Subversion directories. Defaults to $PWD. |
49 |
esvn_clean() { |
50 |
[[ $# -eq 0 ]] && set -- . |
51 |
- find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf |
52 |
+ find "$@" -type d -name '.svn' -prune -exec rm -rf '{}' \+ |
53 |
} |
54 |
|
55 |
# @FUNCTION: egit_clean |
56 |
@@ -65,7 +65,7 @@ esvn_clean() { |
57 |
# contains internal Git directories. Defaults to $PWD. |
58 |
egit_clean() { |
59 |
[[ $# -eq 0 ]] && set -- . |
60 |
- find "$@" -type d -name '.git*' -prune -print0 | xargs -0 rm -rf |
61 |
+ find "$@" -type d -name '.git*' -prune -exec rm -rf '{}' \+ |
62 |
} |
63 |
|
64 |
# @FUNCTION: emktemp |
65 |
-- |
66 |
2.16.1 |