From: Zac Medico Date: Thu, 8 Dec 2011 07:26:02 +0000 (-0800) Subject: dispatch-conf: experimental prefix support X-Git-Tag: v2.2.0_alpha80~58 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c281c323adf14ece439b98dcf35531666266a0a5;p=portage.git dispatch-conf: experimental prefix support --- diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 3089329db..1cad9e011 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -85,7 +85,7 @@ class dispatch: confs = [] count = 0 - config_root = '/' + config_root = os.environ.get("__PORTAGE_TEST_EPREFIX", "/") self.options = portage.dispatch_conf.read_config(MANDATORY_OPTS) if "log-file" in self.options: @@ -120,7 +120,8 @@ class dispatch: # for path in config_paths: - path = portage.normalize_path(path) + path = portage.normalize_path( + os.path.join(config_root, path.lstrip(os.sep))) try: mymode = os.stat(path).st_mode except OSError: diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py index 499102030..f5beba5c0 100644 --- a/pym/portage/dispatch_conf.py +++ b/pym/portage/dispatch_conf.py @@ -38,8 +38,9 @@ def diffstatusoutput_len(cmd): return (1, 1) def read_config(mandatory_opts): - loader = KeyValuePairFileLoader( - '/etc/dispatch-conf.conf', None) + eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX", "/") + config_path = os.path.join(eprefix, "etc/dispatch-conf.conf") + loader = KeyValuePairFileLoader(config_path, None) opts, errors = loader.load() if not opts: print(_('dispatch-conf: Error reading /etc/dispatch-conf.conf; fatal'), file=sys.stderr)