1 |
Michal, Zac, did you have time to look at this serie of patches ? |
2 |
|
3 |
Bertrand |
4 |
|
5 |
On Tue, Sep 30, 2014 at 3:16 PM, Bertrand Simonnet <bsimonnet@××××××××.org> |
6 |
wrote: |
7 |
|
8 |
> Please discard the last serie of patches. git send-email was not |
9 |
> configured correctly and some commands I typed yesterday are being send |
10 |
> now. |
11 |
> Sorry about that. |
12 |
> |
13 |
> Bertrand |
14 |
> |
15 |
> On Mon, Sep 29, 2014 at 3:31 PM, Bertrand SIMONNET <bsimonnet@××××××××.org |
16 |
> > wrote: |
17 |
> |
18 |
>> Profiles can define per-package bashrc files to be sourced before |
19 |
>> emerging. |
20 |
>> Each line in package.bashrc must be an atom name then a list of |
21 |
>> space-delimited |
22 |
>> bashrc files (stored in $profile/bashrc/). |
23 |
>> --- |
24 |
>> bin/ebuild.sh | 6 ++-- |
25 |
>> bin/phase-functions.sh | 2 +- |
26 |
>> bin/save-ebuild-env.sh | 2 +- |
27 |
>> man/portage.5 | 30 |
28 |
>> +++++++++++++++++- |
29 |
>> .../package/ebuild/_config/special_env_vars.py | 4 +-- |
30 |
>> pym/portage/package/ebuild/config.py | 36 |
31 |
>> ++++++++++++++++++++++ |
32 |
>> pym/portage/package/ebuild/doebuild.py | 4 ++- |
33 |
>> pym/portage/repository/config.py | 2 +- |
34 |
>> 8 files changed, 76 insertions(+), 10 deletions(-) |
35 |
>> |
36 |
>> diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
37 |
>> index 14cc321..50909e1 100755 |
38 |
>> --- a/bin/ebuild.sh |
39 |
>> +++ b/bin/ebuild.sh |
40 |
>> @@ -368,10 +368,10 @@ __source_all_bashrcs() { |
41 |
>> # source the existing profile.bashrcs. |
42 |
>> save_IFS |
43 |
>> IFS=$'\n' |
44 |
>> - local path_array=($PROFILE_PATHS) |
45 |
>> + local bashenv_files=($PORTAGE_BASHRC_FILES) |
46 |
>> restore_IFS |
47 |
>> - for x in "${path_array[@]}" ; do |
48 |
>> - [ -f "$x/profile.bashrc" ] && __qa_source |
49 |
>> "$x/profile.bashrc" |
50 |
>> + for x in "${bashenv_files[@]}" ; do |
51 |
>> + __try_source "${x}" |
52 |
>> done |
53 |
>> fi |
54 |
>> |
55 |
>> diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh |
56 |
>> index f39a024..5dff3bb 100644 |
57 |
>> --- a/bin/phase-functions.sh |
58 |
>> +++ b/bin/phase-functions.sh |
59 |
>> @@ -31,7 +31,7 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE |
60 |
>> EBUILD_PHASE_FUNC \ |
61 |
>> PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \ |
62 |
>> PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \ |
63 |
>> PORTDIR \ |
64 |
>> - PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \ |
65 |
>> + REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \ |
66 |
>> __PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS" |
67 |
>> |
68 |
>> PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR" |
69 |
>> diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh |
70 |
>> index f114c48..1a684b9 100644 |
71 |
>> --- a/bin/save-ebuild-env.sh |
72 |
>> +++ b/bin/save-ebuild-env.sh |
73 |
>> @@ -97,7 +97,7 @@ __save_ebuild_env() { |
74 |
>> GOOD HILITE HOME \ |
75 |
>> LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS |
76 |
>> MOPREFIX \ |
77 |
>> NOCOLOR NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \ |
78 |
>> - PORTAGE_BASHRCS_SOURCED PORTAGE_COMPRESS \ |
79 |
>> + PORTAGE_BASHRC_FILES PORTAGE_BASHRCS_SOURCED |
80 |
>> PORTAGE_COMPRESS \ |
81 |
>> PORTAGE_COMPRESS_EXCLUDE_SUFFIXES \ |
82 |
>> PORTAGE_DOHTML_UNWARNED_SKIPPED_EXTENSIONS \ |
83 |
>> PORTAGE_DOHTML_UNWARNED_SKIPPED_FILES \ |
84 |
>> diff --git a/man/portage.5 b/man/portage.5 |
85 |
>> index e399f0f..309e259 100644 |
86 |
>> --- a/man/portage.5 |
87 |
>> +++ b/man/portage.5 |
88 |
>> @@ -24,6 +24,7 @@ make.defaults |
89 |
>> packages |
90 |
>> packages.build |
91 |
>> package.accept_keywords |
92 |
>> +package.bashrc |
93 |
>> package.keywords |
94 |
>> package.mask |
95 |
>> package.provided |
96 |
>> @@ -358,6 +359,31 @@ a '\-'. |
97 |
>> A list of packages (one per line) that make up a stage1 tarball. Really |
98 |
>> only |
99 |
>> useful for stage builders. |
100 |
>> .TP |
101 |
>> +.BR package.bashrc |
102 |
>> +Per-package bashrc mechanism. Contains a list of bashrc files to be |
103 |
>> sourced |
104 |
>> +before emerging a given atom. The bashrc files must be stored in |
105 |
>> bashrc/, in |
106 |
>> +the profile directory. |
107 |
>> + |
108 |
>> +.I Note: |
109 |
>> +.nf |
110 |
>> +\- The bashrc files will be sourced after profile.bashrc for the same |
111 |
>> profile. |
112 |
>> +\- profile-formats in metadata/layout.conf must contain profile-bashrcs |
113 |
>> for this |
114 |
>> +to be enabled. |
115 |
>> +.fi |
116 |
>> + |
117 |
>> +.I Format: |
118 |
>> +.nf |
119 |
>> +\- comments begin with # (no inline comments). |
120 |
>> +\- one atom per line with space-delimited list of bashrc files. |
121 |
>> +.fi |
122 |
>> + |
123 |
>> +.I Example: |
124 |
>> +.nf |
125 |
>> +# By setting INSTALL_MASK in bashrc/nostandardconf.conf, we can avoid |
126 |
>> installing |
127 |
>> +# the standard configuration and enable another package to install it. |
128 |
>> +net-misc/dhcp nostardardconf.conf |
129 |
>> +.fi |
130 |
>> +.TP |
131 |
>> .BR package.provided |
132 |
>> A list of packages (one per line) that portage should assume have been |
133 |
>> provided. Useful for porting to non-Linux systems. Basically, it's a |
134 |
>> @@ -1047,11 +1073,13 @@ The default setting for repoman's --echangelog |
135 |
>> option. |
136 |
>> The cache formats supported in the metadata tree. There is the old |
137 |
>> "pms" format |
138 |
>> and the newer/faster "md5-dict" format. Default is to detect dirs. |
139 |
>> .TP |
140 |
>> -.BR profile\-formats " = [pms|portage-1|portage-2]" |
141 |
>> +.BR profile\-formats " = [pms|portage-1|portage-2|profile-bashrcs]" |
142 |
>> Control functionality available to profiles in this repo such as which |
143 |
>> files |
144 |
>> may be dirs, or the syntax available in parent files. Use "portage-2" |
145 |
>> if you're |
146 |
>> unsure. The default is "portage-1-compat" mode which is meant to be |
147 |
>> compatible |
148 |
>> with old profiles, but is not allowed to be opted into directly. |
149 |
>> +Setting profile-bashrcs will enable the per-profile bashrc mechanism |
150 |
>> +\fBpackage.bashrc\fR. |
151 |
>> .RE |
152 |
>> .RE |
153 |
>> |
154 |
>> diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py |
155 |
>> b/pym/portage/package/ebuild/_config/special_env_vars.py |
156 |
>> index 74fedd6..387f4ae 100644 |
157 |
>> --- a/pym/portage/package/ebuild/_config/special_env_vars.py |
158 |
>> +++ b/pym/portage/package/ebuild/_config/special_env_vars.py |
159 |
>> @@ -49,7 +49,7 @@ environ_whitelist += [ |
160 |
>> "FEATURES", "FILESDIR", "HOME", "MERGE_TYPE", "NOCOLOR", "PATH", |
161 |
>> "PKGDIR", |
162 |
>> "PKGUSE", "PKG_LOGDIR", "PKG_TMPDIR", |
163 |
>> - "PORTAGE_ACTUAL_DISTDIR", "PORTAGE_ARCHLIST", |
164 |
>> + "PORTAGE_ACTUAL_DISTDIR", "PORTAGE_ARCHLIST", |
165 |
>> "PORTAGE_BASHRC_FILES", |
166 |
>> "PORTAGE_BASHRC", "PM_EBUILD_HOOK_DIR", |
167 |
>> "PORTAGE_BINPKG_FILE", "PORTAGE_BINPKG_TAR_OPTS", |
168 |
>> "PORTAGE_BINPKG_TMPFILE", |
169 |
>> @@ -74,7 +74,7 @@ environ_whitelist += [ |
170 |
>> "PORTAGE_SIGPIPE_STATUS", |
171 |
>> "PORTAGE_TMPDIR", "PORTAGE_UPDATE_ENV", "PORTAGE_USERNAME", |
172 |
>> "PORTAGE_VERBOSE", "PORTAGE_WORKDIR_MODE", |
173 |
>> "PORTAGE_XATTR_EXCLUDE", |
174 |
>> - "PORTDIR", "PORTDIR_OVERLAY", "PREROOTPATH", "PROFILE_PATHS", |
175 |
>> + "PORTDIR", "PORTDIR_OVERLAY", "PREROOTPATH", |
176 |
>> "REPLACING_VERSIONS", "REPLACED_BY_VERSION", |
177 |
>> "ROOT", "ROOTPATH", "T", "TMP", "TMPDIR", |
178 |
>> "USE_EXPAND", "USE_ORDER", "WORKDIR", |
179 |
>> diff --git a/pym/portage/package/ebuild/config.py |
180 |
>> b/pym/portage/package/ebuild/config.py |
181 |
>> index f639e14..183627f 100644 |
182 |
>> --- a/pym/portage/package/ebuild/config.py |
183 |
>> +++ b/pym/portage/package/ebuild/config.py |
184 |
>> @@ -316,6 +316,7 @@ class config(object): |
185 |
>> self._accept_restrict = |
186 |
>> copy.deepcopy(clone._accept_restrict) |
187 |
>> self._paccept_restrict = |
188 |
>> copy.deepcopy(clone._paccept_restrict) |
189 |
>> self._penvdict = copy.deepcopy(clone._penvdict) |
190 |
>> + self._pbashrcdict = |
191 |
>> copy.deepcopy(clone._pbashrcdict) |
192 |
>> self._expand_map = |
193 |
>> copy.deepcopy(clone._expand_map) |
194 |
>> |
195 |
>> else: |
196 |
>> @@ -661,6 +662,7 @@ class config(object): |
197 |
>> self._ppropertiesdict = |
198 |
>> portage.dep.ExtendedAtomDict(dict) |
199 |
>> self._paccept_restrict = |
200 |
>> portage.dep.ExtendedAtomDict(dict) |
201 |
>> self._penvdict = |
202 |
>> portage.dep.ExtendedAtomDict(dict) |
203 |
>> + self._pbashrcdict = {} |
204 |
>> |
205 |
>> self._repo_make_defaults = {} |
206 |
>> for repo in |
207 |
>> self.repositories.repos_with_profiles(): |
208 |
>> @@ -742,6 +744,25 @@ class config(object): |
209 |
>> for k, v in penvdict.items(): |
210 |
>> self._penvdict.setdefault(k.cp, |
211 |
>> {})[k] = v |
212 |
>> |
213 |
>> + # package.bashrc |
214 |
>> + for profile in profiles_complex: |
215 |
>> + if not 'profile-bashrcs' in |
216 |
>> profile.profile_formats: |
217 |
>> + continue |
218 |
>> + self._pbashrcdict[profile] = \ |
219 |
>> + |
220 |
>> portage.dep.ExtendedAtomDict(dict) |
221 |
>> + bashrc = |
222 |
>> grabdict_package(os.path.join(profile.location, |
223 |
>> + "package.bashrc"), |
224 |
>> recursive=1, allow_wildcard=True, |
225 |
>> + |
226 |
>> allow_repo=True, verify_eapi=False) |
227 |
>> + if not bashrc: |
228 |
>> + continue |
229 |
>> + |
230 |
>> + for k, v in bashrc.items(): |
231 |
>> + envfiles = |
232 |
>> [os.path.join(profile.location, |
233 |
>> + "bashrc", |
234 |
>> + envname) for |
235 |
>> envname in v] |
236 |
>> + |
237 |
>> self._pbashrcdict[profile].setdefault(k.cp, {})\ |
238 |
>> + .setdefault(k, |
239 |
>> []).extend(envfiles) |
240 |
>> + |
241 |
>> #getting categories from an external file now |
242 |
>> self.categories = [grabfile(os.path.join(x, |
243 |
>> "categories")) \ |
244 |
>> for x in |
245 |
>> locations_manager.profile_and_user_locations] |
246 |
>> @@ -1501,6 +1522,21 @@ class config(object): |
247 |
>> for x in penv_matches: |
248 |
>> self._penv.extend(x) |
249 |
>> |
250 |
>> + bashrc_files = [] |
251 |
>> + |
252 |
>> + for profile in self._locations_manager.profiles_complex: |
253 |
>> + bashrc_files.append(os.path.join(profile.location, |
254 |
>> + 'profile.bashrc')) |
255 |
>> + if profile in self._pbashrcdict: |
256 |
>> + cpdict = |
257 |
>> self._pbashrcdict[profile].get(cp) |
258 |
>> + if cpdict: |
259 |
>> + bashrc_matches = \ |
260 |
>> + |
261 |
>> ordered_by_atom_specificity(cpdict, cpv_slot) |
262 |
>> + for x in bashrc_matches: |
263 |
>> + bashrc_files.extend(x) |
264 |
>> + |
265 |
>> + self.configdict["BASHRC_FILES"] = bashrc_files |
266 |
>> + |
267 |
>> protected_pkg_keys = set(pkg_configdict) |
268 |
>> protected_pkg_keys.discard('USE') |
269 |
>> |
270 |
>> diff --git a/pym/portage/package/ebuild/doebuild.py |
271 |
>> b/pym/portage/package/ebuild/doebuild.py |
272 |
>> index 01707ae..5224775 100644 |
273 |
>> --- a/pym/portage/package/ebuild/doebuild.py |
274 |
>> +++ b/pym/portage/package/ebuild/doebuild.py |
275 |
>> @@ -335,7 +335,9 @@ def doebuild_environment(myebuild, mydo, myroot=None, |
276 |
>> settings=None, |
277 |
>> mysettings["ECLASSDIR"] = mysettings["PORTDIR"]+"/eclass" |
278 |
>> mysettings["SANDBOX_LOG"] = mycpv.replace("/", "_-_") |
279 |
>> |
280 |
>> - mysettings["PROFILE_PATHS"] = "\n".join(mysettings.profiles) |
281 |
>> + mysettings["PORTAGE_BASHRC_FILES"] = \ |
282 |
>> + "\n".join(mysettings.configdict["BASHRC_FILES"]) |
283 |
>> + |
284 |
>> mysettings["P"] = mysplit[0]+"-"+mysplit[1] |
285 |
>> mysettings["PN"] = mysplit[0] |
286 |
>> mysettings["PV"] = mysplit[1] |
287 |
>> diff --git a/pym/portage/repository/config.py |
288 |
>> b/pym/portage/repository/config.py |
289 |
>> index 5e0d055..bef643d 100644 |
290 |
>> --- a/pym/portage/repository/config.py |
291 |
>> +++ b/pym/portage/repository/config.py |
292 |
>> @@ -40,7 +40,7 @@ if sys.hexversion >= 0x3000000: |
293 |
>> _invalid_path_char_re = re.compile(r'[^a-zA-Z0-9._\-+:/]') |
294 |
>> |
295 |
>> _valid_profile_formats = frozenset( |
296 |
>> - ['pms', 'portage-1', 'portage-2']) |
297 |
>> + ['pms', 'portage-1', 'portage-2', 'profile-bashrcs']) |
298 |
>> |
299 |
>> _portage1_profiles_allow_directories = frozenset( |
300 |
>> ["portage-1-compat", "portage-1", 'portage-2']) |
301 |
>> -- |
302 |
>> 2.1.0.rc2.206.gedb03e5 |
303 |
>> |
304 |
>> |
305 |
> |