Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/coldnew/gentoo-binhost

Provide Gentoo binhosts using github infrastructure
https://github.com/coldnew/gentoo-binhost

aarch64 binhost gentoo gentoo-binhost x86 x86-64 xpak

Last synced: about 2 months ago
JSON representation

Provide Gentoo binhosts using github infrastructure

Awesome Lists containing this project

README

        

# gentoo binhost

Providing [gentoo](https://gentoo.org/) binary packages using [github](https://github.com/) infrastructure.

gentoo-logo

This repo provides various gentoo [binary packages](https://wiki.gentoo.org/wiki/Binary_package_guide) 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](https://wiki.gentoo.org/wiki//etc/portage/bashrc). 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](https://developer.github.com/v3/repos/releases) artifacts.

To make everything work the following nomenclature has to apply:

Gentoo idiom|GitHub entity
------------|-------------
[CATEGORY](https://wiki.gentoo.org/wiki//etc/portage/categories)|GitHub release
[PF](https://devmanual.gentoo.org/ebuild-writing/variables/)|GitHub release asset
[CHOST](https://wiki.gentoo.org/wiki/CHOST)|Git branch name
[CHOST](https://wiki.gentoo.org/wiki/CHOST)/[CATEGORY](https://wiki.gentoo.org/wiki//etc/portage/categories)|Git release tag

## Usage

Setup a gentoo binhost Github and provide the following.

### Dependencies

The upload script uses Python3 and [PyGithub](https://github.com/PyGithub/PyGithub) module.

```shell
emerge dev-python/PyGithub
```

### Configuration

github upload can be easily configured.

#### make.conf

Enable gentoo binhost by adding the following lines.
```python
# enable binhost
PORTAGE_BINHOST_HEADER_URI="https://github.com/coldnew/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 ](https://wiki.gentoo.org/wiki//etc/portage/bashrc) file below, if you use your own file make sure to call the **gh-upload.py** script during **postinst** phase.

```bash
#!/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](/etc/portage/binhost/gh-upload.py) script and add your github settings accordingly.
You need to create a [github access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) that is able to access repository and create releases.

```python
gh_repo = 'coldnew/gentoo-binhost'
gh_token = ''
```

## Disclaimer

Although this software is released under [JSON](/LICENSE) license, the binary packages come with their respective license according to *Packages* Manifest file. Refer to [gentoo license](https://devmanual.gentoo.org/general-concepts/licenses/index.html) for details.