/buildbot-packagebuilder

[ARCHIVED] A debian package builder based on Buildbot.

Primary LanguagePython

Buildbot Package Builder

Deprecation notice

I no longer use this project because I now use Github actions for automatization.


This project aims to assemble a binary (and source) package builder based on Buildbot. For now it only builds debian packages compatible with Debian and its derivatives, but it will compile Fedora and Arch packages in the future.

Follow the instructions to configure buildbot-packagebuilder for local packaging.

Steps for using Buildbot Package Builder

  1. Install dependencies. Make sure all software is installed and no errors are thrown during instalation.

     sudo aptitude install git virtualenv supervisor python2.7-dev apt-cacher reprepro pbuilder
    

    Another form of installing Virtualenv is through pip. Install the python-pip package and then execute sudo pip install virtualenv.

  2. Create a new user for buildbot.

     sudo adduser buildbot
    
  3. Configure sudo for the buildbot user.

     sudo cat << EOF > /etc/sudoers.d/buildbot
     buildbot ALL=(ALL) NOPASSWD:SETENV: ALL
     EOF
    
  4. Create a virtualenv with proper dependencies.

     su buildbot
     mkdir -p "${HOME}/buildbot"
     cd "${HOME}/buildbot"
     virtualenv --python=python2.7 virtualenv
     virtualenv/bin/pip install buildbot buildbot-slave
    
  5. Create checkout dir.

     sudo mkdir -p /var/cache/pbuilder/git-checkout
     sudo chown -R buildbot:buildbot /var/cache/pbuilder/git-checkout
    
  6. Create the buildbot slaves.

     virtualenv/bin/buildslave create-slave --relocatable --umask=0022 slave-sid-i386 localhost:9989 slave-sid-i386 123456
     virtualenv/bin/buildslave create-slave --relocatable --umask=0022 slave-sid-amd64 localhost:9989 slave-sid-amd64 123456
    
  7. Create the buildbot master.

     git clone https://github.com/LuisAlejandro/django-packagebuilder.git master
     virtualenv/bin/buildbot upgrade-master master
    
  8. Configure supervisor daemon for buildbot.

     sudo cat << EOF > /etc/supervisor/conf.d/buildbot.conf
     [program:buildbot-master]
     command=/home/buildbot/buildbot/virtualenv/bin/buildbot restart --nodaemon /home/buildbot/buildbot/master/
     user=buildbot
    
     [program:buildbot-slave-i386]
     command=/home/buildbot/buildbot/virtualenv/bin/buildslave restart --nodaemon /home/buildbot/buildbot/slave-sid-i386
     user=buildbot
    
     [program:buildbot-slave-amd64]
     command=/home/buildbot/buildbot/virtualenv/bin/buildslave restart --nodaemon /home/buildbot/buildbot/slave-sid-amd64
     user=buildbot
     EOF
    
  9. Create a new package repository for finished packages.

     mkdir -p /var/cache/pbuilder/repo/conf
     cat << EOF > /var/cache/pbuilder/repo/conf/distributions
     Origin: Local
     Label: Local
     Codename: local
     Suite: local
     Architectures: amd64 i386
     Components: main
     EOF
     reprepro -b /var/cache/pbuilder/repo/ -VVV export
    
  10. Restart the supervisor.

    sudo service supervisor restart
    

Configuration

Open the file buildhelpers/packages.py and fill in as many packages as you want to build, according to the following:

packages = {
    'package-name': {
        'repository': '',
        'branch': '',
        'prebuild-script': '',
        'prebuild-deps': ''
    },
    'package-name': {
        'repository': '',
        'branch': '',
        'prebuild-script': '',
        'prebuild-deps': ''
    }

    ...
}
  • package-name: is the name of the package to be built.
  • repository: a git repository where to find the package code.
  • branch: the branch of the git repository to be built.
  • prebuild-script (optional): a script needed to be run before building.
  • prebuild-deps (optional): a list of packages needed by the prebuild-script or other parts of the building process (separated by spaces).

Restart the supervisor after all changes have been made.

sudo service supervisor restart