Enable /etc/portage/sets for stable, bug #384061.
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Jun 2012 23:49:46 +0000 (16:49 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 22 Jun 2012 23:49:46 +0000 (16:49 -0700)
pym/_emerge/actions.py
pym/_emerge/depgraph.py
pym/_emerge/main.py
pym/portage/_sets/__init__.py
pym/portage/_sets/files.py
pym/portage/const.py
pym/portage/tests/resolver/test_autounmask.py

index 7ad28e62d5eb72cc67a6412c7c8c5fdd2124a2e4..af42828d149b5b803cd7d836d1965ae5a0710479 100644 (file)
@@ -31,7 +31,7 @@ from portage import shutil
 from portage import eapi_is_supported, _unicode_decode
 from portage.cache.cache_errors import CacheError
 from portage.const import GLOBAL_CONFIG_PATH
-from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_SET_CONFIG
+from portage.const import _ENABLE_DYN_LINK_MAP
 from portage.dbapi.dep_expand import dep_expand
 from portage.dbapi._expand_new_virt import expand_new_virt
 from portage.dep import Atom, extended_cp_match
@@ -76,6 +76,9 @@ from _emerge.userquery import userquery
 
 if sys.hexversion >= 0x3000000:
        long = int
+       _unicode = str
+else:
+       _unicode = unicode
 
 def action_build(settings, trees, mtimedb,
        myopts, myaction, myfiles, spinner):
@@ -1297,12 +1300,21 @@ def action_deselect(settings, trees, opts, atoms):
                                                break
                if discard_atoms:
                        for atom in sorted(discard_atoms):
+
                                if pretend:
-                                       print(">>> Would remove %s from \"world\" favorites file..." % \
-                                               colorize("INFORM", str(atom)))
+                                       action_desc = "Would remove"
+                               else:
+                                       action_desc = "Removing"
+
+                               if atom.startswith(SETPREFIX):
+                                       filename = "world_sets"
                                else:
-                                       print(">>> Removing %s from \"world\" favorites file..." % \
-                                               colorize("INFORM", str(atom)))
+                                       filename = "world"
+
+                               writemsg_stdout(
+                                       ">>> %s %s from \"%s\" favorites file...\n" %
+                                       (action_desc, colorize("INFORM", _unicode(atom)),
+                                       filename), noiselevel=-1)
 
                        if '--ask' in opts:
                                prompt = "Would you like to remove these " + \
@@ -1466,11 +1478,11 @@ def action_info(settings, trees, myopts, myfiles):
                append("Repositories: %s" % \
                        " ".join(repo.name for repo in repos))
 
-       if _ENABLE_SET_CONFIG:
+       installed_sets = sorted(s for s in
+               root_config.sets['selected'].getNonAtoms() if s.startswith(SETPREFIX))
+       if installed_sets:
                sets_line = "Installed sets: "
-               sets_line += ", ".join(s for s in \
-                       sorted(root_config.sets['selected'].getNonAtoms()) \
-                       if s.startswith(SETPREFIX))
+               sets_line += ", ".join(installed_sets)
                append(sets_line)
 
        if "--verbose" in myopts:
index 2547fa4e41de9d9c06a671010c6e6b0b1de88ed4..92c10611fd8fd7d19b88ee6563c9e12fae51a50d 100644 (file)
@@ -74,6 +74,9 @@ from _emerge.resolver.output import Display
 if sys.hexversion >= 0x3000000:
        basestring = str
        long = int
+       _unicode = str
+else:
+       _unicode = unicode
 
 class _scheduler_graph_config(object):
        def __init__(self, trees, pkg_cache, graph, mergelist):
@@ -6719,9 +6722,13 @@ class depgraph(object):
                all_added.extend(added_favorites)
                all_added.sort()
                for a in all_added:
+                       if a.startswith(SETPREFIX):
+                               filename = "world_sets"
+                       else:
+                               filename = "world"
                        writemsg_stdout(
-                               ">>> Recording %s in \"world\" favorites file...\n" % \
-                               colorize("INFORM", str(a)), noiselevel=-1)
+                               ">>> Recording %s in \"%s\" favorites file...\n" %
+                               (colorize("INFORM", _unicode(a)), filename), noiselevel=-1)
                if all_added:
                        world_set.update(all_added)
 
index efd954bb921b6677dd320ffd6d7c15cf5a4fef29..35401383f2b76f7883a34a53e64cd5b99a16b8e2 100644 (file)
@@ -1370,14 +1370,9 @@ def clean_logs(settings):
                        "PORT_LOGDIR_CLEAN usage instructions.")
 
 def setconfig_fallback(root_config):
-       from portage._sets.base import DummyPackageSet
-       from portage._sets.files import WorldSelectedSet
-       from portage._sets.profiles import PackagesSystemSet
        setconfig = root_config.setconfig
-       setconfig.psets['world'] = DummyPackageSet(atoms=['@selected', '@system'])
-       setconfig.psets['selected'] = WorldSelectedSet(root_config.settings['EROOT'])
-       setconfig.psets['system'] = \
-               PackagesSystemSet(root_config.settings.profiles)
+       setconfig._create_default_config()
+       setconfig._parse(update=True)
        root_config.sets = setconfig.getSets()
 
 def get_missing_sets(root_config):
index 88a4b3b1ba1ba8c0f9584fa5624726fb9cfce243..c3b590e928f1d5bb18bbdb84f1d42ec366135937 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2007-2011 Gentoo Foundation
+# Copyright 2007-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import print_function
@@ -111,16 +111,26 @@ class SetConfig(object):
                """
                parser = self._parser
 
+               parser.remove_section("world")
                parser.add_section("world")
                parser.set("world", "class", "portage.sets.base.DummyPackageSet")
                parser.set("world", "packages", "@selected @system")
 
+               parser.remove_section("selected")
                parser.add_section("selected")
                parser.set("selected", "class", "portage.sets.files.WorldSelectedSet")
 
+               parser.remove_section("system")
                parser.add_section("system")
                parser.set("system", "class", "portage.sets.profiles.PackagesSystemSet")
 
+               parser.remove_section("usersets")
+               parser.add_section("usersets")
+               parser.set("usersets", "class", "portage.sets.files.StaticFileSet")
+               parser.set("usersets", "multiset", "true")
+               parser.set("usersets", "directory", "%(PORTAGE_CONFIGROOT)setc/portage/sets")
+               parser.set("usersets", "world-candidate", "true")
+
        def update(self, setname, options):
                parser = self._parser
                self.errors = []
index f19ecf6ce37151cc75d9d84baacb556b2c5d69ed..b891ea4f44a3b06dcc5f252418125a0aa61ca685 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2007-2011 Gentoo Foundation
+# Copyright 2007-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
@@ -11,7 +11,6 @@ from portage import _unicode_decode
 from portage import _unicode_encode
 from portage.util import grabfile, write_atomic, ensure_dirs, normalize_path
 from portage.const import USER_CONFIG_PATH, WORLD_FILE, WORLD_SETS_FILE
-from portage.const import _ENABLE_SET_CONFIG
 from portage.localization import _
 from portage.locks import lockfile, unlockfile
 from portage import portage_gid
@@ -231,9 +230,8 @@ class WorldSelectedSet(EditablePackageSet):
                write_atomic(self._filename,
                        "".join(sorted("%s\n" % x for x in self._atoms)))
 
-               if _ENABLE_SET_CONFIG:
-                       write_atomic(self._filename2,
-                               "".join(sorted("%s\n" % x for x in self._nonatoms)))
+               write_atomic(self._filename2,
+                       "".join(sorted("%s\n" % x for x in self._nonatoms)))
 
        def load(self):
                atoms = []
@@ -263,9 +261,8 @@ class WorldSelectedSet(EditablePackageSet):
                else:
                        atoms.extend(self._atoms)
 
-               if _ENABLE_SET_CONFIG:
-                       changed2, nonatoms = self._load2()
-                       atoms_changed |= changed2
+               changed2, nonatoms = self._load2()
+               atoms_changed |= changed2
 
                if atoms_changed:
                        self._setAtoms(atoms+nonatoms)
index 3744e111f3256a98717d42a0d6b7990c9adec4e3..3607df0e038d53154c759ea8837e4e37ac01b8bf 100644 (file)
@@ -1,5 +1,5 @@
 # portage: Constants
-# Copyright 1998-2011 Gentoo Foundation
+# Copyright 1998-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import os
@@ -175,6 +175,3 @@ if not _ENABLE_PRESERVE_LIBS:
        SUPPORTED_FEATURES = set(SUPPORTED_FEATURES)
        SUPPORTED_FEATURES.remove("preserve-libs")
        SUPPORTED_FEATURES = frozenset(SUPPORTED_FEATURES)
-
-if not _ENABLE_SET_CONFIG:
-       WORLD_SETS_FILE = '/dev/null'
index 84182ba6ae4eeee9e7cb49519f849030382ddfb3..6acac9984aa5819600449381e3d90c680a949bb2 100644 (file)
@@ -1,7 +1,6 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-from portage.const import _ENABLE_SET_CONFIG
 from portage.tests import TestCase
 from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase
 
@@ -340,9 +339,6 @@ class AutounmaskTestCase(TestCase):
 
        def testAutounmaskAndSets(self):
 
-               if not _ENABLE_SET_CONFIG:
-                       return
-
                ebuilds = {
                        #ebuilds to test use changes
                        "dev-libs/A-1": { },