Patchwork

From Alpine Linux
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Patchwork is a widely used patch review system.

This How-To aims to give a basis to setup Patchwork with PostgreSQL as backend.

There are some aspects which can be improved that this how-to is not covering.

  • Create an apk for patchwork with init script
  • Describe how to setup Patchwork for one project
  • Describe how to setup Patchwork with MariaDB

Initial package installation and setup PostgreSQL

apk add python py-django1.5 py-psycopg2 py-django-registration git postgresql

rc-service postgresql setup

rc-service postgresql start

Note: we are using py-django1.5 even if py-django (ver.1.7) is present in the repository. This is because Patchwork is not yet compatible with django 1.7.

Create a regular account called "pwuser":

adduser pwuser

As root:

su - postgresql createdb patchwork createuser pwuser createuser www-data createuser nobody

Last two users are hardcoded in one of the next sql script. That's why you need to create it.

Patchwork Installation and Configuration

Login with "pwuser" and clone the patchwork's git repository:

git clone git://ozlabs.org/home/jk/git/patchwork

Create a local_settings.py starting from settings.py:

cd patchwork/apps cp settings.py local_settings.py

Customize local_settings.py according with your need.

SECRET_KEY can be generated with the following python script:

import string, random
chars = string.letters + string.digits + string.punctuation
print repr("".join([random.choice(chars) for i in range(0,50)]))

Now, populate PostgreSQL with patchwork database.

As "pwuser":

python patchwork/apps/manage.py syncdb

At the end, the script will ask for patchwork's administrator username,email, and password.

Run another script for setting up the user's permissions:

psql -f patchwork/lib/sql/grant-all.postgres.sql patchwork

Now you can run the server:

python patchwork/apps/manage.py runserver 0.0.0.0:8000

Point your browser to http://$PATCHWORKS_SERVER_ADDRESS:8000

Login with the username and password you set before.

Enjoy.