Re: RFC: conf-update.d hook dir for dispatch-conf

Zac Medico <[email protected]>
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
On 8/3/20 1:13 AM, Florian Schmaus wrote:
> Portage's dispatch-conf does historically only support RCS for
> configuration file archival. There are currently two unresolved
> feature requests to extend dispatch-conf support for further
> configuration file management tools:
> 
> - bug #260623 git support for dispatch-conf [1]
> - bug #698316 etckeeper support for dispatch-conf [2]
> 
> Extending dispatch-conf by a hook directory, which can be used by
> configuration file management tools to receive notifications about
> dispatch-conf updating a configuration file, appears to be flexible
> approach to satisfy those feature requests (or at least lay the
> groundwork for them).
> 
> Attached is a patch with a prototypical implementation for
> conf-update.d hooks. I am curious whether or not you deem this useful
> enough to get into dispatch-conf.

Yes, and hooks are a great way to allow for customization.

> If my suggested approach is considered sensible, then I am happy to
continue the work on it.

Yes, it looks good. I wonder if we should support hooks that are only
called once per dispatch-conf session, rather than once per file. I see
that your etckeeper hook does not utilize the file argument, so maybe it
would make more sense to call it at the end of the dispatch-conf session?

If it makes sense to have session hooks, then I suppose we can add a
separate directory for them (kind of like how we have separate
repo.postsync.d and postsync.d hooks).

> For example, I want to write a unit test for this. But I am not sure if
> portage's test framework already provides the necessary functionality
> to create test scenarios for the conf-update.d hooks. Any pointers and
> further feedback would be much appreciated.

In lib/portage/tests/emerge/test_simple.py, we execute emerge,
dispatch-conf, and etc-update inside a mock gentoo prefix environment.
Maybe you can copy that file and modify it to do what you want.

> 
> - Florian
> 
> 1: https://bugs.gentoo.org/260623
> 2: https://bugs.gentoo.org/698316
-- 
Thanks,
Zac
signature.asc (application/pgp-signature, 981 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQKTBAEBCgB9FiEER1is2Nqa/UampgQK1hDPNyHnis0FAl8vRkVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDQ3
NThBQ0Q4REE5QUZENDZBNkE2MDQwQUQ2MTBDRjM3MjFFNzhBQ0QACgkQ1hDPNyHn
is1WsA//YkaH6RrxkrJLDOITe+SSIjke2WmAXEsrULsuAXWVdcKVp4WLhCX0DcPg
OsGhSYrrroT/XBBdb8WKCF1mZIOIEDfkNNL33bgUGBT3bu5JvHkNzJAeUESyUfEd
4x9K8a/VmJ2AyMY7aMiG84FhxjYqws2sArbjPoJY6OSv+swcMR6Kspti6SJxTGVR
Dk1ZOx817VW5H9nmayDqivbsHMRlq/+aVPPKhaBPkeHnCqjfFvaDecsKOU5x6js3
y3BiJjwP0Pe+DtAopVPetYWlw4vm/RcDzhvyp7Tau/aVy+bZF+HDs/VBzqJsGZuk
JyqgKrKMbSdSVhdHKGPWfyxsZL0E3bDpj6hjrYoPNnbvbbgyHTTWHnL6iWD28UzO
mYT9fV1smfX+J+n9LQsfZYAcC0KLFws4wIVQ56BP49mNMcV8OuBxJcI/c26vU7Jp
zg9c+1+buYjOveoHiWHiPHcBL3hfadyW4WUbYmattpE6vVdl281S1KP2L0opVfG3
sEgR82Y/2lTXzaPuEFmCZZZIyiWe+OZji2OfQ0rzfzjntqG0qmtcYsEnh6GgUbQp
DOt4Ji4X+xITQmWjkYUtIMOXS6tKGbkYZbMLXSCjuMRJbBGbBIQFP6S0Zq0uXcXl
zXzfCfmDnOH+qnaeO3D4c+ZNUuXADhDicB6Iw5JJd3Dlh0FQgZE=
=HOmJ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.