1 |
I've implemented a new feature for Portage which alters the way it |
2 |
handles config-protected files. Instead of creating ._cfg????_* files, |
3 |
it copies installed config files to a tree under |
4 |
/var/cache/edb/config_protect, keeping a separate copy for each version |
5 |
installed and cleaning out old versions as config files are updated |
6 |
(using etc-update). |
7 |
|
8 |
I've attached it to bug #4709 (auto config-update feature) |
9 |
<http://bugs.gentoo.org/show_bug.cgi?id=4709>, which seemed to be the |
10 |
most relevant. |
11 |
|
12 |
This allows for better upgrading by allowing Portage to automatically |
13 |
replace unchanged config files or even auto-merging new changes into |
14 |
altered config files (ala CVS), as well as allowing etc-update to |
15 |
support 3-way merges (using diff3 or Emacs). |
16 |
|
17 |
Briefly, the patch implements the following features: |
18 |
|
19 |
* Alter config file handling (keeping current versions). |
20 |
* Auto-migrate ._cfg files to new structure during Portage upgrade. |
21 |
* Auto-replace unchanged config files when new versions are |
22 |
installed. |
23 |
* New FEATURE config_automerge tells Portage to automatically merge |
24 |
config file changes into the current file. Finding a conflict |
25 |
aborts this merge. |
26 |
* Implement etc-update in python. |
27 |
* Fully implement 'menu' mode in etc-update (using dialog). |
28 |
Requires pythondialog |
29 |
<http://bugs.gentoo.org/show_bug.cgi?id=15238>. |
30 |
* Support 3-way diffs/merges in etc-update. |
31 |
|
32 |
A couple things I didn't do: |
33 |
|
34 |
* Cache MD5 sums for installed config files. While it does take a |
35 |
bit of time to recalculate this during an upgrade, it seems to be |
36 |
a minimal part of the overall install process. And this would be |
37 |
easy to implement if it were felt to be necessary. |
38 |
* Support config files being renamed between versions (ie, |
39 |
/etc/apache/apache.conf -> /etc/apache/conf/apache.conf). |
40 |
|
41 |
However, I think this patch gets us most of the way to having a much |
42 |
better config management system. I've been running this for about a |
43 |
week now and I love it. |
44 |
|
45 |
If people could test this out and let me know how it looks, whether |
46 |
they have any problems, what they think of the new behavior, etc., I'd |
47 |
appreciate it. I'd love to see this get added to the standard |
48 |
distribution as soon as possible. And this is my first attempt at doing |
49 |
anything in Python, so please be gentle. ;-) |
50 |
|
51 |
BE AWARE that the ebuild will automatically run |
52 |
/usr/lib/portage/bin/migrate-config on pkg_postinst to move ._cfg* |
53 |
files to the new structure. If you don't trust it to do this properly |
54 |
(or just want them copied instead), be sure to edit the ebuild before |
55 |
you run it. |
56 |
|
57 |
One other thing I wanted to point out is that I renamed portage.py to |
58 |
portage/__init__.py and added the new functionality in |
59 |
portage/config_protect.py. This change will allow the portage module to |
60 |
eventually be broken up into separate smaller modules. I think this |
61 |
would be a good thing from a maintenance standpoint. |
62 |
|
63 |
|
64 |
-- |
65 |
gentoo-dev@g.o mailing list |