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
if sys.hexversion >= 0x3000000:
long = int
+ _unicode = str
+else:
+ _unicode = unicode
def action_build(settings, trees, mtimedb,
myopts, myaction, myfiles, spinner):
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 " + \
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:
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):
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)
"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):
-# 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
"""
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 = []
-# Copyright 2007-2011 Gentoo Foundation
+# Copyright 2007-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import errno
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
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 = []
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)
# 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
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'
-# 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
def testAutounmaskAndSets(self):
- if not _ENABLE_SET_CONFIG:
- return
-
ebuilds = {
#ebuilds to test use changes
"dev-libs/A-1": { },