1 |
commit: c5142aadedee5b1917607f10d5018b763ef2419b |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 22 23:49:46 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 22 23:49:46 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c5142aad |
7 |
|
8 |
Enable /etc/portage/sets for stable, bug #384061. |
9 |
|
10 |
--- |
11 |
pym/_emerge/actions.py | 30 +++++++++++++++++------- |
12 |
pym/_emerge/depgraph.py | 11 +++++++- |
13 |
pym/_emerge/main.py | 9 +----- |
14 |
pym/portage/_sets/__init__.py | 12 +++++++++- |
15 |
pym/portage/_sets/files.py | 13 ++++------ |
16 |
pym/portage/const.py | 5 +--- |
17 |
pym/portage/tests/resolver/test_autounmask.py | 6 +---- |
18 |
7 files changed, 50 insertions(+), 36 deletions(-) |
19 |
|
20 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
21 |
index 7ad28e6..af42828 100644 |
22 |
--- a/pym/_emerge/actions.py |
23 |
+++ b/pym/_emerge/actions.py |
24 |
@@ -31,7 +31,7 @@ from portage import shutil |
25 |
from portage import eapi_is_supported, _unicode_decode |
26 |
from portage.cache.cache_errors import CacheError |
27 |
from portage.const import GLOBAL_CONFIG_PATH |
28 |
-from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_SET_CONFIG |
29 |
+from portage.const import _ENABLE_DYN_LINK_MAP |
30 |
from portage.dbapi.dep_expand import dep_expand |
31 |
from portage.dbapi._expand_new_virt import expand_new_virt |
32 |
from portage.dep import Atom, extended_cp_match |
33 |
@@ -76,6 +76,9 @@ from _emerge.userquery import userquery |
34 |
|
35 |
if sys.hexversion >= 0x3000000: |
36 |
long = int |
37 |
+ _unicode = str |
38 |
+else: |
39 |
+ _unicode = unicode |
40 |
|
41 |
def action_build(settings, trees, mtimedb, |
42 |
myopts, myaction, myfiles, spinner): |
43 |
@@ -1297,12 +1300,21 @@ def action_deselect(settings, trees, opts, atoms): |
44 |
break |
45 |
if discard_atoms: |
46 |
for atom in sorted(discard_atoms): |
47 |
+ |
48 |
if pretend: |
49 |
- print(">>> Would remove %s from \"world\" favorites file..." % \ |
50 |
- colorize("INFORM", str(atom))) |
51 |
+ action_desc = "Would remove" |
52 |
+ else: |
53 |
+ action_desc = "Removing" |
54 |
+ |
55 |
+ if atom.startswith(SETPREFIX): |
56 |
+ filename = "world_sets" |
57 |
else: |
58 |
- print(">>> Removing %s from \"world\" favorites file..." % \ |
59 |
- colorize("INFORM", str(atom))) |
60 |
+ filename = "world" |
61 |
+ |
62 |
+ writemsg_stdout( |
63 |
+ ">>> %s %s from \"%s\" favorites file...\n" % |
64 |
+ (action_desc, colorize("INFORM", _unicode(atom)), |
65 |
+ filename), noiselevel=-1) |
66 |
|
67 |
if '--ask' in opts: |
68 |
prompt = "Would you like to remove these " + \ |
69 |
@@ -1466,11 +1478,11 @@ def action_info(settings, trees, myopts, myfiles): |
70 |
append("Repositories: %s" % \ |
71 |
" ".join(repo.name for repo in repos)) |
72 |
|
73 |
- if _ENABLE_SET_CONFIG: |
74 |
+ installed_sets = sorted(s for s in |
75 |
+ root_config.sets['selected'].getNonAtoms() if s.startswith(SETPREFIX)) |
76 |
+ if installed_sets: |
77 |
sets_line = "Installed sets: " |
78 |
- sets_line += ", ".join(s for s in \ |
79 |
- sorted(root_config.sets['selected'].getNonAtoms()) \ |
80 |
- if s.startswith(SETPREFIX)) |
81 |
+ sets_line += ", ".join(installed_sets) |
82 |
append(sets_line) |
83 |
|
84 |
if "--verbose" in myopts: |
85 |
|
86 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
87 |
index 2547fa4..92c1061 100644 |
88 |
--- a/pym/_emerge/depgraph.py |
89 |
+++ b/pym/_emerge/depgraph.py |
90 |
@@ -74,6 +74,9 @@ from _emerge.resolver.output import Display |
91 |
if sys.hexversion >= 0x3000000: |
92 |
basestring = str |
93 |
long = int |
94 |
+ _unicode = str |
95 |
+else: |
96 |
+ _unicode = unicode |
97 |
|
98 |
class _scheduler_graph_config(object): |
99 |
def __init__(self, trees, pkg_cache, graph, mergelist): |
100 |
@@ -6719,9 +6722,13 @@ class depgraph(object): |
101 |
all_added.extend(added_favorites) |
102 |
all_added.sort() |
103 |
for a in all_added: |
104 |
+ if a.startswith(SETPREFIX): |
105 |
+ filename = "world_sets" |
106 |
+ else: |
107 |
+ filename = "world" |
108 |
writemsg_stdout( |
109 |
- ">>> Recording %s in \"world\" favorites file...\n" % \ |
110 |
- colorize("INFORM", str(a)), noiselevel=-1) |
111 |
+ ">>> Recording %s in \"%s\" favorites file...\n" % |
112 |
+ (colorize("INFORM", _unicode(a)), filename), noiselevel=-1) |
113 |
if all_added: |
114 |
world_set.update(all_added) |
115 |
|
116 |
|
117 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
118 |
index efd954b..3540138 100644 |
119 |
--- a/pym/_emerge/main.py |
120 |
+++ b/pym/_emerge/main.py |
121 |
@@ -1370,14 +1370,9 @@ def clean_logs(settings): |
122 |
"PORT_LOGDIR_CLEAN usage instructions.") |
123 |
|
124 |
def setconfig_fallback(root_config): |
125 |
- from portage._sets.base import DummyPackageSet |
126 |
- from portage._sets.files import WorldSelectedSet |
127 |
- from portage._sets.profiles import PackagesSystemSet |
128 |
setconfig = root_config.setconfig |
129 |
- setconfig.psets['world'] = DummyPackageSet(atoms=['@selected', '@system']) |
130 |
- setconfig.psets['selected'] = WorldSelectedSet(root_config.settings['EROOT']) |
131 |
- setconfig.psets['system'] = \ |
132 |
- PackagesSystemSet(root_config.settings.profiles) |
133 |
+ setconfig._create_default_config() |
134 |
+ setconfig._parse(update=True) |
135 |
root_config.sets = setconfig.getSets() |
136 |
|
137 |
def get_missing_sets(root_config): |
138 |
|
139 |
diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py |
140 |
index 88a4b3b..c3b590e 100644 |
141 |
--- a/pym/portage/_sets/__init__.py |
142 |
+++ b/pym/portage/_sets/__init__.py |
143 |
@@ -1,4 +1,4 @@ |
144 |
-# Copyright 2007-2011 Gentoo Foundation |
145 |
+# Copyright 2007-2012 Gentoo Foundation |
146 |
# Distributed under the terms of the GNU General Public License v2 |
147 |
|
148 |
from __future__ import print_function |
149 |
@@ -111,16 +111,26 @@ class SetConfig(object): |
150 |
""" |
151 |
parser = self._parser |
152 |
|
153 |
+ parser.remove_section("world") |
154 |
parser.add_section("world") |
155 |
parser.set("world", "class", "portage.sets.base.DummyPackageSet") |
156 |
parser.set("world", "packages", "@selected @system") |
157 |
|
158 |
+ parser.remove_section("selected") |
159 |
parser.add_section("selected") |
160 |
parser.set("selected", "class", "portage.sets.files.WorldSelectedSet") |
161 |
|
162 |
+ parser.remove_section("system") |
163 |
parser.add_section("system") |
164 |
parser.set("system", "class", "portage.sets.profiles.PackagesSystemSet") |
165 |
|
166 |
+ parser.remove_section("usersets") |
167 |
+ parser.add_section("usersets") |
168 |
+ parser.set("usersets", "class", "portage.sets.files.StaticFileSet") |
169 |
+ parser.set("usersets", "multiset", "true") |
170 |
+ parser.set("usersets", "directory", "%(PORTAGE_CONFIGROOT)setc/portage/sets") |
171 |
+ parser.set("usersets", "world-candidate", "true") |
172 |
+ |
173 |
def update(self, setname, options): |
174 |
parser = self._parser |
175 |
self.errors = [] |
176 |
|
177 |
diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py |
178 |
index f19ecf6..b891ea4 100644 |
179 |
--- a/pym/portage/_sets/files.py |
180 |
+++ b/pym/portage/_sets/files.py |
181 |
@@ -1,4 +1,4 @@ |
182 |
-# Copyright 2007-2011 Gentoo Foundation |
183 |
+# Copyright 2007-2012 Gentoo Foundation |
184 |
# Distributed under the terms of the GNU General Public License v2 |
185 |
|
186 |
import errno |
187 |
@@ -11,7 +11,6 @@ from portage import _unicode_decode |
188 |
from portage import _unicode_encode |
189 |
from portage.util import grabfile, write_atomic, ensure_dirs, normalize_path |
190 |
from portage.const import USER_CONFIG_PATH, WORLD_FILE, WORLD_SETS_FILE |
191 |
-from portage.const import _ENABLE_SET_CONFIG |
192 |
from portage.localization import _ |
193 |
from portage.locks import lockfile, unlockfile |
194 |
from portage import portage_gid |
195 |
@@ -231,9 +230,8 @@ class WorldSelectedSet(EditablePackageSet): |
196 |
write_atomic(self._filename, |
197 |
"".join(sorted("%s\n" % x for x in self._atoms))) |
198 |
|
199 |
- if _ENABLE_SET_CONFIG: |
200 |
- write_atomic(self._filename2, |
201 |
- "".join(sorted("%s\n" % x for x in self._nonatoms))) |
202 |
+ write_atomic(self._filename2, |
203 |
+ "".join(sorted("%s\n" % x for x in self._nonatoms))) |
204 |
|
205 |
def load(self): |
206 |
atoms = [] |
207 |
@@ -263,9 +261,8 @@ class WorldSelectedSet(EditablePackageSet): |
208 |
else: |
209 |
atoms.extend(self._atoms) |
210 |
|
211 |
- if _ENABLE_SET_CONFIG: |
212 |
- changed2, nonatoms = self._load2() |
213 |
- atoms_changed |= changed2 |
214 |
+ changed2, nonatoms = self._load2() |
215 |
+ atoms_changed |= changed2 |
216 |
|
217 |
if atoms_changed: |
218 |
self._setAtoms(atoms+nonatoms) |
219 |
|
220 |
diff --git a/pym/portage/const.py b/pym/portage/const.py |
221 |
index 3744e11..3607df0 100644 |
222 |
--- a/pym/portage/const.py |
223 |
+++ b/pym/portage/const.py |
224 |
@@ -1,5 +1,5 @@ |
225 |
# portage: Constants |
226 |
-# Copyright 1998-2011 Gentoo Foundation |
227 |
+# Copyright 1998-2012 Gentoo Foundation |
228 |
# Distributed under the terms of the GNU General Public License v2 |
229 |
|
230 |
import os |
231 |
@@ -175,6 +175,3 @@ if not _ENABLE_PRESERVE_LIBS: |
232 |
SUPPORTED_FEATURES = set(SUPPORTED_FEATURES) |
233 |
SUPPORTED_FEATURES.remove("preserve-libs") |
234 |
SUPPORTED_FEATURES = frozenset(SUPPORTED_FEATURES) |
235 |
- |
236 |
-if not _ENABLE_SET_CONFIG: |
237 |
- WORLD_SETS_FILE = '/dev/null' |
238 |
|
239 |
diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py |
240 |
index 84182ba..6acac99 100644 |
241 |
--- a/pym/portage/tests/resolver/test_autounmask.py |
242 |
+++ b/pym/portage/tests/resolver/test_autounmask.py |
243 |
@@ -1,7 +1,6 @@ |
244 |
-# Copyright 2010-2011 Gentoo Foundation |
245 |
+# Copyright 2010-2012 Gentoo Foundation |
246 |
# Distributed under the terms of the GNU General Public License v2 |
247 |
|
248 |
-from portage.const import _ENABLE_SET_CONFIG |
249 |
from portage.tests import TestCase |
250 |
from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase |
251 |
|
252 |
@@ -340,9 +339,6 @@ class AutounmaskTestCase(TestCase): |
253 |
|
254 |
def testAutounmaskAndSets(self): |
255 |
|
256 |
- if not _ENABLE_SET_CONFIG: |
257 |
- return |
258 |
- |
259 |
ebuilds = { |
260 |
#ebuilds to test use changes |
261 |
"dev-libs/A-1": { }, |