Adding more env options and updating README

This commit is contained in:
mudler
2015-12-04 00:01:10 +01:00
parent fde3bc1135
commit a033cbb81c
2 changed files with 83 additions and 3 deletions
+72
View File
@@ -44,3 +44,75 @@ you can inspect the volumes mounted by docker, or mounting externally the output
docker run -ti --rm -v "$PWD"/artifacts:/usr/portage/packages sabayon/builder-amd64 app-text/tree
e.g. now you can find your tbz2 in your current directory, inside the "artifacts" folder
## Example
The -v flag can furthermore exploited and chained to obtain more fine-grained tweaks
You can of course customize it further, and replace all the configuration that's already been setup on the Docker Image.
- custom.unmask: will contain your unmasks
- custom.mask: will contain your masks
- custom.use: will contain your use flags
- custom.env: will contain your env specifications
- custom.keywords: will contain your keywords
Exporting those files to your container is a matter of adding an argument to your docker run command.
**Example. Exporting your custom.unmask:**
-v /my/path/custom.unmask:/opt/sabayon-build/conf/intel/portage/package.unmask/custom.unmask
**Example. Exporting your custom.mask:**
-v /my/path/custom.mask:/opt/sabayon-build/conf/intel/portage/package.mask/custom.mask
**Example. Exporting your custom.use:**
-v /my/path/custom.use:/opt/sabayon-build/conf/intel/portage/package.use/custom.use
**Example. Exporting your custom.env:**
-v /my/path/custom.env:/opt/sabayon-build/conf/intel/portage/package.env/custom.env
**Example. Exporting your custom.keywords:**
-v /my/path/custom.keywords:/opt/sabayon-build/conf/intel/portage/package.keywords/custom.keywords
In this way you tell to docker to mount your custom.* file inside /opt/sabayon-build/conf/intel/portage/package.*/custom.* inside the container.
Keep in mind that the container have the portage directory located at /opt/sabayon-build/conf/intel/portage/ ; the /etc/portage folder is then symlinked to it.
**Attention!** Remember also to use absolute paths or docker will fail to mount your files in the container.
## ENV VARIABLES
You can tweak the default behavior of the script setting those env variables with docker.
- **BUILDER_PROFILE**: Sets the profile for compilation, you can select it using the number or the name
- **BUILDER_JOBS**: How much jobs emerge will have assigned (-j option)
- **PRESERVED_REBUILD**: 1/0 to Enable/Disable preserved rebuild compilation
- **EMERGE_DEFAULTS_ARGS**: a list of commands that you might want to specify
- **FEATURES**: you can override default FEATURES (like in Portage's make.conf)
Sabayon related:
- USE_EQUO: 1/0 Enable/Disable equo for installing the package dependencies (if you plan to use a pure gentoo repository, set it to 0, but the compilation process would be much longer)
- **EQUO_INSTALL_ATOMS**: Install the latest version of the dependency packages
- **EQUO_INSTALL_VERSION**: Install the specific version of the dependency packages
- **EQUO_SPLIT_INSTALL**: Install all the packages separately one by one
You can pass the ENV options to docker with the **-e** flag
docker run -e "EQUO_INSTALL_VERSION=1" -e "EQUO_INSTALL_ATOMS=0" -ti --rm -v "$PWD"/artifacts:/usr/portage/packages sabayon/builder-amd64 app-text/tree
**Note**: If you want to keep your container, remove the **--rm** option.
+11 -3
View File
@@ -10,6 +10,10 @@ my $preserved_rebuild = $ENV{PRESERVED_REBUILD} // 0;
my $emerge_defaults_args = $ENV{EMERGE_DEFAULTS_ARGS} // "--accept-properties=-interactive --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg";
$ENV{FEATURES} = $ENV{FEATURES} // "parallel-fetch protect-owned compressdebug splitdebug -userpriv";
my $equo_install_atoms = $ENV{EQUO_INSTALL_ATOMS} // 1;
my $equo_install_version = $ENV{EQUO_INSTALL_VERSION} // 0;
my $equo_split_install = $ENV{EQUO_SPLIT_INSTALL} // 0;
my @overlays;
GetOptions('layman|overlay:s{,}' => \@overlays);
@@ -126,13 +130,17 @@ my @packages = @ARGV;
if ($use_equo){
my @packages_deps;
foreach my $p (@packages){
push(@packages_deps,package_deps($p,1,1));
push(@packages_deps,package_deps($p,1,0));
push(@packages_deps,package_deps($p,1,1)) if $equo_install_atoms;
push(@packages_deps,package_deps($p,1,0)) if $equo_install_version;
}
@packages_deps = grep { defined() and length() } @packages_deps; #cleaning
say "Installing those deps with equo", @packages_deps;
system("equo i $_") for @packages_deps;
if ( $equo_split_install) {
system("equo i $_") for @packages_deps;
} else {
system("equo i @packages_deps");
}
}
say "* Ready to compile, finger crossed";