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