Compare commits

..

9 Commits

Author SHA1 Message Date
mudler c50bc82ed7 updating README 2016-02-06 17:09:40 +01:00
mudler c68363f0fc adding support for custom useflags, masks, keywords, uses and envs 2016-02-06 17:04:42 +01:00
Ettore Di Giacinto 5485505c4f Update README.md 2016-02-06 16:50:00 +01:00
Ettore Di Giacinto 0fbff0b90b Update README.md 2016-02-06 16:44:41 +01:00
Ettore Di Giacinto 2851a5e2fc Update README.md 2016-02-06 16:43:24 +01:00
mudler f49309552f adding SAB_WORKSPACE for readability, updating README 2016-02-06 16:39:39 +01:00
mudler 1a9efe587a adding support to local overlays 2016-02-06 16:06:18 +01:00
mudler 0aeb135215 adding docker checks in function file 2016-02-06 15:28:56 +01:00
mudler 34857bb7a3 docker base image now is tweakable with env 2016-02-06 15:05:02 +01:00
4 changed files with 147 additions and 12 deletions
+111
View File
@@ -0,0 +1,111 @@
# Sabayon devkit
The *Sabayon devkit* is a set of scripts that aims to help developers in various tasks.
You can install it in sabayon with:
`
sudo equo i sabayon-devkit
`
# Building package in a clean environment
## Prerequisites
* docker installed in the machine (`sudo equo i docker`), and the daemon started (`sudo systemctl start docker`)
* if you don't want to run that as root, the user where are you running the script must be in the docker group (`sudo gpasswd -a $USER docker`)
Packages can be built in a clean environment with docker by running `sabayon-buildpackages`.
*`sabayon-buildpackages` is just a script wrapper around the `builder` perl script which is placed inside a docker container.*
## Define your workspace
Create a directory to represent your project workspace.
cd $HOME
mkdir myproject
cd myproject
if you plan to make packages from your own ebuilds, and you don't have an overlay published in layman, you can create the `local_overlay` directory and put your overlay tree inside it.
me@box:myproject/$ mkdir local_overlay
`myproject/local_overlay` is read from the docker container and mounted inside it as the local overlay available in the machine.
If you want, you can define the workspace directory with the variable environment `SAB_WORKSPACE`
`SAB_WORKSPACE=/whatever sabayon-createrepo`
## Build your packages
`sabayon-buildpackages` accepts the same arguments as the builder:
sabayon-buildpackages app-text/tree
sabayon-buildpackages plasma-meta --layman kde
sabayon-buildpackages app-foo/foobar --equo foo-misc/foobar --layman foo --layman bar foo
* --layman foobar -- tells the script to add the "foobar" overlay from layman
* --equo foo-misc/foobar -- tells the script to install "foo-misc/foobar" before compiling
* The arguments are the packages that you want compile, they can be also in the complete form *e.g. =foo-bar/misc-1.2*
## Folder structure
This is the folder structure that will be automatically created:
`
myproject/
myproject/portage_artifacts/
myproject/entropy_artifacts/
myproject/local_overlay/
myproject/specs/
`
* myproject/portage\_artifacts/ -- will contain the portage artifacts, they will be consumed in the next steps
* myproject/entropy\_artifacts/ -- will contain the entropy output, our Sabayon repository for the **.tbz2** packages that where in **myproject/portage_artifacts/**
* myproject/local_overlay/ -- is the location of your personal overlay (if necessary)
* myproject/specs -- contain custom files for uses, envs, masks, unmasks and keywords for package compilation options
the `specs` folder is structured like this:
- custom.unmask: will contain your custom unmasks
- custom.mask: will contain your custom masks
- custom.use: will contain your custom use flags
- custom.env: will contain your custom env specifications
- custom.keywords: will contain your custom keywords
you can override the Architecture folder in which files are placed specifying in the *SAB_ARCH* environment variable. Default is "intel" (can be *armarch* as for now)
# Create Sabayon repository from \*.tbz2 in a clean environment
## Prerequisites
* docker installed in the machine (`sudo equo i docker`), and the daemon started (`sudo systemctl start docker`)
* if you don't want to run that as root, the user where are you running the script must be in the docker group (`sudo gpasswd -a $USER docker`)
You can create Sabayon repositories from packages built with emerge in a clean environment with docker by running `sabayon-createrepo`.
The script will use a docker container to inject packages from *portage_artifacts/* in your project folder, the output will be available in *entropy_artifacts/*.
Example:
sabayon-createrepo
REPOSITORY_NAME=mytest REPOSITORY_DESCRIPTION="My Wonderful Repository" sabayon-createrepo
* REPOSITORY_NAME -- is your repository name id
* REPOSITORY_DESCRIPTION -- is your repository description
You can also put your .tbz2 file externally built inside `entropy_artifacts/` in your workspace folder (you can create it if not already present) and run `sabayon-createrepo` to generate a repository from them.
In both `sabayon-createrepo` and `sabayon-buildpackages` you can override the docker image used with the environment variable `DOCKER_IMAGE`.
+21 -5
View File
@@ -1,6 +1,9 @@
#!/bin/bash
set -e
ROOT="${ROOT:-$PWD}"
SAB_WORKSPACE="${SAB_WORKSPACE:-$PWD}"
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/builder-amd64}"
SAB_ARCH="${SAB_ARCH:-intel}"
. /sbin/sabayondevkit-functions.sh
if [ $# -eq 0 ]
then
@@ -8,8 +11,21 @@ if [ $# -eq 0 ]
exit 1
fi
if [ "$(id -u)" != "0" ]; then
echo "!! If you are not running the script as root, your user should be in the docker group to use it. (sudo gpasswd -a $USER docker) !!"
fi
check_docker_requirements
docker run --rm -v "$ROOT"/portage_artifacts:/usr/portage/packages -ti sabayon/builder-amd64 $@
[ -d "$SAB_WORKSPACE"/specs ] || mkdir "$SAB_WORKSPACE"/specs/
[ -e "$SAB_WORKSPACE"/specs/custom.mask ] || touch "$SAB_WORKSPACE"/specs/custom.mask
[ -e "$SAB_WORKSPACE"/specs/custom.unmask ] || touch "$SAB_WORKSPACE"/specs/custom.unmask
[ -e "$SAB_WORKSPACE"/specs/custom.use ] || touch "$SAB_WORKSPACE"/specs/custom.use
[ -e "$SAB_WORKSPACE"/specs/custom.env ] || touch "$SAB_WORKSPACE"/specs/custom.env
[ -e "$SAB_WORKSPACE"/specs/custom.keywords ] || touch "$SAB_WORKSPACE"/specs/custom.keywords
docker run --rm \
-v "$SAB_WORKSPACE"/local_overlay:/usr/local/portage \
-v "$SAB_WORKSPACE"/portage_artifacts:/usr/portage/packages \
-v "$SAB_WORKSPACE"/specs/custom.unmask:/opt/sabayon-build/conf/"$SAB_ARCH"/portage/package.unmask/custom.unmask \
-v "$SAB_WORKSPACE"/specs/custom.mask:/opt/sabayon-build/conf/"$SAB_ARCH"/portage/package.mask/custom.mask \
-v "$SAB_WORKSPACE"/specs/custom.use:/opt/sabayon-build/conf/"$SAB_ARCH"/portage/package.use/custom.use \
-v "$SAB_WORKSPACE"/specs/custom.env:/opt/sabayon-build/conf/"$SAB_ARCH"/portage/package.env/custom.env \
-v "$SAB_WORKSPACE"/specs/custom.keywords:/opt/sabayon-build/conf/"$SAB_ARCH"/portage/package.keywords/custom.keywords \
-ti $DOCKER_IMAGE $@
+8 -7
View File
@@ -1,15 +1,16 @@
#!/bin/bash
set -e
ROOT="${ROOT:-$PWD}"
. /sbin/sabayondevkit-functions.sh
SAB_WORKSPACE="${SAB_WORKSPACE:-$PWD}"
entropysrv=$(mktemp)
createrepo=$(mktemp)
REPOSITORY_NAME="${REPOSITORY_NAME:-default}"
REPOSITORY_DESCRIPTION="${REPOSITORY_DESCRIPTION:-My Sabayon repository}"
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/builder-amd64}"
EDITOR=cat
if [ "$(id -u)" != "0" ]; then
echo "!! If you are not running the script as root, your user should be in the docker group to use it. (sudo gpasswd -a $USER docker) !!"
fi
check_docker_requirements
echo "Repository: $REPOSITORY_NAME"
echo "Repository Description: $REPOSITORY_DESCRIPTION"
@@ -68,10 +69,10 @@ repository=$REPOSITORY_NAME|$REPOSITORY_DESCRIPTION|file:///sabayon/artifacts
EOF
docker run --rm --entrypoint /bin/bash -e REPOSITORY=$REPOSITORY_NAME -e EDITOR=cat -e LC_ALL=en_US.UTF-8 \
-v "$ROOT"/entropy_artifacts:/sabayon/artifacts \
-v "$SAB_WORKSPACE"/entropy_artifacts:/sabayon/artifacts \
-v $createrepo:/sabayon/bin/create_repo.sh \
-v $entropysrv:/etc/entropy/server.conf \
-v "$ROOT"/portage_artifacts:/usr/portage/packages \
-ti sabayon/builder-amd64 /sabayon/bin/create_repo.sh || true
-v "$SAB_WORKSPACE"/portage_artifacts:/usr/portage/packages \
-ti $DOCKER_IMAGE /sabayon/bin/create_repo.sh || true
rm -rf $createrepo
rm -rf $entropysrv
+7
View File
@@ -1,5 +1,12 @@
#!/bin/bash
check_docker_requirements(){
if [ "$(id -u)" != "0" ]; then
groups | grep -q docker || echo "--> If you are not running the script as root, your user should be in the docker group to use it. (sudo gpasswd -a $USER docker)"
fi
ps aux | grep -q '[d]ocker' || echo "--> Be sure to have the docker daemon running (sudo systemctl start docker)"
}
build() {
local SEARCH=$1
local EMERGE_DEFAULT_ARGS=${2:---accept-properties=-interactive --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg}