Debian Packaging

From ConShell
Jump to navigation Jump to search


Tidbits related to building packages in the Debian (.deb) package format. It applies equally to Ubuntu and even Linux Mint.

I have used these tips for building packages such as User:Fostermarkd/Applications/xca on Ubuntu

For CPAN (Perl) modules, use dh-make-perl.

Preparation

  • Make sure the prereqs are installed
sudo aptitude install build-essential automake gnupg lintian fakeroot pbuilder dput cdbs dh-make dpatch
  • Pull down the tarball for the source. Copy to srcname_version.orig.tar.gz

e.g. xca-0.6.3.tar.gz becomes xca_0.6.3.orig.tar.gz

  • extract the tarball
  • cd srcname-x.y.z/
  • run dh_make
dh_make --copyright GPL --email mark@foster.cc --single

This creates debian/ subfolder and all the fun files such as

    • changelog <-- change "unstable" to "hardy" and add ~ppa# to the version
    • rules
    • control <-- edit for Build-depends:
    • copyright
  • Review and tweak the files - especially control. This calls for a GPG-signed source package to be built and the -k option ensures it can find my key.

Building

dpkg-buildpackage -S -sa -k6F057F31 -rfakeroot

Another way, without any of the signing operations (useful if key isn't readily available)

dpkg-buildpackage -S -us -uc -rfakeroot
  • Run this once to build a pbuilder environment
sudo pbuilder create
    • Multiple environments can be setup using --distribution ala
sudo pbuilder create --distribution hardy

As of 2007-Oc Run this to build binary package for same

sudo pbuilder build ../*.dsc

Finally check for errors

cd ..; lintian *.dsc

Upload to Personal Package Archive (PPA)

The next step is to upload to my Personal Package Archive (PPA)

Setup ~/.dput.cf

[my-ppa] 
fqdn = ppa.launchpad.net
method = ftp
incoming = ~fostermarkd/ubuntu/
login = anonymous
allow_unsigned_uploads = 0


Tweak the version in changelog e.g. 0.6.3-1~ppa1 and rebuild

mdf-laptop:~/proj/xca> dput my-ppa xca*ppa*source.changes
...
Uploading to my-ppa (via ftp to ppa.launchpad.net):
  xca_0.6.3-1~ppa1.dsc: done.
  xca_0.6.3-1~ppa1.tar.gz: done.
  xca_0.6.3-1~ppa1_source.changes: done.
Successfully uploaded packages.
Not running dinstall.

The package should be build and the build logs can be viewed at https://launchpad.net/~fostermarkd/+archive/+builds or see https://launchpad.net/ubuntu/+builds

Now edit sources.list to list my ppa.

deb     http://ppa.launchpad.net/fostermarkd/ubuntu hardy main restricted universe multiverse
deb-src http://ppa.launchpad.net/fostermarkd/ubuntu hardy main restricted universe multiverse

And install

aptitude update
aptitude install xca


Upload to Ubuntu REVU

After a round or two of PPA testing, it can be time to use REVU, which will take the path of getting the package into Ubuntu proper (via Universe a.k.a. MOTU).

This is purely optional but necessary to get the package reviewed and eventually included into the universe or other repos so a nice way to give back.

Some recent changes in REVU have made for some confusion, but important thing is to verify login at http://revu.ubuntuwire.com/ and also this page.

dput revu *_source.changes

Example...

mdf-laptop:~/proj/xca> dput revu xca_0.6.3-1_source.changes
...
Uploading to revu (via ftp to revu.tauware.de):
  xca_0.6.3-1.dsc: done.
  xca_0.6.3-1.tar.gz: done.
  xca_0.6.3-1_source.changes: done.
Successfully uploaded packages.
Not running dinstall.

Pkg info

Here is an example of the output from aptitude show keepassx This is more-or-less what you would see in the 'control' file mentioned above.

# aptitude show keepassx
Package: keepassx
State: installed
Automatically installed: no
Version: 0.2.2-2
Priority: optional
Section: universe/utils
Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
Uncompressed Size: 1036k
Depends: libc6 (>= 2.5-0ubuntu1), libgcc1 (>= 1:4.1.1-31), libqt4-core (>= 4.2.2),
         libqt4-gui (>= 4.2.2), libstdc++6 (>= 4.1.1-31), libx11-6, libxtst6
Description: Cross Platform Password Manager
 KeePassX is a free/open-source password manager or safe which helps you to manage
 your passwords in a secure way. You can put all your passwords in one database,
 which is locked with one master key or a key-disk. So you only have to remember one
 single master password or insert the key-disk to unlock the whole database. The
 databases are encrypted using the algorithms AES or Twofish.

 Homepage: http://keepassx.sourceforge.net

Related Links

Appendix A - Sections

Section: examples of Ubuntu sections in universe

universe/net
universe/utils
universe/x11
universe/text
universe/perl
universe/games
universe/graphics
universe/devel
universe/doc
universe/kde
universe/sound
universe/libs
universe/science
universe/gnome
universe/mail
universe/hamradio

Note that this type of Section gets interpreted as Component: universe Section: utils