To accommodate the requirements associated with x86 and x64 images, the
command building OpenSSL and CMake became overly complex and hard to
maintain.
This commit has multiple purposes:
(1) simplify common.docker
(2) fix the building of 64-bit shared libraries against the static openssl
libraries by passing the -fPIC flag.
(3) ensure [many]linux-x86 and [many]linux-x64 images have an up-to-date
OpenSSL install. Openssl static libraries are installed in /usr
(4) simplify and speedup CMake build avoiding the second build with
explicit -DCMAKE_USE_OPENSSL:BOOL=ON. Indeed, configuring CMake on Linux
already looks for OpenSSL.
(5) speedup download of CMake source directly downloading the archive
corresponding to the revision.
(6) test CMake by:
- running CMake.FileDownload test
- trying to download a file served over https
This commit fixes the following error reported when building the base
image.
sh: 1: [: =: unexpected operator
sh: 1: [: =: unexpected operator
It turns out that (1) DEFAULT_DOCKCROSS_IMAGE is not set when building the
base image and (2) latest openssl will not be available in linux-x64 and
linux-x86 images.
While the use of sudo (made possible by 53cf084) allows to install
additional packages, the warning copied below was still reported.
To avoid this warning and streamline the installation of new packages,
this commit (1) introduces the concept of "pre_exec" entrypoint hook
and (2) adds such a hook to change the ownership of python "bin" and
"site-packages" directories for the manylinux images.
Warning reported are similar to this one:
```
The directory '/home/jcfr/.cache/pip/http' or its parent directory is
not owned by the current user and the cache has been disabled. Please
check the permissions and owner of that directory. If executing pip
with sudo, you may want sudo's -H flag.
```
Note that the sudo "-H" flag suggested in the warning is not available
in centos.
This commit build each images with the following arguments:
* IMAGE: Name of the image (e.g dockcross/base, dockcross/manylinux-x64, ...)
* VCS_REF: dockcross/dockcross commit from which this image is built
* VCS_URL: this repository obtained reading remote.origin.url
* BUILD_DATE: Date and time when the build was initiated
Then, within the Dockerfile, the metadata are associated with the image
using the "LABEL" instruction.
See https://docs.docker.com/engine/reference/builder/#/label
The corresponding labels can be found here:
http://label-schema.org/rc1/#build-time-labels
See #28
This commit removes the complex pipeline leveraging output from
/dev/urandom and simply uses $RANDOM variable. For the purpose
of generating an available container name, it will works well.
Suggested-by: Matt McCormick <matt.mccormick@kitware.com>
As explained in [1], when using dockcross from python subprocess, the
interactive mode is disabled and output of "cat /dev/urandom" is block
buffered instead of being line buffered.
Workaround to this problem is to simply read a fixed amount of characters
from urandom.
The following two snippets illustrates the problem and the
the implemented solution:
Works
```python
import subprocess as sp
sp.check_call("var=$(head -c 500 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | fold -w 7 | head -n 1); echo $var", shell=True)
```
=> output random string
Fail:
```python
import subprocess as sp
sp.check_call("var=$(cat /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | fold -w 7 | head -n 1); echo $var", shell=True)
```
=> Hang
[1] http://stackoverflow.com/questions/16805827/unable-to-read-stdout-from-a-running-process#16806506