1 |
vapier 13/09/29 22:19:39 |
2 |
|
3 |
Modified: qdepends.c |
4 |
Log: |
5 |
qdepends: warn if no matches were found #459970 |
6 |
|
7 |
Revision Changes Path |
8 |
1.66 portage-utils/qdepends.c |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?rev=1.66&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?rev=1.66&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?r1=1.65&r2=1.66 |
13 |
|
14 |
Index: qdepends.c |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v |
17 |
retrieving revision 1.65 |
18 |
retrieving revision 1.66 |
19 |
diff -u -r1.65 -r1.66 |
20 |
--- qdepends.c 29 Sep 2013 10:36:08 -0000 1.65 |
21 |
+++ qdepends.c 29 Sep 2013 22:19:39 -0000 1.66 |
22 |
@@ -1,7 +1,7 @@ |
23 |
/* |
24 |
* Copyright 2005-2013 Gentoo Foundation |
25 |
* Distributed under the terms of the GNU General Public License v2 |
26 |
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.65 2013/09/29 10:36:08 vapier Exp $ |
27 |
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.66 2013/09/29 22:19:39 vapier Exp $ |
28 |
* |
29 |
* Copyright 2005-2010 Ned Ludd - <solar@g.o> |
30 |
* Copyright 2005-2013 Mike Frysinger - <vapier@g.o> |
31 |
@@ -32,7 +32,7 @@ |
32 |
"Pretty format specified depend strings", |
33 |
COMMON_OPTS_HELP |
34 |
}; |
35 |
-static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.65 2013/09/29 10:36:08 vapier Exp $"; |
36 |
+static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.66 2013/09/29 22:19:39 vapier Exp $"; |
37 |
#define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends")) |
38 |
|
39 |
static char qdep_name_only = 0; |
40 |
@@ -465,7 +465,7 @@ |
41 |
|
42 |
dep_burn_tree(dep_tree); |
43 |
|
44 |
- return EXIT_SUCCESS; |
45 |
+ return 1; |
46 |
} |
47 |
|
48 |
_q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv) |
49 |
@@ -523,7 +523,7 @@ |
50 |
} |
51 |
dep_burn_tree(dep_tree); |
52 |
|
53 |
- return EXIT_SUCCESS; |
54 |
+ return 1; |
55 |
} |
56 |
|
57 |
int qdepends_main(int argc, char **argv) |
58 |
@@ -533,7 +533,7 @@ |
59 |
.argv = argv, |
60 |
}; |
61 |
q_vdb_pkg_cb *cb; |
62 |
- int i; |
63 |
+ int i, ret; |
64 |
bool do_format = false; |
65 |
const char *query = NULL; |
66 |
const char *depend_file; |
67 |
@@ -576,16 +576,18 @@ |
68 |
cb = query ? qdepends_vdb_deep_cb : qdepends_main_vdb_cb; |
69 |
|
70 |
if (!depend_file) { |
71 |
- int ret = 0; |
72 |
+ ret = 0; |
73 |
for (i = 0; depend_files[i]; ++i) { |
74 |
printf(" %s*%s %s\n", GREEN, NORM, depend_files[i]); |
75 |
state.depend_file = depend_files[i]; |
76 |
- ret += q_vdb_foreach_pkg(cb, &state, NULL); |
77 |
+ ret |= q_vdb_foreach_pkg(cb, &state, NULL); |
78 |
} |
79 |
- return ret; |
80 |
- } |
81 |
+ } else |
82 |
+ ret = q_vdb_foreach_pkg(cb, &state, NULL); |
83 |
|
84 |
- return q_vdb_foreach_pkg(cb, &state, NULL); |
85 |
+ if (!ret && !quiet) |
86 |
+ warn("no matches found for your query"); |
87 |
+ return ret ? EXIT_SUCCESS : EXIT_FAILURE; |
88 |
} |
89 |
|
90 |
#else |