summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-07-31 21:45:18 -0700
committerZac Medico <zmedico@gentoo.org>2010-07-31 21:45:18 -0700
commitf5e48098ddd114c2448ff0071f4267b3bc4ee880 (patch)
treec13c589f0eec373f5b0a49c9ace8fd359a5122de
parentAdd a warning message to the --package-moves[=n] docs, noting that (diff)
downloadportage-multirepo-f5e48098ddd114c2448ff0071f4267b3bc4ee880.tar.gz
portage-multirepo-f5e48098ddd114c2448ff0071f4267b3bc4ee880.tar.bz2
portage-multirepo-f5e48098ddd114c2448ff0071f4267b3bc4ee880.zip
Always use shlex_split() to split CONFIG_PROTECT{,_MASK}.
-rwxr-xr-xbin/dispatch-conf23
-rwxr-xr-xbin/quickpkg7
-rw-r--r--pym/_emerge/actions.py3
-rw-r--r--pym/_emerge/main.py4
-rw-r--r--pym/portage/_global_updates.py7
5 files changed, 25 insertions, 19 deletions
diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index fc9cdd51..a7556a3a 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -13,11 +13,8 @@
from __future__ import print_function
-if not hasattr(__builtins__, "set"):
- from sets import Set as set
-
-from stat import *
-from random import *
+from stat import ST_GID, ST_MODE, ST_UID
+from random import random
import atexit, re, shutil, stat, sys
try:
@@ -74,7 +71,7 @@ class dispatch:
confs = []
count = 0
-
+ config_root = '/'
self.options = portage.dispatch_conf.read_config(MANDATORY_OPTS)
if "log-file" in self.options:
@@ -91,7 +88,7 @@ class dispatch:
# Build list of extant configs
#
- for path in config_paths.split ():
+ for path in config_paths:
path = portage.normalize_path(path)
try:
mymode = os.stat(path).st_mode
@@ -116,6 +113,10 @@ class dispatch:
# config file freezing support
frozen_files = set(self.options.get("frozen-files", "").split())
auto_zapped = []
+ protect_obj = ConfigProtect(
+ config_root, config_paths,
+ portage.util.shlex_split(
+ portage.settings.get('CONFIG_PROTECT_MASK', '')))
#
# Remove new configs identical to current
@@ -190,7 +191,8 @@ class dispatch:
except OSError:
pass
return False
- elif unmodified or same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split ():
+ elif unmodified or same_cvs or same_wsc or \
+ not protect_obj.isprotected(conf['current']):
self.replace(newconf, conf['current'])
self.post_process(conf['current'])
if newconf == mrgconf:
@@ -426,6 +428,7 @@ d = dispatch ()
if len(sys.argv) > 1:
# for testing
- d.grind (" ".join(sys.argv[1:]))
+ d.grind(sys.argv[1:])
else:
- d.grind (portage.settings ['CONFIG_PROTECT'])
+ d.grind(portage.util.shlex_split(
+ portage.settings.get('CONFIG_PROTECT', '')))
diff --git a/bin/quickpkg b/bin/quickpkg
index 8e74c2c3..b703ee67 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -23,12 +23,13 @@ from portage import xpak
from portage.dbapi.dep_expand import dep_expand
from portage.dep import flatten, paren_reduce, use_reduce
from portage.exception import InvalidAtom, InvalidData, InvalidDependString, PackageSetNotFound
-from portage.util import ConfigProtect, ensure_dirs
+from portage.util import ConfigProtect, ensure_dirs, shlex_split
from portage.dbapi.vartree import dblink, tar_contents
from portage.checksum import perform_md5
from portage.sets import load_default_config, SETPREFIX
def quickpkg_atom(options, infos, arg, eout):
+ settings = portage.settings
root = portage.settings["ROOT"]
trees = portage.db[root]
vartree = trees["vartree"]
@@ -96,8 +97,8 @@ def quickpkg_atom(options, infos, arg, eout):
protect = None
if not include_config:
confprot = ConfigProtect(root,
- portage.settings.get("CONFIG_PROTECT","").split(),
- portage.settings.get("CONFIG_PROTECT_MASK","").split())
+ shlex_split(settings.get("CONFIG_PROTECT", "")),
+ shlex_split(settings.get("CONFIG_PROTECT_MASK", "")))
def protect(filename):
if not confprot.isprotected(filename):
return False
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 16c329bb..bbab613b 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2304,7 +2304,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
trees[settings["ROOT"]]["vartree"].dbapi.match(
portage.const.PORTAGE_PACKAGE_ATOM))
- chk_updated_cfg_files("/", settings.get("CONFIG_PROTECT","").split())
+ chk_updated_cfg_files("/",
+ portage.util.shlex_split(settings.get("CONFIG_PROTECT", "")))
if myaction != "metadata":
postsync = os.path.join(settings["PORTAGE_CONFIGROOT"],
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 5f0a7663..16d9897d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -33,7 +33,7 @@ import portage.exception
from portage.data import secpass
from portage.dbapi.dep_expand import dep_expand
from portage.util import normalize_path as normpath
-from portage.util import writemsg, writemsg_level, writemsg_stdout
+from portage.util import shlex_split, writemsg_level, writemsg_stdout
from portage.sets import SETPREFIX
from portage._global_updates import _global_updates
@@ -320,7 +320,7 @@ def post_emerge(root_config, myopts, mtimedb, retval):
settings.regenerate()
settings.lock()
- config_protect = settings.get("CONFIG_PROTECT","").split()
+ config_protect = shlex_split(settings.get("CONFIG_PROTECT", ""))
infodirs = settings.get("INFOPATH","").split(":") + \
settings.get("INFODIR","").split(":")
diff --git a/pym/portage/_global_updates.py b/pym/portage/_global_updates.py
index d3f55902..7468417a 100644
--- a/pym/portage/_global_updates.py
+++ b/pym/portage/_global_updates.py
@@ -12,7 +12,8 @@ from portage.exception import DirectoryNotFound
from portage.localization import _
from portage.output import bold, colorize
from portage.update import grab_updates, parse_updates, update_config_files, update_dbentry
-from portage.util import grabfile, writemsg, writemsg_stdout, write_atomic
+from portage.util import grabfile, shlex_split, \
+ writemsg, writemsg_stdout, write_atomic
def _global_updates(trees, prev_mtimes):
"""
@@ -143,8 +144,8 @@ def _global_updates(trees, prev_mtimes):
world_list[pos] = new_atom
world_modified = True
update_config_files(root,
- mysettings.get("CONFIG_PROTECT","").split(),
- mysettings.get("CONFIG_PROTECT_MASK","").split(),
+ shlex_split(mysettings.get("CONFIG_PROTECT", "")),
+ shlex_split(mysettings.get("CONFIG_PROTECT_MASK", "")),
myupd, match_callback=_world_repo_match)
for update_cmd in myupd: