From c281c323adf14ece439b98dcf35531666266a0a5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 7 Dec 2011 23:26:02 -0800 Subject: [PATCH] dispatch-conf: experimental prefix support --- bin/dispatch-conf | 5 +++-- pym/portage/dispatch_conf.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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) -- 2.26.2