When running `dispatch-conf` in Gentoo Prefix, it invokes portage hooks from /etc: conf-update.d post-session Commiting uncommited changes before after finishing a configuration update session fatal: not a git repository (or any of the parent directories): .git rm: cannot remove '/var/cache/etckeeper/packagelist.pre-install': Permission denied rm: cannot remove '/var/cache/etckeeper/packagelist.fmt': Permission denied * Spawn failed for: etckeeper, /etc/portage/conf-update.d/etckeeper Relevant code: https://gitweb.gentoo.org/proj/portage.git/tree/lib/portage/dispatch_conf.py, it does not pass EPREFIX environment variable to perform_hooks() function, thus it locates portage hooks in root. Possible fix: set default prefix to EPREFIX in perform_hooks() function.
Can you test if this works for you? --- a/lib/portage/util/hooks.py +++ b/lib/portage/util/hooks.py @@ -12,11 +12,14 @@ from portage.output import create_color_func from portage.util import writemsg_level, _recursive_file_list from warnings import warn +# PREFIX LOCAL +from portage.const import EPREFIX + bad = create_color_func("BAD") warn = create_color_func("WARN") -def get_hooks_from_dir(rel_directory, prefix="/"): +def get_hooks_from_dir(rel_directory, prefix=EPREFIX): directory = os.path.join(prefix, portage.USER_CONFIG_PATH, rel_directory) hooks = OrderedDict() @@ -39,7 +42,7 @@ def get_hooks_from_dir(rel_directory, prefix="/"): return hooks -def perform_hooks(rel_directory, *argv, prefix="/"): +def perform_hooks(rel_directory, *argv, prefix=EPREFIX): for filepath, name in get_hooks_from_dir(rel_directory, prefix).items(): hook_command = filepath + " " + " ".join(map(str, argv)) retval = portage.process.spawn(hook_command)
(In reply to Fabian Groffen from comment #1) > Can you test if this works for you? > > --- a/lib/portage/util/hooks.py > +++ b/lib/portage/util/hooks.py > @@ -12,11 +12,14 @@ from portage.output import create_color_func > from portage.util import writemsg_level, _recursive_file_list > from warnings import warn > > +# PREFIX LOCAL > +from portage.const import EPREFIX > + > bad = create_color_func("BAD") > warn = create_color_func("WARN") > > > -def get_hooks_from_dir(rel_directory, prefix="/"): > +def get_hooks_from_dir(rel_directory, prefix=EPREFIX): > directory = os.path.join(prefix, portage.USER_CONFIG_PATH, > rel_directory) > > hooks = OrderedDict() > @@ -39,7 +42,7 @@ def get_hooks_from_dir(rel_directory, prefix="/"): > return hooks > > > -def perform_hooks(rel_directory, *argv, prefix="/"): > +def perform_hooks(rel_directory, *argv, prefix=EPREFIX): > for filepath, name in get_hooks_from_dir(rel_directory, prefix).items(): > hook_command = filepath + " " + " ".join(map(str, argv)) > retval = portage.process.spawn(hook_command) Yes, it works for me.
pushed as bf9e572160ca3ae495ebd767951b31286665fc05