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
Version:
Release: 1%{?dist}
Summary:

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

BuildArch:
BuildRequires: python-devel

Wednesday, July 08, 2009

Building RPMS, part one

The following is an excerpt from the IRC Packaging Lesson ; in red instructions for root (please use sudo - never use a system as root):

  • yum groupinstall development-tools

  • yum install rpm-build rpmdevtools

  • rpmdev-setuptree

The last command will setup the following directories:

rpmbuild directory tree

BUILD


This directory will contain the build of the source code you want to package. Roughly equivalent to the directory where you tar xjf source.tarball.bz2 ; cd source.tarball ; .configure ; make

BUILDROOT


The directory where the package will be built.

RPMS


The rpm produced will end in this directory. This is the binary rpm, the one you want to install in the system to use that cute application of yours.

SOURCES


Tarballs will end up here. These are the .gz or bz2 downloaded to build the application; usually contains source files, in the common autotools format.

SPECS


Spec files are the files which define how to package software, which dependencies to look for, and some more stuff. It's the only file you need (apart from source code) to really build a package.

SRPMS


SRPMS files are RPMS which contain source and SPEC file to rebuild packages with rpm.

OK, right now I will close the entry. A new one in a few days.