Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15430 - in main/branches/prefix: bin pym/_emerge pym/portage pym/portage/dbapi
Date: Mon, 22 Feb 2010 12:56:56
Message-Id: E1NjXqH-000209-4C@stork.gentoo.org
1 Author: grobian
2 Date: 2010-02-22 12:56:52 +0000 (Mon, 22 Feb 2010)
3 New Revision: 15430
4
5 Modified:
6 main/branches/prefix/bin/repoman
7 main/branches/prefix/pym/_emerge/Package.py
8 main/branches/prefix/pym/_emerge/actions.py
9 main/branches/prefix/pym/_emerge/depgraph.py
10 main/branches/prefix/pym/_emerge/unmerge.py
11 main/branches/prefix/pym/portage/__init__.py
12 main/branches/prefix/pym/portage/dbapi/bintree.py
13 main/branches/prefix/pym/portage/dbapi/vartree.py
14 main/branches/prefix/pym/portage/dep.py
15 Log:
16 Merged from trunk -r15387:15397
17
18 | 15388 | Fix deprecated usage of dep_getkey. |
19 | zmedico | |
20
21 | 15390 | Fix deprecated usage of dep_getkey. |
22 | zmedico | |
23
24 | 15391 | Fix deprecated usage of dep_getkey. |
25 | zmedico | |
26
27 | 15392 | Bug #303519 - Call warnings.warn() with stacklevel=2 inside |
28 | zmedico | dep_getkey and dep_getcpv so that the caller is displayed. |
29
30 | 15393 | Bug #268724 - Show a warning message for --unmerge |
31 | zmedico | operations and suggest --depclean instead. |
32
33 | 15394 | Bail out when given an invalid mode. |
34 | zmedico | |
35
36 | 15395 | Fix deprecated usage of dep_getkey. |
37 | zmedico | |
38
39 | 15396 | Fix deprecated usage of dep_getkey. |
40 | zmedico | |
41
42 | 15397 | Use isvalidatom to validate PROVIDE entries. |
43 | zmedico | |
44
45
46 Modified: main/branches/prefix/bin/repoman
47 ===================================================================
48 --- main/branches/prefix/bin/repoman 2010-02-22 10:44:23 UTC (rev 15429)
49 +++ main/branches/prefix/bin/repoman 2010-02-22 12:56:52 UTC (rev 15430)
50 @@ -228,11 +228,13 @@
51 if opts.mode == 'help':
52 parser.print_help(short=False)
53
54 - for arg in args:
55 + for arg in args[1:]:
56 if arg in modes:
57 if not opts.mode:
58 opts.mode = arg
59 break
60 + else:
61 + parser.error("invalid mode: %s" % arg)
62
63 if not opts.mode:
64 opts.mode = 'full'
65
66 Modified: main/branches/prefix/pym/_emerge/Package.py
67 ===================================================================
68 --- main/branches/prefix/pym/_emerge/Package.py 2010-02-22 10:44:23 UTC (rev 15429)
69 +++ main/branches/prefix/pym/_emerge/Package.py 2010-02-22 12:56:52 UTC (rev 15430)
70 @@ -7,7 +7,7 @@
71 from itertools import chain
72 import portage
73 from portage.cache.mappings import slot_dict_class
74 -from portage.dep import paren_reduce, use_reduce, \
75 +from portage.dep import isvalidatom, paren_reduce, use_reduce, \
76 paren_normalize, paren_enclose, _slot_re
77 from portage.const import EPREFIX
78 from _emerge.Task import Task
79 @@ -303,9 +303,15 @@
80 getattr(self, "_set_" + k.lower())(k, v)
81 elif k in self._use_conditional_keys:
82 try:
83 - use_reduce(paren_reduce(v), matchall=1)
84 + reduced = use_reduce(paren_reduce(v), matchall=1)
85 except portage.exception.InvalidDependString as e:
86 self._pkg._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
87 + else:
88 + if reduced and k == 'PROVIDE':
89 + for x in portage.flatten(reduced):
90 + if not isvalidatom(x):
91 + self._pkg._invalid_metadata(k + ".syntax",
92 + "%s: %s" % (k, x))
93
94 def _set_inherited(self, k, v):
95 if isinstance(v, basestring):
96
97 Modified: main/branches/prefix/pym/_emerge/actions.py
98 ===================================================================
99 --- main/branches/prefix/pym/_emerge/actions.py 2010-02-22 10:44:23 UTC (rev 15429)
100 +++ main/branches/prefix/pym/_emerge/actions.py 2010-02-22 12:56:52 UTC (rev 15430)
101 @@ -2328,6 +2328,15 @@
102 if files and not valid_atoms:
103 return 1
104
105 + if action == 'unmerge' and '--quiet' not in opts:
106 + msg = "This action can remove important packages! " + \
107 + "In order to be safer, use " + \
108 + "`emerge -pv --depclean <atom>` to check for " + \
109 + "reverse dependencies before removing packages."
110 + out = portage.output.EOutput()
111 + for line in textwrap.wrap(msg, 72):
112 + out.ewarn(line)
113 +
114 if action in ('clean', 'unmerge') or \
115 (action == 'prune' and "--nodeps" in opts):
116 # When given a list of atoms, unmerge them in the order given.
117
118 Modified: main/branches/prefix/pym/_emerge/depgraph.py
119 ===================================================================
120 --- main/branches/prefix/pym/_emerge/depgraph.py 2010-02-22 10:44:23 UTC (rev 15429)
121 +++ main/branches/prefix/pym/_emerge/depgraph.py 2010-02-22 12:56:52 UTC (rev 15430)
122 @@ -1576,7 +1576,7 @@
123 print(colorize("BAD", "\n*** You need to adjust PORTDIR or PORTDIR_OVERLAY to emerge this package.\n"))
124 return 0, myfavorites
125 if mykey not in portdb.xmatch(
126 - "match-visible", portage.dep_getkey(mykey)):
127 + "match-visible", portage.cpv_getkey(mykey)):
128 print(colorize("BAD", "\n*** You are emerging a masked package. It is MUCH better to use"))
129 print(colorize("BAD", "*** /etc/portage/package.* to accomplish this. See portage(5) man"))
130 print(colorize("BAD", "*** page for details."))
131
132 Modified: main/branches/prefix/pym/_emerge/unmerge.py
133 ===================================================================
134 --- main/branches/prefix/pym/_emerge/unmerge.py 2010-02-22 10:44:23 UTC (rev 15429)
135 +++ main/branches/prefix/pym/_emerge/unmerge.py 2010-02-22 12:56:52 UTC (rev 15430)
136 @@ -237,7 +237,7 @@
137 slotmap[myslot][localtree.dbapi.cpv_counter(mypkg)] = mypkg
138
139 for mypkg in vartree.dbapi.cp_list(
140 - portage.dep_getkey(mymatch[0])):
141 + portage.cpv_getkey(mymatch[0])):
142 myslot = vartree.getslot(mypkg)
143 if myslot not in slotmap:
144 slotmap[myslot] = {}
145
146 Modified: main/branches/prefix/pym/portage/__init__.py
147 ===================================================================
148 --- main/branches/prefix/pym/portage/__init__.py 2010-02-22 10:44:23 UTC (rev 15429)
149 +++ main/branches/prefix/pym/portage/__init__.py 2010-02-22 12:56:52 UTC (rev 15430)
150 @@ -8734,7 +8734,7 @@
151 valid keyword."""
152 myarch = pgroups[0].lstrip("~")
153
154 - cp = dep_getkey(mycpv)
155 + cp = cpv_getkey(mycpv)
156 pkgdict = settings.pkeywordsdict.get(cp)
157 matches = False
158 if pkgdict:
159
160 Modified: main/branches/prefix/pym/portage/dbapi/bintree.py
161 ===================================================================
162 --- main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-22 10:44:23 UTC (rev 15429)
163 +++ main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-22 12:56:52 UTC (rev 15430)
164 @@ -848,7 +848,7 @@
165 (fullpkg, self.settings["PORTAGE_CONFIGROOT"]),
166 noiselevel=-1)
167 continue
168 - mykey = dep_getkey(fullpkg)
169 + mykey = portage.cpv_getkey(fullpkg)
170 try:
171 # invalid tbz2's can hurt things.
172 #print "cpv_inject("+str(fullpkg)+")"
173
174 Modified: main/branches/prefix/pym/portage/dbapi/vartree.py
175 ===================================================================
176 --- main/branches/prefix/pym/portage/dbapi/vartree.py 2010-02-22 10:44:23 UTC (rev 15429)
177 +++ main/branches/prefix/pym/portage/dbapi/vartree.py 2010-02-22 12:56:52 UTC (rev 15430)
178 @@ -3122,7 +3122,7 @@
179 if others_in_slot is None:
180 slot = self.vartree.dbapi.aux_get(self.mycpv, ["SLOT"])[0]
181 slot_matches = self.vartree.dbapi.match(
182 - "%s:%s" % (dep_getkey(self.mycpv), slot))
183 + "%s:%s" % (portage.cpv_getkey(self.mycpv), slot))
184 others_in_slot = []
185 for cur_cpv in slot_matches:
186 if cur_cpv == self.mycpv:
187 @@ -3394,7 +3394,7 @@
188 others_in_slot = []
189 slot = self.vartree.dbapi.aux_get(self.mycpv, ["SLOT"])[0]
190 slot_matches = self.vartree.dbapi.match(
191 - "%s:%s" % (dep_getkey(self.mycpv), slot))
192 + "%s:%s" % (portage.cpv_getkey(self.mycpv), slot))
193 for cur_cpv in slot_matches:
194 if cur_cpv == self.mycpv:
195 continue
196
197 Modified: main/branches/prefix/pym/portage/dep.py
198 ===================================================================
199 --- main/branches/prefix/pym/portage/dep.py 2010-02-22 10:44:23 UTC (rev 15429)
200 +++ main/branches/prefix/pym/portage/dep.py 2010-02-22 12:56:52 UTC (rev 15430)
201 @@ -708,7 +708,7 @@
202 # Fall back to legacy code for backward compatibility.
203 warnings.warn(_("%s is deprecated, use %s instead") % \
204 ('portage.dep.dep_getcpv()', 'portage.dep.Atom.cpv'),
205 - DeprecationWarning)
206 + DeprecationWarning, stacklevel=2)
207 mydep_orig = mydep
208 if mydep:
209 mydep = remove_slot(mydep)
210 @@ -943,13 +943,13 @@
211 else:
212 warnings.warn(_("invalid input to %s: '%s', use %s instead") % \
213 ('portage.dep.dep_getkey()', mydep, 'portage.cpv_getkey()'),
214 - DeprecationWarning)
215 + DeprecationWarning, stacklevel=2)
216 return atom.cp
217
218 # Fall back to legacy code for backward compatibility.
219 warnings.warn(_("%s is deprecated, use %s instead") % \
220 ('portage.dep.dep_getkey()', 'portage.dep.Atom.cp'),
221 - DeprecationWarning)
222 + DeprecationWarning, stacklevel=2)
223 mydep = dep_getcpv(mydep)
224 if mydep and isspecific(mydep):
225 mysplit = catpkgsplit(mydep)