Thursday, July 23, 2009

Building RPMs, part two - Pinax

Ok, so now we have the environment complete. First thing I want to package is Pinax. This is a nice little collection of Django applications which add some required stuff for most of web based applications.

On the link above you will find all the info for the project, so let's start. We will build the release version of Pinax (for development versions I have a side project, which I will show you at right time). Please note - all the release used are current for the day this entry has been written.

Download pinax version 0.5.1 from here and put it in rpmbuild/SOURCES. After that:
cd ~/rpmbuild/SPECS

rpmdev-newspec -t python pinax

Rpmdev-newspec creates the skeleton for a new spec file named pinax. The -t python option tells to create a skeleton with some python definitions in it (python definitions are laid out according to this wiki entry on the Fedora Project Wiki); you can see which skeletons are available looking in '\etc\rpmdevtools'.

Why Python? Well, my guess is that being DJango a Python framework, you know....

Let's look at the spec file and put some info into that. You can use any editor for the file (I use geany, fast and lightweight).

# sitelib for noarch packages, sitearch for others (remove the unneeded one)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

Name: pinax
Release: 1%{?dist}

Group: Development/Languages
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: python-devel
Post a Comment