diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-30 16:15:12 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-30 16:15:12 -0700 |
commit | 5cd5b5b22aed7e0443cea18d3ea373aaaec021f2 (patch) | |
tree | 30b6736b36489419eb33f168b078893b02319626 | |
parent | fe0aa0ef1870fb1b444e415fc29964cdb77c5b1a (diff) | |
download | portage-5cd5b5b22aed7e0443cea18d3ea373aaaec021f2.tar.gz portage-5cd5b5b22aed7e0443cea18d3ea373aaaec021f2.tar.bz2 portage-5cd5b5b22aed7e0443cea18d3ea373aaaec021f2.zip |
When _ENABLE_SET_CONFIG is False, disable reading/writing of the
world_sets file in WorldSelectedSet.
-rw-r--r-- | pym/portage/_sets/files.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py index 8116d07cd..e880c1eff 100644 --- a/pym/portage/_sets/files.py +++ b/pym/portage/_sets/files.py @@ -11,6 +11,7 @@ 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 @@ -229,8 +230,11 @@ class WorldSelectedSet(EditablePackageSet): def write(self): write_atomic(self._filename, "".join(sorted("%s\n" % x for x in self._atoms))) - write_atomic(self._filename2, "\n".join(sorted(self._nonatoms))+"\n") - + + if _ENABLE_SET_CONFIG: + write_atomic(self._filename2, + "".join(sorted("%s\n" % x for x in self._nonatoms))) + def load(self): atoms = [] nonatoms = [] @@ -258,6 +262,16 @@ class WorldSelectedSet(EditablePackageSet): atoms_changed = True else: atoms.extend(self._atoms) + + if _ENABLE_SET_CONFIG: + changed2, nonatoms = self._load2() + atoms_changed |= changed2 + + if atoms_changed: + self._setAtoms(atoms+nonatoms) + + def _load2(self): + changed = False try: mtime = os.stat(self._filename2).st_mtime except (OSError, IOError): @@ -275,12 +289,12 @@ class WorldSelectedSet(EditablePackageSet): data = {} nonatoms = list(data) self._mtime2 = mtime - atoms_changed = True + changed = True else: - nonatoms.extend(self._nonatoms) - if atoms_changed: - self._setAtoms(atoms+nonatoms) - + nonatoms = self._nonatoms + + return changed, nonatoms + def _ensure_dirs(self): ensure_dirs(os.path.dirname(self._filename), gid=portage_gid, mode=0o2750, mask=0o2) |