[SLL] DEB packaging question

Derek Simkowiak dereks at realloc.net
Thu Feb 19 12:28:41 PST 2009


    Bryan,
    Thank you for your help, and all the useful links.  It was very 
helpful to have a list of current, "valid" documentation to read.  Much 
of what I found on my own seemed outdated or irrelevant.

    Even after reading the docs, it seems like there is no standard way 
to set up a repository for use with packaging.  Some tools require 
putting the ./debian/ directory in the main tree, some require a 
separate tree (to track downstream changes independently), and some 
allow you to keep just a sparse ./debian/ directory, and the upstream 
source is pulled from the tarball.  It seems like many of the steps are 
still manual, like renaming the source tarball to the ".orig.tar.gz" 
name, rev'ing the package version number, and deleting the .ex/.EX files 
that dh_make generates.  I haven't yet found a tool to pull the 
ChangeLog from Bazaar into debian/changelog.  And I haven't found any 
standard like debian/postinst or RPM's postinstall for upstream 
tarballs, so manual copying is required there, too.

    I've started a simple shell script to automate my package build.  It 
needs a little more work (I still need to include my license, and it 
doesn't carry over the package changelog from prior versions) but maybe 
it will help others.  If I rev the version of my package, it generates a 
new packaging directory and puts it into Bazaar (version control) 
automatically.  I'm using Python's distutils (setup.py) as the starting 
point, because it supports RPM natively and with CDBS the DEBs come 
almost for free.

    I hope this mess gets cleaned up in the future... the learning curve 
on making a simple package is much steeper than it needs to be.


Thanks Again,
Derek Simkowiak

P.S.> My custom little build script "build_deb.sh" follows (78 lines).

#!/bin/bash

VERSION="0.1"
PACKAGE="vm-shell-client"

# Die on error:
set -e

# chdir up, if called from within ./tools
if [ -e ../setup.py ]; then
    cd ../
fi


# Build the tarball:
python setup.py sdist

# Decompress it:
cd dist
gzip -dc ${PACKAGE}-${VERSION}.tar.gz | tar xfBp -

# Move it to the .orig.tar.gz name that DEB expects
mv ${PACKAGE}-${VERSION}.tar.gz ${PACKAGE}_${VERSION}.orig.tar.gz

# Build the package
cd ${PACKAGE}-${VERSION}

# Create any necessary (new) package files:
if [ ! -e debian ]; then
    mkdir -p debian
    bzr init
fi

if [ ! -e debian/control ]; then
    cat >> debian/control <<EOD
Source: $PACKAGE
Section: Utilities
Priority: optional
Maintainer: Derek Simkowiak <debs at cool-st.com>
Build-Depends: cdbs (>=0.4.49), debhelper (>= 5), python-central (>=0.5.6)
XS-Python-Version: >=2.4
Standards-Version: 3.7.2

Package: $PACKAGE
Architecture: all
XB-Python-Version: \${python:Versions}
Depends: openssh-client, bash, \${python:Depends}, \${misc:Depends}
Description: Run vm-shell commands directly from bash
 Config file at /etc/vm-shell.conf

EOD
    bzr add debian/control
fi

if [ ! -e debian/rules ]; then
    cat >> debian/rules <<EOD
#!/usr/bin/make -f

DEB_PYTHON_SYSTEM=pycentral

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk

# Add here any variable or target overrides you need.
EOD
    chmod +x debian/rules
    bzr add debian/rules
fi

if [ ! -e debian/changelog ]; then
    dch --create --package $PACKAGE -v $VERSION
    bzr add debian/changelog
else
    dch
fi

#bzr builddeb # Broken.
dpkg-buildpackage



More information about the linux-list mailing list