1 |
On 8/3/20 1:13 AM, Florian Schmaus wrote: |
2 |
> Portage's dispatch-conf does historically only support RCS for |
3 |
> configuration file archival. There are currently two unresolved |
4 |
> feature requests to extend dispatch-conf support for further |
5 |
> configuration file management tools: |
6 |
> |
7 |
> - bug #260623 git support for dispatch-conf [1] |
8 |
> - bug #698316 etckeeper support for dispatch-conf [2] |
9 |
> |
10 |
> Extending dispatch-conf by a hook directory, which can be used by |
11 |
> configuration file management tools to receive notifications about |
12 |
> dispatch-conf updating a configuration file, appears to be flexible |
13 |
> approach to satisfy those feature requests (or at least lay the |
14 |
> groundwork for them). |
15 |
> |
16 |
> Attached is a patch with a prototypical implementation for |
17 |
> conf-update.d hooks. I am curious whether or not you deem this useful |
18 |
> enough to get into dispatch-conf. |
19 |
|
20 |
Yes, and hooks are a great way to allow for customization. |
21 |
|
22 |
> If my suggested approach is considered sensible, then I am happy to |
23 |
continue the work on it. |
24 |
|
25 |
Yes, it looks good. I wonder if we should support hooks that are only |
26 |
called once per dispatch-conf session, rather than once per file. I see |
27 |
that your etckeeper hook does not utilize the file argument, so maybe it |
28 |
would make more sense to call it at the end of the dispatch-conf session? |
29 |
|
30 |
If it makes sense to have session hooks, then I suppose we can add a |
31 |
separate directory for them (kind of like how we have separate |
32 |
repo.postsync.d and postsync.d hooks). |
33 |
|
34 |
> For example, I want to write a unit test for this. But I am not sure if |
35 |
> portage's test framework already provides the necessary functionality |
36 |
> to create test scenarios for the conf-update.d hooks. Any pointers and |
37 |
> further feedback would be much appreciated. |
38 |
|
39 |
In lib/portage/tests/emerge/test_simple.py, we execute emerge, |
40 |
dispatch-conf, and etc-update inside a mock gentoo prefix environment. |
41 |
Maybe you can copy that file and modify it to do what you want. |
42 |
|
43 |
> |
44 |
> - Florian |
45 |
> |
46 |
> 1: https://bugs.gentoo.org/260623 |
47 |
> 2: https://bugs.gentoo.org/698316 |
48 |
-- |
49 |
Thanks, |
50 |
Zac |