Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-projects commit in portage-utils: main.c qmerge.c
Date: Mon, 21 Feb 2011 06:20:34
Message-Id: 20110221062024.A7F6320054@flycatcher.gentoo.org
1 vapier 11/02/21 06:20:24
2
3 Modified: main.c qmerge.c
4 Log:
5 have unmerges prompt with a summary first
6
7 Revision Changes Path
8 1.181 portage-utils/main.c
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/main.c?rev=1.181&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/main.c?rev=1.181&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/main.c?r1=1.180&r2=1.181
13
14 Index: main.c
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-projects/portage-utils/main.c,v
17 retrieving revision 1.180
18 retrieving revision 1.181
19 diff -u -r1.180 -r1.181
20 --- main.c 21 Feb 2011 01:33:47 -0000 1.180
21 +++ main.c 21 Feb 2011 06:20:24 -0000 1.181
22 @@ -1,7 +1,7 @@
23 /*
24 * Copyright 2005-2008 Gentoo Foundation
25 * Distributed under the terms of the GNU General Public License v2
26 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.180 2011/02/21 01:33:47 vapier Exp $
27 + * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.181 2011/02/21 06:20:24 vapier Exp $
28 *
29 * Copyright 2005-2008 Ned Ludd - <solar@g.o>
30 * Copyright 2005-2008 Mike Frysinger - <vapier@g.o>
31 @@ -203,6 +203,20 @@
32 return ret;
33 }
34
35 +static bool prompt(const char *p)
36 +{
37 + printf("%s? [Y/n] ", p);
38 + fflush(stdout);
39 + switch (getc(stdin)) {
40 + case '\n':
41 + case 'y':
42 + case 'Y':
43 + return true;
44 + default:
45 + return false;
46 + }
47 +}
48 +
49 /* if all chars in str1 coincide with the begining of the str2 return 0 */
50 int charmatch(const char *str1, const char *str2)
51 {
52
53
54
55 1.99 portage-utils/qmerge.c
56
57 file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?rev=1.99&view=markup
58 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?rev=1.99&content-type=text/plain
59 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?r1=1.98&r2=1.99
60
61 Index: qmerge.c
62 ===================================================================
63 RCS file: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v
64 retrieving revision 1.98
65 retrieving revision 1.99
66 diff -u -r1.98 -r1.99
67 --- qmerge.c 21 Feb 2011 01:52:46 -0000 1.98
68 +++ qmerge.c 21 Feb 2011 06:20:24 -0000 1.99
69 @@ -1,7 +1,7 @@
70 /*
71 * Copyright 2005-2010 Gentoo Foundation
72 * Distributed under the terms of the GNU General Public License v2
73 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.98 2011/02/21 01:52:46 vapier Exp $
74 + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.99 2011/02/21 06:20:24 vapier Exp $
75 *
76 * Copyright 2005-2010 Ned Ludd - <solar@g.o>
77 * Copyright 2005-2010 Mike Frysinger - <vapier@g.o>
78 @@ -55,7 +55,7 @@
79 COMMON_OPTS_HELP
80 };
81
82 -static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.98 2011/02/21 01:52:46 vapier Exp $";
83 +static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.99 2011/02/21 06:20:24 vapier Exp $";
84 #define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, lookup_applet_idx("qmerge"))
85
86 char search_pkgs = 0;
87 @@ -834,7 +834,10 @@
88 /* qfprintf(stderr, "%s!!!%s %s %s (ambiguous name) specify fully-qualified pkgs\n", RED, NORM, pkgname); */
89 return 1;
90 }
91 - printf("%s===%s %s%s%s/%s%s%s\n", YELLOW, NORM, WHITE, cat, NORM, CYAN, pkgname, NORM);
92 + printf("%s<<<%s %s%s%s/%s%s%s\n", YELLOW, NORM, WHITE, cat, NORM, CYAN, pkgname, NORM);
93 +
94 + if (pretend == 100)
95 + return 0;
96
97 snprintf(buf, sizeof(buf), "%s/%s/%s/%s/CONTENTS", portroot, portvdb, cat, pkgname);
98
99 @@ -1547,7 +1550,7 @@
100
101 int qmerge_main(int argc, char **argv)
102 {
103 - int i;
104 + int i, ret;
105 const char Packages[] = "Packages";
106 int ARGC = argc;
107 char **ARGV = argv;
108 @@ -1582,8 +1585,30 @@
109 warn("Using these options are likely to break your system at this point. export QMERGE=1; if you think you know what your doing.");
110 }
111 }
112 - if (uninstall)
113 +
114 + if (uninstall) {
115 + if (interactive) {
116 + int save_pretend = pretend;
117 + int save_verbose = verbose;
118 + int save_quiet = quiet;
119 +
120 + pretend = 100;
121 + verbose = 0;
122 + quiet = 1;
123 + ret = unmerge_packages(argc, argv);
124 + if (ret || save_pretend)
125 + return ret;
126 +
127 + if (!prompt("OK to unmerge these packages"))
128 + return 0;
129 +
130 + pretend = save_pretend;
131 + verbose = save_verbose;
132 + quiet = save_quiet;
133 + }
134 +
135 return unmerge_packages(argc, argv);
136 + }
137
138 ARGC = argc;
139 ARGV = argv;