Skip to content

Commit

Permalink
Conda: Support two formats for version specification
Browse files Browse the repository at this point in the history
closes #37
  • Loading branch information
thriqon committed Mar 8, 2016
1 parent 768dc00 commit 3e0f44c
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions invfile.lua.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,30 @@ unattended installation. The enabled channels are passed in as well.
' -p /usr/local --copy --yes '

Metadata for Conda packages is stored in JSON files in
`/opt/conda/pkgs/` `<package-version-build>/` `info/recipe.json`. Since the version
and build is given in a slightly different format (version--build) in the
`packages.tsv`, we have to convert it first:
`/opt/conda/pkgs/` `<package-version-build>/` `info/recipe.json`.

The revision value in `packages.tsv` is used to name the tag of the
corresponding Docker image, which disallows the use of `=`. However, Conda uses
an equal sign to separate version code and build number. As a solution we propose
using a double dash (`--`) instead in the `packages.tsv`, which can then be translated
into an equal sign when communicating with Conda.

We support two formats for the version number: Firstly, a simple specification
of the package version (`1.0.0`). During installation, Conda picks the latest build
for this version and installs it. Secondy, a version and build number specification
of the form `1.0.0--2` which translates to version `1.0.0` and build number `2`.

local packageDirName = ''
local conda_version = ''
if string.find(revision, "--") then
packageDirName = package .. '-' ..
table.concat(split(revision, "--"), "-")
conda_version = table.concat(split(revision, "--"), "=")
else
packageDirName = package .. '-' .. revision
conda_version = '=' .. revision
end

local packageDirName = package .. '-' ..
table.concat(split(revision, "--"), "-")

Extracting the info is as simple as copying the `recipe.json` file into the `/info` directory that is available
to other build steps.
Expand Down Expand Up @@ -297,14 +315,6 @@ is set using the revision from the `packages.tsv`.
.. ' read desc ; echo $desc > /info/description ; '
.. ' echo ' .. revision .. [==[ > /info/version ) ]==]

The revision value in `packages.tsv` is used to name the tag of the
corresponding Docker image, which disallows the use of `=`. However, Conda uses
an equal sign to separate version code and build number. As a solution we propose
using a double dash (`--`) instead in the `packages.tsv`, which can then be translated
into an equal sign when communicating with Conda.

local conda_version = table.concat(split(revision, "--"), "=")

The actual build step utilizes the official `miniconda` image from Continuum Analytics
with a default shell. It executes the install and extract information commands.
Afterwards, with the help of the `jq` utility image, this information is transformed,
Expand Down

0 comments on commit 3e0f44c

Please sign in to comment.