From d047eb4013b01a691d1d0755c7e01ee0172b921e Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Fri, 6 Apr 2018 14:56:38 +0200
Subject: [PATCH] Update the dependencies

---
 conda/build-condarc            |   1 -
 conda/conda-bootstrap.py       |  45 ++++-------
 gitlab/conda_build_config.yaml | 139 ++++++++++++++++-----------------
 3 files changed, 82 insertions(+), 103 deletions(-)

diff --git a/conda/build-condarc b/conda/build-condarc
index bcf7fb9..aacfae4 100644
--- a/conda/build-condarc
+++ b/conda/build-condarc
@@ -10,6 +10,5 @@ ssl_verify: false
 quiet: true
 channels:
   - https://www.idiap.ch/software/bob/conda/label/beta
-  - https://www.idiap.ch/software/bob/conda/label/stable
   - https://www.idiap.ch/software/bob/conda
   - defaults
diff --git a/conda/conda-bootstrap.py b/conda/conda-bootstrap.py
index a7d1668..a5a4a10 100755
--- a/conda/conda-bootstrap.py
+++ b/conda/conda-bootstrap.py
@@ -95,38 +95,25 @@ def which(env, program):
 
 def get_rendered_recipe(args):
 
-  with tempfile.TemporaryDirectory(dir=args.recipe, suffix='.tmp') as d:
-
-    print('$ mkdir -p %s' % (d,))
-    # writes a temporary recipe without bob-devel
-    orig = os.path.join(args.recipe, 'meta.yaml')
-    contents = open(orig).read()
-    result = re.search(r'requirements:\s*\n.+host:\s*\n', contents, re.DOTALL)
-    contents = contents[:result.end()] + \
-        '    - bob-devel {{ bob_devel }}.*\n' + \
-        contents[result.end():]
-    destfile = os.path.join(d, 'meta.yaml')
-    print('$ cp %s -> %s' % (orig, destfile))
-    print('$ edit %s # add bob-devel to host section' % (destfile,))
-    with open(destfile, 'wt') as f:
-      f.write(contents)
-
-    cmd = [
-        args.conda, 'render',
-        '--variant-config-files', args.config,
-        '--python', args.python, d
-    ]
-    print(('$ CONDARC=%s ' % args.condarc) + ' '.join(cmd))
-    output = subprocess.check_output(cmd, env=args.env)
-    print('$ rm -rf %s' % (d,))
-    return yaml.load(output)
+  cmd = [
+      args.conda, 'render',
+      '--variant-config-files', args.config,
+      '--python', args.python, args.recipe
+  ]
+  print(('$ CONDARC=%s ' % args.condarc) + ' '.join(cmd))
+  output = subprocess.check_output(cmd, env=args.env)
+  return yaml.load(output)
+
+
+def remove_pins(deps):
+  return [l.split()[0] for l in deps]
 
 
 def parse_dependencies(args):
 
   recipe = get_rendered_recipe(args)
-  return recipe['requirements'].get('host', []) + \
-      recipe['requirements'].get('build', []) + \
+  return remove_pins(recipe['requirements'].get('build', [])) + \
+      remove_pins(recipe['requirements'].get('host', [])) + \
       recipe['requirements'].get('run', []) + \
       recipe.get('test', {}).get('requires', []) + \
       ['bob.buildout', 'mr.developer', 'ipdb']  # packages required for local dev
@@ -148,8 +135,6 @@ def conda_create(args, packages):
   specs = []
   for k in packages:
     k = ' '.join(k.split()[:2])  # remove eventual build string
-    if not k.startswith('bob'):
-      k = k.split()[0]  # get whatever is compatible for those
     if any(elem in k for elem in '><|'):
       specs.append(k.replace(' ', ''))
     else:
@@ -168,7 +153,7 @@ def conda_create(args, packages):
       raise RuntimeError('environment `%s\' exists in `%s\' - use '
                          '--overwrite to overwrite' % (args.name, envdir))
 
-  cmd = [args.conda, 'create', '--yes', '--name', args.name] + specs
+  cmd = [args.conda, 'create', '--yes', '--name', args.name] + sorted(specs)
   print(('$ CONDARC=%s ' % args.condarc) + ' '.join(cmd))
   status = subprocess.call(cmd, env=args.env)
 
diff --git a/gitlab/conda_build_config.yaml b/gitlab/conda_build_config.yaml
index 7c7c245..1199c95 100644
--- a/gitlab/conda_build_config.yaml
+++ b/gitlab/conda_build_config.yaml
@@ -38,117 +38,100 @@ zip_keys:
     - fortran_compiler_version  # [win]
     - python                    # [win]
 
-# Here we list the **minimum** version of our dependencies that we support.
-# We keep a list of **all of them** here to make sure everything goes as
-# expected in our conda build process.
-# Ideally we want to build and test against older versions of dependencies.
-# Most of the pin numbers come from the anaconda package.
+
+# Here is the version of dependencies are used when building packages (build
+# and host requirements). We keep a list of **all of them** here to make sure
+# everything goes as expected in our conda build process. For the version of
+# packages that are used for testing packages, see the recipe of bob-devel.
+# The version here do not necessarily match the versions in bob-devel.
+
+# This version of bob-devel will be used at test time of packages:
 bob_devel:
-  - 2018.04.04
+  - 2018.04.06
 
-## The build time only dependencies.
-## Updaing these to the latest version all the time is OK.
+# The build time only dependencies (build requirements).
+# Updating these to the latest version all the time is OK and a good idea.
+# These versions should match the versions inside bob-devel as well (if they
+# overlap) so update them in both places.
 cmake:
   - 3.9.4
-coverage:
-  - 4.4.2
 pkg_config:
   - 0.29.2
+cython:
+  - 0.28.1
 
-## The dependencies that we link against
+# The dependencies that we link against (host requirements).
+# Ideally we want to build against the oldest possible version of packages when
+# we are linking against them. It is best to keep this in sync with:
+# https://github.com/AnacondaRecipes/aggregate/blob/master/conda_build_config.yaml
 numpy:
-  - 1.13.3
-hdf5:
-  - 1.10               # [not ppc64le]
-freetype:
-  - 2.8
-jpeg:
-  - 9b
-libpng:
-  - 1.6.32
-libtiff:
-  - 4.0.9
-mkl:
-  - 2018.0.0
-sqlite:
-  - 3.20.1
-xz:
-  - 5.2.3
-zlib:
-  - 1.2.11
-# non-anaconda
+  - 1.9   # [unix]
+  - 1.11  # [win]
 boost:
   - 1.65.1
 cyvlfeat:
   - 0.4.6
 ffmpeg:
   - 3.4
-fftw:
-  - 3.3.7
+freetype:
+  - 2.8
 giflib:
   - 5.1.4
+hdf5:
+  - 1.10
+jpeg:
+  - 9b
 libblitz:
   - 1.0.1
 libmatio:
   - 1.5.11
 libogg:
   - 1.3.2
+libpng:
+  - 1.6.32
 libsvm:
   - 3.22
+libtiff:
+  - 4.0.9
+mkl:
+  - 2018.0.0
 openfst:
   - 1.6.1
-speexdsp:
-  - 1.2rc3
-speex:
-  - 1.2.0
 sox:
   - 14.4.2
+speex:
+  - 1.2.0
+speexdsp:
+  - 1.2rc3
+sqlite:
+  - 3.20.1
 vlfeat:
   - 0.9.21
+xz:
+  - 5.2.3
+zlib:
+  - 1.2.11
 
-## The dependencies that are needed for runtime only
-# anaconda
-click:
-  - 6.7
-curl:
-  - 7.55.1
-cython:
-  - 0.26.1
-matplotlib:
-  - 2.1.0
-nose:
-  - 1.3.7
-pillow:
-  - 4.2.1
-scipy:
-  - 0.19
-setuptools:
-  - 38.4.0
-six:
-  - 1.11.0
-sphinx:
-  - 1.6.3
-sqlalchemy:
-  - 1.1.13
-# non-anaconda
+# The dependencies that are needed for runtime only (run requirements).
+# These versions **should** match the versions inside bob-devel recipe.
 caffe:
   - 1.0
+click:
+  - 6.7
 click_plugins:
   - 1.0.3
+coverage:
+  - 4.5.1
 dlib:
   - 19.7
 docopt:
   - 0.6.2
-ipdb:
-  - 0.10.2
 jinja2:
   - 2.10
 kaldi:
   - r7271.1a4dbf6
-keras:
-  - 2.1.2
-madmom:
-  - 0.15.1
+matplotlib:
+  - 2.2.2
 menpo:
   - 0.8.1
 menpofit:
@@ -157,8 +140,12 @@ mne:
   - 0.15.2
 mr_developer:
   - 1.38
+nose:
+  - 1.3.7
 opencv:
   - 3.3.1
+pillow:
+  - 4.3.0
 pyedflib:
   - 0.1.11
 pyyaml:
@@ -167,14 +154,22 @@ schema:
   - 0.6.7
 scikit_image:
   - 0.13.1
+scipy:
+  - 1.0.1
+setuptools:
+  - 39.0.1
+six:
+  - 1.11.0
+sphinx:
+  - 1.7.2
 sphinx_rtd_theme:
   - 0.2.4
-tensorflow:
-  - 1.4.1
+sqlalchemy:
+  - 1.2.6
 tabulate:
   - 0.8.2
-virtualenv:
-  - 15.1.0
+tensorflow:
+  - 1.5.0
 zc_buildout:
   - 2.11.2
 zc_recipe_egg:
-- 
GitLab