1 |
Fellow devs, |
2 |
|
3 |
Many packages have far more options than are presented to gentoo users though |
4 |
an ebuild interface. By embracing the principles of choice[1] the gentoo |
5 |
developers have an obligation to provide a far range of choice on their |
6 |
installation. This is particularly important in: |
7 |
- embedded applications - where size matters |
8 |
- secure configuration - minimal feature install to reduce risk caused by zero |
9 |
day vulnerabilities |
10 |
- hardware support - lots of hardware drivers in the same package and a user |
11 |
will only wants one or small number of them |
12 |
- customisation for your hardware - compile time memory guidelines/limits |
13 |
- customisation because, after all, thats why the upstream put it there! |
14 |
|
15 |
Ebuilds that already have their implementation of savedconfig: |
16 |
|
17 |
sys-apps/busybox |
18 |
sys-libs/uclibc |
19 |
x11-wm/dwm |
20 |
x11-misc/dmenu |
21 |
|
22 |
Other potential candidates: |
23 |
net-misc/dropbear [2] |
24 |
app-emulation/mol |
25 |
app-shells/tcsh |
26 |
dev-libs/klibc |
27 |
dev-lang/ccc |
28 |
mail-mta/sendmail |
29 |
net-dialup/isdn4k-utils |
30 |
net-im/kadu |
31 |
net-irc/cyclone |
32 |
net-wireless/wpa_supplicant |
33 |
sys-boot/netboot |
34 |
sys-libs/uclibc++ |
35 |
www-apache/mod_* |
36 |
net-misc/asterisk |
37 |
net-misc/zaptel |
38 |
dev-lang/php |
39 |
|
40 |
The "savedconfig" configuration control aims: |
41 |
- provide user with with choices where they make a difference |
42 |
- provide a single point for configuration editing |
43 |
- reduce developer effort by supporting every option available without packing |
44 |
an ebuild full of USE flags |
45 |
- reduce USE flag bloat where no dependencies are affected |
46 |
- limit the mass use of USE_EXPAND |
47 |
|
48 |
The "savedconfig" configuration control does NOT aim to: |
49 |
- replace the USE flag determination of dependencies |
50 |
- provide an interface to options where there is only a small number of |
51 |
options |
52 |
- replace global USE flags that have ebuild purpose |
53 |
|
54 |
IMPLEMENTION |
55 |
|
56 |
In keeping with existing convention /etc/portage/savedconfig seems to be the |
57 |
logical choice as to where to store configuration. It has CONFIG_PROTECT and |
58 |
is close to the package.uses files (where other configuration control exists). |
59 |
|
60 |
INTERFACE: |
61 |
|
62 |
A user that wishes to customise a particular package will: |
63 |
1. Emerge the package to obtain the default configuration (I can see how this |
64 |
could be generally avoided) |
65 |
2. Edit the saved configuration in /etc/portage/savedconfig/${CATEGORY}/${PF} |
66 |
3. adds "${CATEGORY}/${P*} savedconfig -*" atom to /etc/portage/package.uses. |
67 |
(configuration controlling USE flags should be omitted) |
68 |
4. Reemerge the package |
69 |
|
70 |
By default packages that have the option of restoring a saved config will, |
71 |
without specific USE flags or options, store their config. |
72 |
|
73 |
ECLASS INTERFACES |
74 |
|
75 |
STORE_CONFIG |
76 |
|
77 |
store_config -s name1,name2,name3 (file/directory)...... |
78 |
|
79 |
Stores the specific file(s)/directory(ies) in the directory |
80 |
${D}/etc/portage/savedconfig/${CATEGORY}/${PF}/ |
81 |
|
82 |
If a single file is the only arguement then the file is copied to |
83 |
${D}/etc/portage/savedconfig/${CATEGORY}/${PF} |
84 |
|
85 |
store_config should only be called from pkg_preinst or src_install |
86 |
|
87 |
Also creates the following symlinks to it |
88 |
/etc/portage/savedconfig/${CATEGORY}/${P} |
89 |
/etc/portage/savedconfig/${CATEGORY}/${PN}-$(get_version_component_range 1-x) |
90 |
/etc/portage/savedconfig/${CATEGORY}/${PN}-$(get_version_component_range |
91 |
1-(x-1)) |
92 |
.. |
93 |
.. |
94 |
/etc/portage/savedconfig/${CATEGORY}/${PN} |
95 |
|
96 |
As some packages, like uclibc, have regular cross compile functionality which |
97 |
require separate config files for each host. This can be achieved with the -s |
98 |
option. |
99 |
|
100 |
store_config -s ${CTARGET},${CHOST} .config |
101 |
will copy .config to: |
102 |
/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${P} |
103 |
and create the following symlinks: |
104 |
/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${P} |
105 |
/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${PN}-$(get_version_component_range |
106 |
1-x) |
107 |
/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${PN}-$(get_version_component_range |
108 |
1-x) |
109 |
/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${PN}-$(get_version_component_range |
110 |
1-(x-1)) |
111 |
/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${PN}-$(get_version_component_range |
112 |
1-(x-1)) |
113 |
.. |
114 |
.. |
115 |
/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${PN} |
116 |
/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${PN} |
117 |
|
118 |
Q1 I'm open to suggestion that all CTARGETS should occur before CHOSTS |
119 |
|
120 |
Baselevel symlinks, /etc/portage/savedconfig/${CATEGORY}/... can occur if you |
121 |
specify a empty -s name using an extra comma i.e. |
122 |
save_config -s ${CTARGET},${CHOST}, .config |
123 |
|
124 |
|
125 |
RESTORE_CONFIG |
126 |
|
127 |
restore_config -s name1,name2... (file/directory) .... |
128 |
|
129 |
Restores the config from the closest match from above (in same order) *IF* |
130 |
USE=savedconfig. |
131 |
|
132 |
restore_config should be called in src_unpack or src_compile after any |
133 |
competing USE flags have been selected. |
134 |
|
135 |
store_config and restore config should have the same arguements. |
136 |
|
137 |
[1] http://www.gentoo.org/foundation/en/#doc_chap2 |
138 |
[2] https://bugs.gentoo.org/show_bug.cgi?id=158185 |
139 |
|
140 |
If the -s option is used the config files are restored in the same order |
141 |
listed in save_config with the -s. |
142 |
|
143 |
WARN_CONFIG |
144 |
|
145 |
warn_config (useflags) |
146 |
|
147 |
warns the user that the useflags have been overridden by savedconfig |
148 |
|
149 |
Anything else? |
150 |
|
151 |
Daniel Black <dragonheart@g.o> |
152 |
Gentoo Foundation |