Skip to content
Snippets Groups Projects
Commit 4f636eb2 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[build] Fix base_build() with a proper support for multi-package-building through conda-build

parent e8029310
No related branches found
No related tags found
1 merge request!160Fix base_build() with a proper support for multi-package-building through conda-build
Pipeline #40140 failed
...@@ -215,7 +215,7 @@ def make_conda_config(config, python, append_file, condarc_options): ...@@ -215,7 +215,7 @@ def make_conda_config(config, python, append_file, condarc_options):
def get_output_path(metadata, config): def get_output_path(metadata, config):
"""Renders the recipe and returns the name of the output file.""" """Renders the recipe and returns the name of the output file."""
return conda_build.api.get_output_file_paths(metadata, config=config)[0] return conda_build.api.get_output_file_paths(metadata, config=config)
def get_rendered_metadata(recipe_dir, config): def get_rendered_metadata(recipe_dir, config):
...@@ -565,7 +565,6 @@ def base_build( ...@@ -565,7 +565,6 @@ def base_build(
group, group,
recipe_dir, recipe_dir,
conda_build_config, conda_build_config,
python_version,
condarc_options, condarc_options,
): ):
"""Builds a non-beat/non-bob software dependence that doesn't exist on """Builds a non-beat/non-bob software dependence that doesn't exist on
...@@ -590,11 +589,6 @@ def base_build( ...@@ -590,11 +589,6 @@ def base_build(
our internal webserver. Currently, only "bob" or "beat" will work. our internal webserver. Currently, only "bob" or "beat" will work.
recipe_dir: The directory containing the recipe's ``meta.yaml`` file recipe_dir: The directory containing the recipe's ``meta.yaml`` file
conda_build_config: Path to the ``conda_build_config.yaml`` file to use conda_build_config: Path to the ``conda_build_config.yaml`` file to use
python_version: String with the python version to build for, in the format
``x.y`` (should be passed even if not building a python package). It
can also be set to ``noarch``, or ``None``. If set to ``None``, then we
don't assume there is a python-specific version being built. If set to
``noarch``, then it is a python package without a specific build.
condarc_options: Pre-parsed condarc options loaded from the respective YAML condarc_options: Pre-parsed condarc options loaded from the respective YAML
file file
...@@ -619,54 +613,33 @@ def base_build( ...@@ -619,54 +613,33 @@ def base_build(
"\n - ".join(condarc_options["channels"]), "\n - ".join(condarc_options["channels"]),
) )
logger.info("Merging conda configuration files...") logger.info("Merging conda configuration files...")
if python_version not in ("noarch", None): conda_config = make_conda_config(
conda_config = make_conda_config( conda_build_config, None, None, condarc_options
conda_build_config, python_version, None, condarc_options )
)
else:
conda_config = make_conda_config(
conda_build_config, None, None, condarc_options
)
metadata = get_rendered_metadata(recipe_dir, conda_config) metadata = get_rendered_metadata(recipe_dir, conda_config)
# handles different cases as explained on the description of
# ``python_version``
py_ver = python_version.replace(".", "") if python_version else None
if py_ver == "noarch":
py_ver = ""
arch = conda_arch() arch = conda_arch()
# checks we should actually build this recipe # checks we should actually build this recipe
if should_skip_build(metadata): if should_skip_build(metadata):
if py_ver is None: logger.warn('Skipping UNSUPPORTED build of "%s" on %s', recipe_dir, arch)
logger.warn(
'Skipping UNSUPPORTED build of "%s" on %s', recipe_dir, arch
)
elif not py_ver:
logger.warn(
'Skipping UNSUPPORTED build of "%s" for (noarch) python '
"on %s",
recipe_dir,
arch,
)
else:
logger.warn(
'Skipping UNSUPPORTED build of "%s" for python-%s ' "on %s",
recipe_dir,
python_version,
arch,
)
return return
path = get_output_path(metadata, conda_config) paths = get_output_path(metadata, conda_config)
urls = [exists_on_channel(channels[0], os.path.basename(k)) for k in paths]
if all(urls):
logger.info("Skipping build for %s as packages with matching "
"characteristics exist (%s)", path, ', '.join(urls))
return
url = exists_on_channel(channels[0], os.path.basename(path)) if any(urls):
if url is not None: logger.error("One or more packages for %s already exist (%s). "
logger.info("Skipping build for %s as it exists (at %s)", path, url) "Change the package build number to trigger a build.",
path, ', '.join(urls))
return return
# if you get to this point, just builds the package # if you get to this point, just builds the package(s)
logger.info("Building %s", path) logger.info("Building %s", path)
return conda_build.api.build(recipe_dir, config=conda_config) return conda_build.api.build(recipe_dir, config=conda_config)
...@@ -839,7 +812,7 @@ if __name__ == "__main__": ...@@ -839,7 +812,7 @@ if __name__ == "__main__":
recipe_dir = os.path.join(args.work_dir, "conda") recipe_dir = os.path.join(args.work_dir, "conda")
metadata = get_rendered_metadata(recipe_dir, conda_config) metadata = get_rendered_metadata(recipe_dir, conda_config)
path = get_output_path(metadata, conda_config) path = get_output_path(metadata, conda_config)[0]
# asserts we're building at the right location # asserts we're building at the right location
assert path.startswith(os.path.join(args.conda_root, "conda-bld")), ( assert path.startswith(os.path.join(args.conda_root, "conda-bld")), (
......
...@@ -124,7 +124,7 @@ def compute_adjencence_matrix( ...@@ -124,7 +124,7 @@ def compute_adjencence_matrix(
# pre-renders the recipe - figures out the destination # pre-renders the recipe - figures out the destination
metadata = get_rendered_metadata(recipe_dir, conda_config) metadata = get_rendered_metadata(recipe_dir, conda_config)
rendered_recipe = get_parsed_recipe(metadata) rendered_recipe = get_parsed_recipe(metadata)
path = get_output_path(metadata, conda_config) path = get_output_path(metadata, conda_config)[0]
# gets the next build number # gets the next build number
build_number, _ = next_build_number( build_number, _ = next_build_number(
......
...@@ -266,7 +266,7 @@ def build( ...@@ -266,7 +266,7 @@ def build(
continue continue
rendered_recipe = get_parsed_recipe(metadata) rendered_recipe = get_parsed_recipe(metadata)
path = get_output_path(metadata, conda_config) path = get_output_path(metadata, conda_config)[0]
# gets the next build number # gets the next build number
build_number, _ = next_build_number(channels[0], os.path.basename(path)) build_number, _ = next_build_number(channels[0], os.path.basename(path))
......
...@@ -176,13 +176,6 @@ Examples: ...@@ -176,13 +176,6 @@ Examples:
"(combine with the verbosity flags - e.g. ``-vvv``) to enable " "(combine with the verbosity flags - e.g. ``-vvv``) to enable "
"printing to help you understand what will be done", "printing to help you understand what will be done",
) )
@click.option(
"-p",
"--python",
multiple=True,
help='Versions of python in the format "x.y" we should build for. Pass '
"various times this option to build for multiple python versions",
)
@click.option( @click.option(
"-g", "-g",
"--group", "--group",
...@@ -196,7 +189,4 @@ Examples: ...@@ -196,7 +189,4 @@ Examples:
def base_build(ctx, order, dry_run, python, group): def base_build(ctx, order, dry_run, python, group):
"""Run the CI build step locally.""" """Run the CI build step locally."""
set_up_environment_variables(python=python, name_space=group) set_up_environment_variables(python=python, name_space=group)
ctx.invoke(ci.base_build, order=order, dry_run=dry_run, group=group)
ctx.invoke(
ci.base_build, order=order, dry_run=dry_run, group=group, python=python
)
...@@ -253,7 +253,7 @@ def rebuild( ...@@ -253,7 +253,7 @@ def rebuild(
continue continue
rendered_recipe = get_parsed_recipe(metadata) rendered_recipe = get_parsed_recipe(metadata)
path = get_output_path(metadata, conda_config) path = get_output_path(metadata, conda_config)[0]
# Get the latest build number # Get the latest build number
build_number, existing = next_build_number( build_number, existing = next_build_number(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment