|
150 | 150 | Options to be passed to emerge invocations. Taken from |
151 | 151 | ``--emerge-opts``. |
152 | 152 |
|
| 153 | + ``extra_env_files`` |
| 154 | + A list of extra /etc/portage/env/ file names, to be added to |
| 155 | + ``package.env`` entry when testing the package. Taken from |
| 156 | + ``--extra-env-file``. |
| 157 | +
|
153 | 158 | ``log_dir`` |
154 | 159 | irectory to save build logs for failing tasks. Taken from |
155 | 160 | ``--logs-dir``. |
|
172 | 177 | to ``emerge`` invocations. |
173 | 178 | """, |
174 | 179 | ) |
| 180 | +template_opts.add_argument( |
| 181 | + "--extra-env-file", |
| 182 | + default=[], |
| 183 | + metavar="ENV_FILE", |
| 184 | + action=arghparse.CommaSeparatedValuesAppend, |
| 185 | + help="Extra /etc/portage/env/ file names, to be used while testing packages. Can be passed multiple times.", |
| 186 | + docs=""" |
| 187 | + Comma separated filenames under /etc/portage/env/, which will all be |
| 188 | + included in the package.env entry when testing the package. |
| 189 | + """, |
| 190 | +) |
175 | 191 |
|
176 | 192 | portage_config = Path("/etc/portage") |
177 | 193 | portage_accept_keywords = portage_config / "package.accept_keywords" |
|
180 | 196 | portage_env = portage_config / "env" |
181 | 197 |
|
182 | 198 |
|
| 199 | +@tatt.bind_final_check |
| 200 | +def _tatt_validate(parser, namespace): |
| 201 | + for filename in namespace.extra_env_file: |
| 202 | + if not (env_file := portage_env / filename).exists(): |
| 203 | + parser.error(f"extra env file '{env_file}' doesn't exist") |
| 204 | + |
| 205 | + |
183 | 206 | @tatt.bind_final_check |
184 | 207 | def _validate_args(parser, namespace): |
185 | 208 | if namespace.bug is not None: |
@@ -254,7 +277,7 @@ def _groupby_use_expand( |
254 | 277 | return use_flags, use_expand_dict |
255 | 278 |
|
256 | 279 |
|
257 | | -def _build_job(namespace, pkg, is_test): |
| 280 | +def _build_job(namespace, pkg, is_test: bool): |
258 | 281 | use_expand_prefixes = tuple(s.lower() + "_" for s in namespace.domain.profile.use_expand) |
259 | 282 | default_on_iuse = tuple(use[1:] for use in pkg.iuse if use.startswith("+")) |
260 | 283 | immutable, enabled, _disabled = namespace.domain.get_package_use_unconfigured(pkg) |
@@ -373,6 +396,7 @@ def main(options, out, err): |
373 | 396 | job_name=job_name, |
374 | 397 | log_dir=options.logs_dir, |
375 | 398 | emerge_opts=options.emerge_opts, |
| 399 | + extra_env_files=options.extra_env_file, |
376 | 400 | cleanup_files=cleanup_files, |
377 | 401 | ) |
378 | 402 | with open(script_name := job_name + ".sh", "w") as output: |
|
0 commit comments