How-to:building debian packages

From SOFTICE

Jump to: navigation, search

Contents

Assigned to:

  • Alessio Gaspar

See Also:


Synopsis

Eric worked on a minimal Hello world Debian Package, we are going to use a fully fledged Debian binary package now to package warewulf 2.6.1


Building the package

We need:

  • the source tarball warewulf-2.6.2.tar.gz
  • the debian warewulf patch


Here are the steps

Maintainer name : unknown
Email-Address   : alessio@oftice.lklnd.usf.edu 
Date            : Fri, 16 Dec 2005 16:34:58 -0500
Package Name    : warewulf
Version         : 2.6.2
License         : blank
Type of Package : Single
Hit <enter> to confirm: 
Done. Please edit the files in the debian/ subdirectory now. You should also
check that the warewulf Makefiles install into $DESTDIR and not in / .


About debian packages files

Here is the result of a ls in the somedirectory/warewulf-2.6.1/debian/ sub-directory:

changelog     control    dirs                emacsen-remove.ex   manpage.1.ex     menu.ex      preinst.ex     rules                 watch.ex
compat        copyright  docs                emacsen-startup.ex  manpage.sgml.ex  postinst.ex  prerm.ex       warewulf-default.ex
conffiles.ex  cron.d.ex  emacsen-install.ex  init.d.ex           manpage.xml.ex   postrm.ex    README.Debian  warewulf.doc-base.EX

We get rid of what we won't need for this first version by putting it in a sub-dir attic and keeping only:


attic  changelog  compat  conffiles.ex  control  copyright  files  menu.ex  postinst.ex  postrm.ex  preinst.ex  prerm.ex  rules

The we go for editting each debian package file one per one


debian/control

Source: warewulf
Section: unknown  
Priority: optional
Maintainer: alessio <alessio@softice.lklnd.usf.edu>
Build-Depends: debhelper (>= 4.0.0)
Standards-Version: 3.6.1

Package: warewulf
Architecture: i386
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Warewulf Clustering Toolkit
 Warewulf is a Linux cluster solution that is sscalable, flexible and easy to use.
 Managing and distributing Linux systems to any number of nodes becomes a simple
 master / slave relationship. Warewulf is the first of its kind which elegantly
 solves many of the problems associated with administration and scalability.
 It is a proven technology and has been used for years on both production and
 development cluster systems.


debian/changelog

This config file only contains documentation on the first warewulf debian package release.

warewulf (2.6.1-1) unstable; urgency=low

  * Initial Release.
  * Consider beta version
  * man pages, documentation, compiling & installing... is handled by the
        original warewulf Makefile vs. Debian -specific mechanisms, this will
        be fixed in upcoming releases
  * Debian's debian/rules is patching the upstream warewulf's source tree
        before to invoke make all followed by make install
 -- unknown <alessio@localhost.localdomain>  Thu, 15 Dec 2005 15:15:02 -0500


debian/copyright

This package was debianized by alessio <alessio@softice.lklnd.usf.edu> on
Thu, 15 Dec 2005 15:15:02 -0500.

It was downloaded from http://www.warewulf-cluster.org/

Upstream Author: Greg M. Kurtzer <gmk@runlevelzero.net>

Warewulf is Copyright (c) 2003, The Regents of the University of
California, through Lawrence Berkeley National Laboratory (subject to
receipt of any required approvals from the U.S. Dept. of Energy).  All
rights reserved.

Portions of Warewulf may be copyrighted by others, as may be noted in
specific copyright notices within specific files.


debian/conffiles.ex

/etc/warewulf/client.conf
/etc/warewulf/master.conf
/etc/warewulf/nodes.conf
/etc/warewulf/wwinitrd.config

more stuff should probably go here


debian/rules

We need to invoke the upstream Makefile:

  • make sure it gets a DESTDIR argument passed to it
  • apply the patch to the source tree
  • make all to compile it all
  • make install to proceed with the install itself
build: build-stamp

build-stamp: configure-stamp
        dh_testdir

        # Add here commands to compile the package.
        # alessio: we could patch on the fly, so far we patch the source tree before to
        # build the debian package. Doubt that following evolutions will not imply
        # patch-testing by hand prior to repackaging ;P
        # zcat ./debian/ww-2.6.1-deb.01.patch.gz | patch -p1
        $(MAKE) all
        #docbook-to-man debian/warewulf.sgml > warewulf.1

        touch build-stamp


install: build
        dh_testdir
        dh_testroot
        dh_clean -k  --exclude ./etc/rc.d/.svn/entries.orig --exclude ./etc/rc.d/init.d/.svn/entries.orig --exclude ./etc/sysconfig/.svn/entr\
ies.orig
        dh_installdirs

        # Add here commands to install the package into debian/warewulf.
        $(MAKE) install DESTDIR=$(CURDIR)/debian/warewulf
# Build architecture-dependent files here.
binary-arch: build install
        dh_testdir
        dh_testroot
        dh_installchangelogs ChangeLog
        dh_installdocs
        dh_installexamples
#       dh_install
#       dh_installmenu
#       dh_installdebconf
#       dh_installlogrotate
#       dh_installemacsen
#       dh_installpam
#       dh_installmime
#       dh_installinit
#       dh_installcron
#       dh_installinfo
##      dh_installman
##      dh_link
##      dh_strip
##      dh_compress
##      dh_fixperms
#       dh_perl
#       dh_python
#       dh_makeshlibs
        dh_installdeb
##      dh_shlibdeps
        dh_gencontrol
##      dh_md5sums
        dh_builddeb


Complete Package Build

Make sure you are at the source tree's root. We can now build all components of the debian package with:

 dpkg-buildpackage -rfakeroot
  • warning about being unable to clean ./src/thttp (inexisting) is because we didn't yet unpack it with the upstream Makefile


Debian Patches

Once we have our debian package, we are going to prepare for the next step: updating the package once the upstream source will update.

Let's assume we have two directories:

  • warewulf-2.6.2-1
  • warewulf-2.6.2.greg

We create the debian patch to be applied to the new upstream version when it comes out.

 
diff -ruN warewulf-2.6.2-greg warewulf-2.6.2-1 > ww-2.6.2-1.patch 

Then we can try to reapply it to make sure everything is rolling smooth by having a copy of the original source tree that we call "pristine" then doing:

 
cd pristine/ 
cat ../ww-2.6.2-1.patch | patch -p1

Let's make sure now that pristine has become the same as warewulf-2.6.2-1:

 
diff -ruN warewulf-2.6.2-1 pristine
diff -ruN warewulf-2.6.2-greg pristine 

ok now for the BUGS'R'US section. In version 2.6.2 we had to fix a problem w/ Busy Box. You can have a look at post http://lists.caosity.org/pipermail/warewulf/2006-March/002103.html on the warewulf email list where we discuss the fact that src/busybox/gzip.c line 2146 has a const that needs to be removed in the return type of the function.

I'm leaving this as is and adding by hand the new busybox tree and tar.gz with the fix to the debian package. I'm hoping that next upstream release will have this fixed.


Upstreams' Updates & package's udpate

TODO i'll work on it when the next warewulf upstream release occurs and I have to update the debian package


References

[DNMG] Debian New Maintainers' Guide


[DBPB] Debian Binary Package Building HOWTO


[mentors] debian-mentors email list


[DPM] Debian Policy Manual