61.2 Initiating the Debian Package

The first task is to set up the information required for the Debian packaging system. Extract the distribution:

  $ cd ../../debian/wajig
  $ tar zxvf wajig-2.0.20.tar.gz

This will create the wajig-2.0.20 subdirectory. %Change into %this directory and then configure and compile the application: %

%  $ cd wajig-2.0.20
%  $ ./configure
%  $ make

Now run `dh_make` to set things up for Debian:
  $ cd wajig-2.0.20
  $ dh_make -e kayon.toga@togaware.com -f ../wajig-2.0.20.tar.gz

You will be asked what kind of package to create and since wajig is a single binary package we choose s.

This has now created a debian subdirectory and copy of the original distribution in ../wajig-2.0.20.orig.tar.gz.

Note that you should only ever run dh_make once to create a Debian package.

Now edit the files in the debian subdirectory to tell Debian the appropriate information about the package.

61.2.1 control

The default debian/control file begins as:

Source: wajig
Section: unknown
Priority: optional
Maintainer: Kayon Toga <Kayon.Toga@togaware.com>
Build-Depends: debhelper (>= 4.0.0)
Standards-Version: 3.6.1

Package: wajig
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: <insert up to 60 chars description>
 <insert long description, indented with spaces>

This is edited to become:

Source: wajig
Section: admin
Priority: optional
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Build-Depends-Indep: debhelper (>= 4.0.0), python2.3-dev (>= 2.3-1), python-dev

Package: wajig
Architecture: all
Depends: ${python:Depends}, apt, python-apt
Suggests: wget, fping, debconf, reportbug, apt-move, dpkg-repack, alien, fakeroot, gkdebconf, lynx, python-gtk2, python-glade2, python-gnome2, gnome-terminal, base-config, gnome-tasksel, deborphan, vrms, sudo
Description: simplified Debian package management front end
 Wajig is a single commandline wrapper around apt, apt-cache, dpkg,
 /etc/init.d scripts and more, intended to be easy to use and providing 
 extensive documentation for all of its functions. 
 With a suitable sudo(1) configuration, most (if not all) package installation
 as well as creation tasks can be done from a user shell. Wajig is also 
 suitable for general system administration. 
 Since release 2.0.0, a GUI command 'gjig' is also included in the package. 

61.2.3 changelog

The debian/changelog file is required. This will track changes made to the packaging, with summary information about upstream changes. The bottom of the file might look like:

wajig (0.1.0-1) unstable; urgency=low

  * Initial Release of rewritten Python version

 -- Kayon Toga <Kayon.Toga@togaware.com>  Fri,  7 Sep 2001 ... 

61.2.4 rules

For the wajig package the debian/rules file consists of:

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper. 
# This file was originally written by Joey Hess and Craig Small. 
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction. 
# This special exception was added by Craig Small in version 0.37 of dh-make. 
# This version of the file for the Debian/GNU Linux wajig package
# is Copyright 2001-04 by Dirk Eddelbuettel <edd@debian.org>

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1

upstream: get-orig-source
    lynx http://www.togaware.com/debian

configure: configure-stamp
    ./configure --prefix=/usr 
    touch configure-stamp

build: configure-stamp build-stamp
    touch build-stamp

    rm -f build-stamp configure-stamp
    -$(MAKE) clean


install: build
    dh_clean -k
    $(MAKE) install DESTDIR=$(CURDIR)/debian/wajig 
        # remove the installation-generated files, will be rebuilt in postinst
    rm -vf $(CURDIR)/debian/wajig/usr/share/wajig/*.py[oc]
        # 2.0.4 fixes
#   rm -vf $(CURDIR)/debian/wajig/usr/share/wajig/*.png
#   cp -vax src/pixmaps/* $(CURDIR)/debian/wajig/usr/share/wajig
        # 2.0.9 fixes: need to install bash_completion manually
    cp -vax wajig.completion \
        # 2.0.11 fix: mode wants to be 755 on #! files
    chmod 755 $(CURDIR)/debian/wajig/usr/share/wajig/bash_completion.py

        # From the patch by Martin Krafft, but re-disabled as per discussion
        # with Mathias Klose, see #276537 logs
  # fix for FHS and Python policy compliance
        #mv $(CURDIR)/debian/wajig/usr/share/wajig/*.py $(CURDIR)/debian/wajig/usr/lib/wajig

# Build architecture-independent files here. 
binary-indep: build install
#   dh_installmenu
#   dh_installdebconf
#   dh_installlogrotate
#   dh_installemacsen
#   dh_installcatalogs
#   dh_installpam
#   dh_installmime
#   dh_installinit
#   dh_installcron
#   dh_installinfo
#   dh_undocumented
#   dh_python       /usr/share/wajig
#   dh_perl
#   dh_md5sums

# Build architecture-dependent files here. 
binary-arch: build install
#   dh_testdir
#   dh_testroot
#   dh_installdebconf
#   dh_installdocs  
#   dh_installexamples  
#   dh_installmenu
#   dh_installemacsen
#   dh_installpam
#   dh_installmime
#   dh_installinit
#   dh_installcron
#   dh_installmanpages
#   dh_installinfo
#   dh_undocumented
#   dh_installchangelogs
#   dh_python /usr/share/wajig
#   dh_strip
#   dh_link
#   dh_compress
#   dh_fixperms
#   dh_suidregister
#   dh_installdeb
#   dh_makeshlibs
#   dh_perl
#   dh_shlibdeps
#   dh_gencontrol
#   dh_md5sums
#   dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

61.2.5 Other Files

Some other files created for wajig include the following (only listing those that are changed for wajig):



Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.