- Notifications
You must be signed in to change notification settings - Fork4
Creates a container to install a mini-distribution without root access on the Travis-CI container based infrastructure
License
polysquare/polysquare-travis-container
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Creates a self-contained package-management installation, without root access.
This allows you to install a pre-defined set of packages to a directory andthen execute commands using the packages installed in that directory.
Supports Windows, OS X and Linux.
On Windows and OS X, local versions of chocolatey and brew are installedrespectively, with packages installing to the specified folder. Commandsare executed with environment variables set such that the locallyinstalled packages will be used by any software built or installedusing thepsq-travis-container-exec
wrapper. Only the host architectureis supported.
On Linux,proot
is used to "containerize" a downloadedlinux distribution, where the package manage operates only on the directoryin which the downloaded linux distribution exists. This allows you toinstall packages usingapt-get
oryum
without touching othersystem files.proot
allow allows for different architectures to bespecified as well, which are emulated transparently using theqemu-user-mode
tool.
For Linux, an alternative 'local' option is also provided which does notincur the overhead ofproot
but is not as flexible. Sadly, on Travis-CI,proot
no longer functions correctly and so the latter mode of operationis required.
Travis CI (Ubuntu) | AppVeyor (Windows) | Coverage | PyPI | Licence |
---|---|---|---|---|
64 bit executables cannot be emulated on a 32 bit architecture.
polysquare-travis-container
can be installed using usingpip
from PyPI
Containers can be created withpsq-travis-container-create
:
usage: psq-travis-container-create [-h] [--distro {Fedora, Debian, Ubuntu, Windows, OSX}] [--release RELEASE] [--arch {ppc,x86_64,x86,arm}] [--repositories REPOSITORIES] [--packages PACKAGES] CONTAINER_DIRECTORYCreate a Travis CI container If an arg is specified in more than one place,then command-line values override environment variables which overridedefaults.positional arguments: CONTAINER_DIRECTORY Directory to place container inoptional arguments: -h, --help show this help message and exit --distro {Fedora,Debian,Ubuntu,Windows,OSX} Distribution name to create container of [env var: CONTAINER_DISTRO] --release RELEASE Distribution release to create container of [env var: CONTAINER_RELEASE] --arch {ppc,x86_64,x86,arm} Architecture (all architectures other than the system architecture will be emulated with qemu) [env var: CONTAINER_ARCH] --repositories REPOSITORIES A file containing a list of repositories to add before installing packages. Special keywords will control the operation of this file: {release}: The distribution release (eg, precise) {ubuntu}: Ubuntu archive URL {launchpad}: Launchpad PPA URL header (eg, http://ppa.launchpad.net) --packages PACKAGES A file containing a list of packages to install
The distribution filesystem itself is placed in a subdirectory ofCONTAINER_DIRECTORY
, so multiple distribution configurations can be placed ina singleCONTAINER_DIRECTORY
. A mini-distribution ofproot
will also beplaced inCONTAINER_DIRECTORY
. This directory should be cached, for instance:
cache: directories: - CONTAINER_DIRECTORY
Packages will only be installed if the container is being created and notrestored from the cache. To install additional packages, the travis cachesshould be deleted.
Special directories like/tmp
and/home
are linked automatically, so youcan run binaries or scripts directly from the project root.
To run a command inside a container, usepsq-travis-container-exec
:
usage: psq-travis-container-exec [-h] [--distro {Fedora, Debian, Ubuntu, Windows, OSX}] [--release RELEASE] [--arch {ppc,x86_64,x86,arm}] --cmd [CMD [CMD ...]] CONTAINER_DIRECTORYUse a Travis CI container If an arg is specified in more than one place,then command-line values override environment variables which overridedefaults.positional arguments: CONTAINER_DIRECTORY Directory to place container inoptional arguments: -h, --help show this help message and exit --distro {Fedora,Debian,Ubuntu,Windows,OSX} Distribution name to create container of [env var: CONTAINER_DISTRO] --release RELEASE Distribution release to create container of [env var: CONTAINER_RELEASE] --arch {ppc,x86_64,x86,arm} Architecture (all architectures other than the system architecture will be emulated with qemu) [env var: CONTAINER_ARCH] -- [CMD [CMD ...]] Command to run inside of container
Executables in CMD are resolved relative to the distribution container, sorunningbash
would runCONTAINER_DIR/bin/bash
and not/bin/bash
inside travis.
The--container
,--release
and--arch
options are used to select apre-existing distribution container set up withpsq-travis-container-create
.
About
Creates a container to install a mini-distribution without root access on the Travis-CI container based infrastructure