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

Force re-indexing of locally built packages if "local" channel is present

parent 67724e15
Branches
Tags
1 merge request!46Force re-indexing of locally built packages if "local" channel is present
Pipeline #29415 failed
......@@ -471,7 +471,7 @@ def git_clean_build(runner, verbose):
['--exclude=%s' % k for k in exclude_from_cleanup])
def base_build(bootstrap, server, intranet, group, recipe_dir,
def base_build(bootstrap, server, intranet, use_local, group, recipe_dir,
conda_build_config, python_version, condarc_options):
'''Builds a non-beat/non-bob software dependence that doesn't exist on defaults
......@@ -489,6 +489,8 @@ def base_build(bootstrap, server, intranet, group, recipe_dir,
server: The base address of the server containing our conda channels
intranet: Boolean indicating if we should add "private"/"public" prefixes
on the returned paths
use_local: If set to ``True``, search locally built packages when looking
for dependencies
group: The group of packages (gitlab namespace) the package we're compiling
is part of. Values should match URL namespaces currently available on
our internal webserver. Currently, only "bob" or "beat" will work.
......@@ -514,9 +516,16 @@ def base_build(bootstrap, server, intranet, group, recipe_dir,
public_channels = bootstrap.get_channels(public=True, stable=True,
server=server, intranet=intranet, group=group)
all_channels = ['local'] if use_local else []
all_channels += public_channels + ['defaults']
logger.info('Using the following channels during (potential) build:\n - %s',
'\n - '.join(public_channels + ['defaults']))
condarc_options['channels'] = public_channels + ['defaults']
'\n - '.join(all_channels))
condarc_options['channels'] = all_channels
# updates the local index to get fresh packages if required
if use_local:
prefix = get_env_directory(os.environ['CONDA_EXE'], 'base')
conda_build.api.update_index(os.path.join(prefix, 'conda-bld'))
logger.info('Merging conda configuration files...')
if python_version not in ('noarch', None):
......@@ -642,8 +651,9 @@ if __name__ == '__main__':
if not os.path.exists(os.path.join(recipe, 'meta.yaml')):
# ignore - not a conda package
continue
base_build(bootstrap, server, not args.internet, args.group, recipe,
conda_build_config, args.python_version, condarc_options)
base_build(bootstrap, server, not args.internet, True,
args.group, recipe, conda_build_config, args.python_version,
condarc_options)
# notice this condarc typically will only contain the defaults channel - we
# need to boost this up with more channels to get it right for this package's
......
......@@ -118,6 +118,10 @@ def build(recipe_dir, python, condarc, config, no_test, append_file,
prefix = get_env_directory(os.environ['CONDA_EXE'], 'base')
condarc_options['croot'] = os.path.join(prefix, 'conda-bld')
# updates the local index to get fresh packages if required
if use_local:
conda_build.api.update_index(os.path.join(prefix, 'conda-bld'))
conda_config = make_conda_config(config, python, append_file,
condarc_options)
......
......@@ -8,7 +8,6 @@ import shutil
import yaml
import click
import pkg_resources
import conda_build.api
from click_plugins import with_plugins
from . import bdt
......@@ -315,8 +314,17 @@ def base_build(order, group, python, dry_run):
if not os.path.exists(os.path.join(recipe, 'meta.yaml')):
logger.info('Ignoring directory "%s" - no meta.yaml found' % recipe)
continue
_build(bootstrap, SERVER, True, group, recipe, CONDA_BUILD_CONFIG, pyver,
condarc_options)
_build(
bootstrap=bootstrap,
server=SERVER,
intranet=True,
use_local=True,
group=group,
recipe_dir=recipe,
conda_build_config=CONDA_BUILD_CONFIG,
python_version=pyver,
condarc_options=condarc_options,
)
@ci.command(epilog='''
......
......@@ -103,6 +103,11 @@ def test(package, condarc, config, append_file, server, group, private, stable,
'\n - '.join(all_channels))
condarc_options['channels'] = all_channels
# updates the local index to get fresh packages if required
if use_local and not dry_run:
prefix = get_env_directory(os.environ['CONDA_EXE'], 'base')
conda_build.api.update_index(os.path.join(prefix, 'conda-bld'))
conda_config = make_conda_config(config, None, append_file,
condarc_options)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment