Skip to content

Provide Gentoo binhosts using github infrastructure

License

Notifications You must be signed in to change notification settings

spreequalle/gentoo-binhost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

gentoo binhost

Providing gentoo binary packages using github infrastructure.

gentoo-logo

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.

Concept

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

Usage

Setup a gentoo binhost Github and provide the following.

Dependencies

The upload script uses Python3 and PyGithub module.

emerge dev-python/PyGithub

Configuration

github upload can be easily configured.

make.conf

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.

bashrc

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

gh-upload.py

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>'

Disclaimer

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.