Providing gentoo binary packages using github infrastructure.
This repo provides various gentoo binary packages for a variety of different architectures (checkout branches for details). This branch contains the script that is used for GitHub upload.
The package upload is realized using a small upload script thats executed via portage hooks. For every package that is being merged via portage the Gentoo Packages manifest file is committed to Git. The binary packages itself are not stored into repository there are uploaded as GitHub release artifacts.
To make everything work the following nomenclature has to apply:
Gentoo idiom | GitHub entity |
---|---|
CATEGORY | GitHub release |
PF | GitHub release asset |
CHOST | Git branch name |
CHOST/CATEGORY | Git release tag |
Setup a gentoo binhost Github and provide the following.
The upload script uses Python3 and PyGithub module.
emerge dev-python/PyGithub
github upload can be easily configured.
Enable gentoo binhost by adding the following lines.
# enable binhost
PORTAGE_BINHOST_HEADER_URI="https://github.com/spreequalle/gentoo-binhost/releases/download/${CHOST}"
FEATURES="${FEATURES} buildpkg"
USE="${USE} bindist"
ACCEPT_LICENSE="-* @BINARY-REDISTRIBUTABLE"
Since github releases are used to store the packages PORTAGE_BINHOST_HEADER_URI has to be set here.
Add the /etc/portage/bashrc file below, if you use your own file make sure to call the gh-upload.py script during postinst phase.
#!/bin/env bash
if [[ ${EBUILD_PHASE} == 'postinst' ]]; then
# FIXME come up with a more sophisticated approach to detect if binary package build is actually requested
# commandline args like -B or --buildpkg-exclude and other conditionals are not supported right now.
grep -q 'buildpkg' <<< {$PORTAGE_FEATURES}
if [ $? -eq 0 ]; then
/etc/portage/binhost/gh-upload.py
fi
fi
Add the /etc/portage/binhost/gh-upload.py script and add your github settings accordingly. You need to create a github access token that is able to access repository and create releases.
gh_repo = 'spreequalle/gentoo-binhost'
gh_token = '<your github access token>'
Although this software is released under JSON license, the binary packages come with their respective license according to Packages Manifest file. Refer to gentoo license for details.