[lug] deb source packaging

Ben bluey at iguanaworks.net
Mon Jul 13 09:09:35 MDT 2009

Anyone have experience making deb source packages? Here's my problem:

I'm creating a package that compiles a library that links against 
python. This means that the binary version of the package depends on 
both the architecture (i386, amd64) and the python version (python2.6 
python2.5). What is the right way to package this? Right now I've got 
one source package that has 2 binary packages in:


The problem is that main-python depends on the version of python it was 
compiled against and while it has the right dependencies (dpkg knows it 
needs, say, python-2.5), it isn't good if I want to distribute binaries 
against multiple versions of python since they have the same filename. 
(Since in the debian / ubuntu world, python versions keep changing, and 
are different on different distros. So I thought I would split it up 
into two binary packages in my source package:


(where main-python2.X provides main-python)

Now this mostly works except that many systems have multiple python 
versions installed, but only one default version (what /usr/bin/python 
points to). Now if I have python2.5 and python2.6 installed but 
python2.5 is my default, how can I make sure when I run apt-get (the 
above packages are in a repository) it grabs main-python2.5?  If I don't 
then they install python2.6, but when they call programs with 
/usr/bin/python it won't work because they need to call 
/usr/bin/python2.6. This confusion also applies to when grabbing and 
compiling from source with apt-get -b source main.

Ideally, I'd like either two packages:

main-{pyversions -d}

where name of the second depends on the default python version. I've 
read that deb doesn't support variables in package names though. Or

    depends on python2.5 being default
    depends on python 2.6 being default

but I don't see how to make a dependency like this since the default 
version isn't apparent from what packages are installed. I've tried 
looking at variable substitution, but I don't see how to do something like
    Install if  `pyversion -d` =="python2.5" so again source would only 
package against the version of python that is default.

Is there a better ('right') way to do this?


More information about the LUG mailing list