%default; ]> Debian New Maintainers' Guide Josip Rodin version 1.2.3, 26 December 2004. Copyright © 1998-2002 Josip Rodin.

This document may be used under the terms the GNU General Public License version 2 or higher.

This document was made using with these two documents as examples:

Making a Debian Package (AKA the Debmake Manual), copyright © 1997 Jaldhar Vyas.

The New-Maintainer's Debian Packaging Howto, copyright © 1997 Will Lowe. Getting started The Right Way

This document tries to describe building of a Debian package to the common Debian user, and prospectus developer. It uses pretty common language, and it's well covered with working examples. There is an old Roman saying, Longum iter est per preaecepta, breve et efficax per exempla! (It's a long way by the rules, but short and efficient with examples!).

One of the things that makes Debian such a top-notch Linux distribution is its package system. While there is a vast quantity of software already in the Debian format, sometimes you need to install software that isn't. You may be wondering how you can make your own packages and perhaps you think it is a very difficult task. Well, if you are a real novice on Linux, it is hard, but if you were rookie, you wouldn't be reading this doc now. :-) You do need to know a little about Unix programming but you certainly don't need to be a wizard.

One thing is certain, though: to properly create and maintain Debian packages you need man hours. Make no mistake, for our system to work the maintainers need to be both technically competent and diligent.

This document will explain every little (at first maybe irrelevant) step, and help you create that first package, and to gain some experience in building next releases of that and maybe other packages later on.

Newer versions of this document should always be available online at and in the ` is also available in the ` Programs you need for development

Before you start anything, you should make sure that you have properly installed some additional packages needed for development. Note that the list doesn't contain any packages marked `essential' or `required' - we expect that you have those installed already.

This revision of this document has been updated for the packages in Debian 2.2 (`potato') and 3.0 (`woody').

The following packages come with the standard Debian installation, so you probably have them already (along with any additional packages they depend on). Still, you should check with `dpkg -s <package>`. ) ) ) This package will also "pull in" several other packages such as ) ) ) )

You'll probably want to install the following packages, too: highly recommended for new maintainers. It makes the whole process very much easier to start, and control afterwards. (see , , /usr/share/doc/debhelper/README) ) sign packages. This is especially important if you want to distribute it to other people, and you will certainly be doing that when your work gets included in the Debian distribution. (see ) ) , ) , ) , /usr/share/doc/lintian/lintian.html/index.html) ) and )

The following is the very important documentation which you should read along with this document:

The short descriptions that are given above only serve to introduce you to what each package does. Before continuing please thoroughly read the documentation of each program, at least the standard usage. It may seem like heavy going now, but later on you'll be very glad you read it.

Note: not covered in this document, because it is deprecated. Please refer to for more information. Other information

There are two types of packages you can make, source and binary. A source package contains code which you can compile into a program. A binary package contains just the finished program. Don't mix terms like source of the program and the source package of the program! Please read the other manuals if you need more details on terminology.

In Debian, the term `maintainer' is used for the person who makes packages, `upstream author' for the person that made the program, and `upstream maintainer' for the person who currently maintains that program, outside of Debian. Usually author and the upstream maintainer are the same person - and sometimes even the maintainer is the same person. If you made a program, and want it to get in Debian, feel free to submit your application to become a maintainer.

After you build your package (or while doing that), you will have to become an official Debian maintainer if you wish your program to get into the next distribution (if the program is useful, why not?). That process is explained in Developer's Reference. Please read it. First steps Choose your program

You have probably chosen the package you want to create. The first thing you need to do is check if the package is in the distribution already. If you use the `stable' distribution, maybe it's best that you go to the . If you use current `unstable' distribution, check it out with these commands: dpkg -s program dpkg -l '*program*'

If the package already exists, well, install it! :-) If it happens to be orphaned -- if its maintainer is set to "Debian QA Group", you should be able to pick it up. Consult and to verify that the package is indeed up for grabs.

If you are able to adopt the package, get the sources (with something like If the package is new, and you decide you'd like to see it in Debian, proceed as follows: check if no one else is working on the package already at . If someone's already on it, contact them if you feel you need to. If not - find another interesting program that nobody maintains. program must have a license, if possible free as according to the . If it doesn't conform to some of these rules but it can be distributed anyway, it could still can be included in the `contrib' or `non-free' sections. If you are unsure about where it should go, post the license text on program certainly should not run setuid root, or even better - it shouldn't need to be setuid or setgid to anything. program should not be a daemon, or something that goes in */sbin directories, or open a port as root. program should result in binary executable form, libraries are harder to handle. it should be well documented, or and the code needs to be understandable (i.e. not obfuscated). you should contact program's author(s) to check if they agree with packaging it. It is important to be able to consult with author(s) about the program in case of any program specific problems, so don't try to package unmaintained pieces of software. and last but not the least, you must know that it works, and have it tried for some time.

Of course, these things are just safety measures, and intended to save you from raging users if you do something wrong in some setuid daemon... When you gain some more experience in packaging, you'll be able to do such packages, but even the experienced developers consult the debian-mentors mailing list when they are in doubt. And people there will gladly help.

For more help about these, check in Developer's Reference. Get the program, and try it out

So the first thing to do is to find and download the original package. I presume that you already have the source file that you picked up at the author's homepage. Sources for free Unix programs usually come in tar/gzip format, with extension .tar.gz, and usually contain the subdirectory called program-version and all the sources in it. If your program's source comes as some other sort of archive (for instance, the filename ends in ".Z" or ".zip"), unpack it with appropriate tools, or ask on the debian-mentors mailing list if you're not sure how to unpack it correctly (hint: issue `file archive.extension`).

As an example, I'll use a program called `gentoo', an X GTK+ file manager. Note that the program is already packaged, and has changed substantially from the version while this text was first written.

Create a subdirectory under your home directory named 'debian' or 'deb' or anything you find appropriate (e.g. just ~/gentoo/ would do fine in this case). Place the downloaded archive in it, and uncompress it (with `tar xzf gentoo-0.9.12.tar.gz`). Make sure there are no errors, even some "irrelevant" ones, because there will most probably be problems unpacking on other people's systems, whose unpacking tools may or may not ignore those anomalies.

Now you have another subdirectory, called 'gentoo-0.9.12'. Change to that directory and thoroughly read the provided documentation. Usually there exist files named README*, INSTALL*, *.lsm or *.html. You must find instructions on how to correctly compile and install the program (most probably they'll assume you want to install to /usr/local/bin directory; you won't be doing that, but more on that later in ).

The process varies from program to program, but a lot of modern programs come with a `configure' script that configures the source under your system and makes sure that your system is in condition to compile it. After configuring with `./configure`, programs are usually compiled with `make`. Some of them support `make check`, to run included self-checks. Installation in destination directories is usually done with `make install`.

Now try to compile and run your program, to make sure it works properly and doesn't break something else while it's installing or running.

Also, you can usually run `make clean` (or better `make distclean`) to clean up the build directory. Sometimes there's even a `make uninstall` which can be used to remove all the installed files. Package name and version

You should start packaging with a completely clean (pristine) source directory, or simply with freshly unpacked sources.

For the package to be built correctly, you must make the program's original name lowercase (if it isn't already), and you should move the source directory to <packagename>-<version>.

If the program name consists of more than one word, contract them to one word, or make an abbreviation. For example, program "John's little editor for X" package would be named johnledx, or jle4x, or whatever you decide, as long as it's under some reasonable limit, e.g. 20 characters.

Also check for the exact version of the program (to be included in the package version). If that piece of software is not numbered with versions like X.Y.Z, but with some kind of date, feel free to use that date as the version number, prepended with a "0.0." (just in case upstream people one day decide to release a nice version like 1.0). So, if the release or snapshot date was 19th of December, 1998, you can use the version string of 0.0.19981219.

Some programs won't be numbered at all, in which case you should contact the upstream maintainer to see if they've got some other revision-tracking method. Initial "debianization"

Make sure you're in the program source directory, and issue this:

dh_make -e your.maintainer@address -f ../gentoo-0.9.12.tar.gz

Of course, replace the string "your.maintainer@address" with your e-mail address for inclusion in the changelog entry and other files, and the filename with the name of your original source archive. See for details.

Some information will come up. It will ask you what sort of package you want to create. Gentoo is a single binary package - it creates only one binary, and thus one .deb file - so we will select the first option, with the `s' key, check the information on the screen and confirm with pressing <enter>.

Once again, as a new maintainer you are discouraged from creating packages with multiple binary packages, or libraries. It's not too hard, but it does require a bit more knowledge, so we won't describe all of it here.

Please note that you should run dh_make only once, and that it won't behave correctly if you run it again in the same, already "debianized", directory. That also means that you will use a different method to release a new revision or a new version of your package in the future. Read more about that later in Modifying the source

Normally, programs install themselves in the /usr/local subdirectories. But, Debian packages must not use that directory, since it is reserved for system administrator's (or user's) private use. This means that you have to take a look at your program's build system, usually starting with the Makefile. This is the script will use to automate building this program. For more details on Makefiles, look in .

Note that if your program uses GNU and/or , meaning the source includes Makefile.am and/or Makefile.in files, respectively, you will need to modify those files. This is because each automake invocation will rewrite Makefile.in's with information generated from Makefile.am's, and each ./configure invocation will do the same with Makefile's, with data from Makefile.in's. Editing Makefile.am files requires some knowledge of automake, which you can read about in the automake info entry, whereas editing Makefile.in files is pretty much the same as editing Makefile files, just pay attention on the variables, i.e. any strings surrounded with `@'s, for example @CFLAGS@ or @LN_S@, which are replaced with actual stuff on each ./configure invocation.

Also note that there isn't space here to go into all the details of fixing upstream sources, but here are a few problems people often run across. Installation in a subdirectory

Most of the programs have some way of installing themselves in the existing directory structure of your system, so that their binaries get included in your $PATH, and that you find their documentation and manual pages in common places. However, if you do that, the program will be installed among everything else already on your system. This would make it hard for the packaging tools to figure out which files belong to your package and which don't.

Therefore you need to do something else: install the program into a temporary subdirectory from which the maintainer tools will build a working .deb package. Everything that is contained in this directory will be installed on a user's system when they install your package, the only difference is that dpkg will be installing the files in the root directory.

This temporary directory is usually created under your debian/ directory in the unpacked source tree. It is usually called debian/tmp or debian/packagename.

Bear in mind that even though you need to make the program install in debian/packagename, it still needs to behave correctly when placed in the root directory, i.e. when installed from the .deb package. So you mustn't allow the build system to hardcode strings like /home/me/deb/gentoo-0.9.12/usr/share/gentoo into the package files.

With programs that use GNU autoconf, this will be quite easy. Most such programs have makefiles that are by default set up to allow installation into a random subdirectory while keeping in mind that /usr (for example) is the canonical prefix. When it detects your program uses autoconf, dh_make will set up commands for doing all this automatically, so you might as well skip reading this section. But with other programs, you will most probably have to examine and edit the Makefiles.

Here's the relevant part of gentoo's Makefile:

# Where to put binary on 'make install'? BIN = /usr/local/bin # Where to put icons on 'make install'? ICONS = /usr/local/share/gentoo

We see that the files are set to install under /usr/local. Change those paths to:

# Where to put binary on 'make install'? BIN = $(DESTDIR)/usr/bin # Where to put icons on 'make install'? ICONS = $(DESTDIR)/usr/share/gentoo

But why in that directory, and not some other? Because Debian packages never install files beneath /usr/local -- that tree is reserved for the system administrator's use. Such files on Debian systems go under /usr instead.

The more exact locations for binaries, icons, documentation etc are specified in the Filesystem Hierarchy Standard (see /usr/share/doc/debian-policy/fhs/). I recommend you browse it and read the sections that might concern your package.

So, we should install the binary in /usr/bin instead of /usr/local/bin, the manual page in /usr/share/man/man1 instead of /usr/local/man/man1 etc. Notice how there's no manual page mentioned in gentoo's makefile, but since the Debian Policy requires that every program has one, we'll make one later and install it in /usr/share/man/man1.

Some programs don't use makefile variables to define paths such as these. This means you might have to edit some real C sources in order to fix them to use the right locations. But where to search, and exactly what for? You can find this out by issuing:

grep -rn usr/local/lib *.[ch]

Grep will run recursively through the source tree and tell you the name of the file and the line in it, when it finds an occurrence.

Edit those files and in those lines replace /usr/local/* with usr/* -- and that's about it. Be careful that you don't mess up the rest of the code! :-)

After that you should find the install target (search for line that starts with `install:', that will usually work) and rename all references to directories other than ones defined at the top of the Makefile. Previously, gentoo's install target said:

install: gentoo install ./gentoo $(BIN) install icons/* $(ICONS) install gentoorc-example $(HOME)/.gentoorc

After our change it says: install: gentoo-target install -d $(BIN) $(ICONS) $(DESTDIR)/etc install ./gentoo $(BIN) install -m644 icons/* $(ICONS) install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc

You've surely noticed that there's now a install -d command before the other commands in the rule. The original makefile didn't have it because usually the /usr/local/bin and other directories already exist on the system where one runs `make install`. However, since we will install into our own empty (or even nonexistent) directory, we will have to create each and every one of those directories.

We can also add in other things at the end of the rule, like the installation of additional documentation that the upstream authors sometimes omit:

install -d $(DESTDIR)/usr/share/doc/gentoo/html cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html

A careful reader will notice that I changed `gentoo' to `gentoo-target' in the `install:' line. That is called an unrelated bug fix :-)

Whenever you make changes that are not specifically related to Debian package, be sure to send them to the upstream maintainer so they can be included in the next program revision and be useful to everyone else. Also remember to make your fixes not specific to Debian or Linux (or even Unix!) prior to sending them -- make them portable. This will make your fixes much easier to apply.

Note that you don't have to send the debian/* files upstream. Differing libraries

There is one other common problem: libraries are often different from platform to platform. For example, a Makefile can contain a reference to a library which doesn't exist on Debian systems. In that case, we need to change it to a library which does exist in Debian, and serves the same purpose.

So, if there is a line in your program's Makefile (or Makefile.in) that says something like this (and your program doesn't compile):

LIBS = -lcurses -lsomething -lsomethingelse

Change it to this, and it will most probably work:

LIBS = -lncurses -lsomething -lsomethingelse

(The author realizes that this is not the best example considering our libncurses package now ships with a libcurses.so symlink, but he couldn't think of a better one. Suggestions very welcome :-) Required stuff under debian/

There is a new subdirectory under the program's source directory, it's called `debian'. There are a number of files in this directory that we should edit in order to customize the behavior of the package. The most important of them are `control', `changelog', `copyright' and 'rules', which are required for all packages. `control' file

This file contains various values which Here is the control file dh_make created for us:

1 Source: gentoo 2 Section: unknown 3 Priority: optional 4 Maintainer: Josip Rodin <joy-mg@debian.org> 5 Build-Depends: debhelper (>> 3.0.0) 6 Standards-Version: 3.5.2 7 8 Package: gentoo 9 Architecture: any 10 Depends: ${shlibs:Depends} 11 Description: <insert up to 60 chars description> 12 <insert long description, indented with spaces> (I've added the line numbers.)

Lines 1-6 are the control information for the source package.

Line 1 is the name of the source package.

Line 2 is the section of the distribution the source package goes into.

As you may have noticed, Debian is divided in sections: main (the free software), non-free (the not really free software) and contrib (free software that depends on non-free software). Under those, there are logical subsections that describe in short what packages are in. So we have `admin' for administrator-only programs, `base' for the basic tools, `devel' for programmer tools, `doc' for documentation, `libs' for libraries, `mail' for e-mail readers and daemons, `net' for network apps and daemons, `x11' for X11 programs that don't fit anywhere else, and many more.

Let's change it then to x11. (A "main/" prefix is implied so we can omit it.)

Line 3 describes how important it is that the user installs this package. See the Policy manual for guidance on what to set this field to. The "optional" priority will usually work for new packages.

Section and priority are used by frontends like As this is a normal priority package and doesn't conflict with anything else, we'll leave it as "optional".

Line 4 is the name and email address of the maintainer. Make sure that this field includes a valid "To: " header for an email, because after you upload it, the bug tracking system will use it to deliver bug emails to you. Avoid using commas, ampersands and parenthesis.

The 5th line includes the list of packages required to build your package. Some packages like gcc and make are implied, see the You can also have Build-Depends-Indep, Build-Conflicts and other fields here. This data will be used by the Debian automatic package building software in order to create binary packages for other computer platforms. See the Policy manual for more information about the build-dependencies and the Developers' Reference for more information about these other platforms (architectures) and how to port software to them.

Here's a hack you can use to find out which packages your package needs to be built: strace -f -o /tmp/log ./configure # or make instead of ./configure, if the package doesn't use autoconf for x in `dpkg -S $(grep open /tmp/log|\ perl -pe 's!.* open\(\"([^\"]*).*!$1!' |\ grep "^/"| sort | uniq|\ grep -v "^\(/tmp\|/dev\|/proc\)" ) 2>/dev/null|\ cut -f1 -d":"| sort | uniq`; \ do \ echo -n "$x (>=" `dpkg -s $x|grep ^Version|cut -f2 -d":"` "), "; \ done

To manually find exact build dependency for /usr/bin/foo, you execute objdump -p /usr/bin/foo | grep NEEDED and for each library listed, e.g., libfoo.so.6, execute dpkg -S libfoo.so.6 Then you just take -dev version of every package as `Build-deps' entry. If you use ldd for this purpose, it will report indirect lib dependencies as well, resulting in the problem of excessive build deps.

Gentoo also happens to require Line 6 is the version of the Debian Policy standards this package follows, the versions of the Policy manual you read while making your package.

Line 8 is the name of the binary package. This is usually the same as the name of the source package, but it doesn't necessarily have to be that way.

Line 9 describes the CPU architecture the binary package can be compiled for. We'll leave this as "any" because will fill in the appropriate value for any machine this package gets compiled on.

If your package is architecture independent (for example, a shell or Perl script, or a document), change this to "all", and read later in about using the `binary-indep' rule instead of `binary-arch' for building the package.

Line 10 shows one of the most powerful features of the Debian packaging system. Packages can relate to each other in various ways. Apart from Depends:, other relationship fields are Recommends:, Suggests:, Pre-Depends:, Conflicts:, Provides:, and Replaces:.

The package management tools usually behave the same way when dealing with these relations; if not, it will be explained. (see , , , etc.)

This is what the dependencies mean:

Depends:

The package will not be installed unless the packages it depends on are installed. Use this if your program absolutely will not run (or will cause severe breakage) unless a particular package is present. Recommends:

Frontends such as dselect or aptitude will prompt you to install the recommended packages along with your package; dselect will even insist. dpkg and apt-get will ignore this field, though. Use this for packages that are not strictly necessary but are typically used with your program. Suggests:

When a user installs your program, all frontends will likely prompt them to install the suggested packages. dpkg and apt-get won't care. Use this for packages which will work nicely with your program but are not at all necessary. Pre-Depends:

This is stronger than Depends:. The package will not be installed unless the packages it pre-depends on are installed and correctly configured. Use this very sparingly and only after discussing it on the debian-devel mailing list. Read: don't use it at all. :-) Conflicts:

The package will not be installed until all the packages it conflicts with have been removed. Use this if your program absolutely will not run or will cause severe problems if a particular package is present. Provides:

For some types of packages where there are multiple alternatives virtual names have been defined. You can get the full list in the /usr/share/doc/debian-policy/virtual-package-names-list.txt.gz file. Use this if your program provides a function of an existing virtual package. Replaces:

Use this when your program replaces files from another package, or completely replaces another package (used in conjunction with Conflicts:). Files from the named packages will be overwritten with the files from your package.

All these fields have uniform syntax. They are a list of package names separated by commas. These package names may also be lists of alternative package names, separated by vertical bar symbols `|' (pipe symbols).

The fields may restrict their applicability to particular versions of each named package. These versions are listed in parentheses after each individual package name, and they should contain a relation from the list below followed by the version number. The relations allowed are: <<, <=, =, >= and >> for strictly earlier, earlier or equal, exactly equal, later or equal and strictly later, respectively. For example,

Depends: foo (>= 1.2), libbar1 (= 1.3.4) Conflicts: baz Recommends: libbaz4 (>> 4.0.7) Suggests: quux Replaces: quux (<< 5), quux-foo (<= 7.6)

The last feature you need to know about is ${shlibs:Depends}. After your package has been built and installed into the temporary directory, will scan it for binaries and libraries, determine their shared library dependencies and detect which packages they are in, such as libc6 or xlib6g. It'll pass on the list to which will fill it in the right place, and you won't have to worry about this yourself.

Having said all that, we can leave the Depends: line exactly as it is now, and insert another line after it saying Suggests: file, because gentoo can use some features provided by that program/package.

Line 11 is the short description. Most people screens are 80 columns wide so this shouldn't be longer than about 60 characters. I'll change it to "A fully GUI configurable X file manager using GTK+".

Line 12 is where the long description goes. This should be a paragraph which gives more details about the package. Column 1 of each line should be empty. There must be no blank lines, but you can put a single . (dot) in a column to simulate that. Also, there must be no more than one blank line after the long description.

Finally, here is the updated control file:

1 Source: gentoo 2 Section: x11 3 Priority: optional 4 Maintainer: Josip Rodin <joy-mg@debian.org> 5 Build-Depends: debhelper (>> 3.0.0), xlibs-dev, libgtk1.2-dev, libglib1.2-dev 6 Standards-Version: 3.5.2 7 8 Package: gentoo 9 Architecture: any 10 Depends: ${shlibs:Depends} 11 Suggests: file 12 Description: A fully GUI configurable X file manager using GTK+ 13 gentoo is a file manager for Linux written from scratch in pure C. It 14 uses the GTK+ toolkit for all of its interface needs. gentoo provides 15 100% GUI configurability; no need to edit config files by hand and re- 16 start the program. gentoo supports identifying the type of various 17 files (using extension, regular expressions, or the 'file' command), 18 and can display files of different types with different colors and icons. 19 . 20 gentoo borrows some of its look and feel from the classic Amiga file 21 manager "Directory OPUS" (written by Jonathan Potter). (I've added the line numbers.) `copyright' file

This file contains the information about package upstream resources, copyright and license information. Its format is not dictated by the Policy, but the contents is (section 13.6 "Copyright information").

dh_make created a default one, this is what it looks like:

1 This package was debianized by Josip Rodin <joy-mg@debian.org> on 2 Wed, 11 Nov 1998 21:02:14 +0100. 3 4 It was downloaded from <fill in ftp site> 5 6 Upstream Author(s): <put author(s) name and email here> 7 8 Copyright: 9 10 <Must follow here> (I've added the line numbers.)

The important things to add to this file are the place you got the package from and the actual copyright notice and license. You must include the complete license, unless it's one of the common free software licenses such as GNU GPL or LGPL, BSD or the Artistic license, when you can just refer to the appropriate file in /usr/share/common-licenses/ directory that exists on every Debian system.

In short, here's how gentoo's copyright file should look like:

1 This package was debianized by Josip Rodin <joy-mg@debian.org> on 2 Wed, 11 Nov 1998 21:02:14 +0100. 3 4 It was downloaded from: ftp://ftp.obsession.se/gentoo/ 5 6 Upstream author: Emil Brink <emil@obsession.se> 7 8 This software is copyright (c) 1998-99 by Emil Brink, Obsession 9 Development. 10 11 You are free to distribute this software under the terms of 12 the GNU General Public License. 13 On Debian systems, the complete text of the GNU General Public 14 License can be found in the file `/usr/share/common-licenses/GPL'. (I've added the line numbers.) `changelog' file

This is a required file, which has a special format described in the Policy section 4.4 "debian/changelog". This format is used by dpkg and other programs to obtain the version number, revision, distribution and urgency of your package.

For you, it is also important, since it is good to have documented all changes you have done. It will help people downloading your package to see whether there are issues with the package that they should know about. It will be saved as `/usr/share/doc/gentoo/changelog.Debian.gz' in the binary package.

dh_make created a default one, and this is how it looks like:

1 gentoo (0.9.12-1) unstable; urgency=low 2 3 * Initial Release. 4 5 -- Josip Rodin <joy-mg@debian.org> Wed, 11 Nov 1998 21:02:14 +0100 6 (I've added the line numbers.)

Line 1 is the package name, version, distribution, and urgency. The name must match the source package name, distribution should be either `unstable' (or even `experimental'), and urgency shouldn't be changed to anything higher than `low'. :-)

Lines 3-5 are a log entry, where you document changes made in this package revision (not the upstream changes - there is special file for that purpose, created by the upstream authors, which you will later install as /usr/share/doc/gentoo/changelog.gz). New lines must be inserted just before the uppermost line that begins with asterisk (`*'). You can do it with , or manually with a text editor.

You will end up with something like this:

1 gentoo (0.9.12-1) unstable; urgency=low 2 3 * Initial Release. 4 * This is my first Debian package. 5 * Adjusted the Makefile to fix $DESTDIR problems. 6 7 -- Josip Rodin <joy-mg@debian.org> Wed, 11 Nov 1998 21:02:14 +0100 8 (I've added the line numbers.)

You can read more about updating the changelog file later in . `rules' file

Now we need to take a look at the exact rules which will use to actually create the package. This file is actually another Makefile, but different than the one(s) in the upstream source. Unlike other files in debian/, this one is marked as executable.

Every `rules' file, as any other Makefile, consists of several rules specifying how to handle the source. Each rule consists of targets, filenames or names of actions that should be carried out (e.g. `build:' or `install:'). Rules that you want to execute are invoked as command line arguments (for example, `./debian/rules build` or `make -f rules install`). After the target name, you can name the dependency, program or file that the rule depends on. After that, there can be any number of commands, indented with <tab>. A new rule begins with the target declaration in the first column. Empty lines and lines beginning with `#' (hash) are treated as comments and ignored.

You are probably confused now, but it will all be clear upon examination of the `rules' file that dh_make gives us as a default. You should also read the `make' entry in info for more information.

The important part to know about the rules file created by dh_make, is that it is just a suggestion. It will work for simple packages but for more complicated ones, don't be afraid to add and subtract from it to fit your needs. Only thing that you must not change are the names of the rules, because all the tools use these names, as mandated by the Policy.

Here's (approximately) how the default debian/rules file that dh_make generated for us looks like:

1 #!/usr/bin/make -f 2 # Sample debian/rules that uses debhelper. 3 # GNU copyright 1997 to 1999 by Joey Hess. 4 5 # Uncomment this to turn on verbose mode. 6 #export DH_VERBOSE=1 7 8 # This is the debhelper compatibility version to use. 9 export DH_COMPAT=4 10 11 CFLAGS = -g 12 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) 13 CFLAGS += -O0 14 else 15 CFLAGS += -O2 16 endif 17 18 build: build-stamp 19 build-stamp: 20 dh_testdir 21 22 # Add here commands to compile the package. 23 $(MAKE) 24 #/usr/bin/docbook-to-man debian/gentoo.sgml > gentoo.1 25 26 touch build-stamp 27 28 clean: 29 dh_testdir 30 dh_testroot 31 rm -f build-stamp 32 33 # Add here commands to clean up after the build process. 34 -$(MAKE) clean 35 36 dh_clean 37 38 install: build 39 dh_testdir 40 dh_testroot 41 dh_clean -k 42 dh_installdirs 43 44 # Add here commands to install the package into debian/gentoo. 45 $(MAKE) install DESTDIR=$(CURDIR)/debian/gentoo 46 47 # Build architecture-independent files here. 48 binary-indep: build install 49 # We have nothing to do by default. 50 51 # Build architecture-dependent files here. 52 binary-arch: build install 53 dh_testdir 54 dh_testroot 55 # dh_installdebconf 56 dh_installdocs 57 dh_installexamples 58 dh_installmenu 59 # dh_installlogrotate 60 # dh_installemacsen 61 # dh_installpam 62 # dh_installmime 63 # dh_installinit 64 dh_installcron 65 dh_installman 66 dh_installinfo 67 # dh_undocumented 68 dh_installchangelogs ChangeLog 69 dh_link 70 dh_strip 71 dh_compress 72 dh_fixperms 73 # dh_makeshlibs 74 dh_installdeb 75 # dh_perl 76 dh_shlibdeps 77 dh_gencontrol 78 dh_md5sums 79 dh_builddeb 80 81 binary: binary-indep binary-arch 82 .PHONY: build clean binary-indep binary-arch binary install (I've added the line numbers.)

You are probably familiar with lines like line 1 from shell and Perl scripts. It tells the operating system that this file is to be processed with /usr/bin/make.

The meaning of DH_* variables mentioned on lines 6 and 9 should be evident from the short description. For more information on DH_COMPAT read the "Debhelper compatibility levels" section of the manual page.

The lines 11 through 16 are a skeleton of support for DEB_BUILD_OPTIONS parameters, described in the Policy section 11.1 "Binaries". Basically, these things control if the binaries are to be built with the debugging symbols, and if they should be stripped upon installation. Again, this is just a skeleton, a hint that you should do it. You should check into how the upstream build system handles the inclusion of debugging symbols and stripping on installation and implement this yourself.

Usually you can tell gcc to compile with "-g" using the CFLAGS variable -- if that's the case for your package, propagate the variable by appending CFLAGS="$(CFLAGS)" to the $(MAKE) invocation in the build rule (see below). Alternatively, if your package uses an autoconf configure script, you can pass it to configure by prepending the above string to the ./configure invocation in the build rule.

As for the stripping, programs are commonly configured to install themselves unstripped, and often without an option to change this. Fortunately, you still have which will detect when the DEB_BUILD_OPTIONS=nostrip flag is set and silently exit.

Lines 18 through 26 describe the `build' (and its child `build-stamp') rule, which runs make with the application's own Makefile to compile the program. If your package uses GNU configure utilities to build binaries, please make absolutely sure to read &autotools-dev; . We'll talk about the commented out docbook-to-man example later in .

The `clean' rule, as specified in lines 28-36, cleans up any unneeded binary or auto-generated stuff, left over from building the package. This rule must be working at all times (even when the source tree The installation process, the `install' rule, starts with line 38. It basically runs the `install' rule from the program's own Makefile, but installs in the $(CURDIR)/debian/gentoo directory - this is why we specified $(DESTDIR) as the root installation directory in gentoo's Makefile.

As the comments suggest, the `binary-indep' rule, on the line 48, is used to build packages independent of architecture. As we don't have any, nothing will be done there.

On to the next rule - `binary-arch', on lines 52 through 79, in which we run several small utilities from the debhelper package that do various operations on your package files to make the package Policy conforming.

If your package is an `Architecture: all' one, you need to include all the commands for building the package under the `binary-indep' rule, and leave the `binary-arch' rule empty instead.

The names of debhelper programs start with dh_, and the rest is the description of what the particular utility does. It is all quite self-explanatory, but here are some additional explanations: checks that you are in the right directory (i.e. the top-level source directory), checks that you have root permissions which is needed for the targets `binary-arch', `binary-indep' and `clean', will copy the manpages into the right place in the destination directory, you just have to tell it where they are, relative to the top-level source directory, strips debugging headers from executable files and libraries, to make them smaller, compresses man pages and documentation larger than 4 kB with , copies package related files (e.g. the maintainer scripts) to the debian/gentoo/DEBIAN directory, calculates shared libraries dependencies of the libraries and executables, installs a fine-tuned version of the control file into debian/gentoo/DEBIAN, generates MD5 checksums for all the files in the package.

For more complete information on what do all these dh_* scripts do, and what their other options are, please read their respective manual pages. There are some other (possibly very useful) dh_* scripts which were not mentioned here. If you need them, read the debhelper documentation.

The binary-arch section is the one where you really should comment out or remove any lines that call features you don't need. For gentoo, I'll comment out lines about examples, cron, init, man and info, simply because gentoo doesn't need them. Also, on the line 68, I'll replace `ChangeLog' with `FIXES', because that is the real name of the upstream changelog file.

The last two lines (along with any other not explained ones) are just some more-or-less necessary things, regarding which you can read in the make manual, and the Policy. For now, they're not important to know about. Other files under debian/

You will see that there exist several other files in the debian/ subdirectory, most of them with the `ex' suffix or prefix, meaning that they are examples. Take a look at all of them. If you wish or need to use any of those features: take a look at the related documentation (hint: the Policy Manual), if necessary modify the files to suit your needs, rename them to remove the `.ex' suffix if they have one, rename them to remove the `ex.' prefix if they have one, modify the `rules' file if necessary.

Some of those files, the commonly used ones, are explained in the following sections. README.Debian

Any extra details or discrepancies between the original package and your debianized version should be documented here.

dh_make created a default one, this is what it looks like:

gentoo for Debian ----------------- <possible notes regarding this package - if none, delete this file> -- Josip Rodin <joy-mg@debian.org>, Wed, 11 Nov 1998 21:02:14 +0100

Since we don't have anything to put there, we'll delete the file. conffiles.ex

One of the most annoying things about software is when you spend a great deal of time and effort customizing a program, only to have an upgrade stomp all over your changes. Debian solves this problem by marking configuration files so that when you upgrade a package, you'll be prompted whether you want to keep your old configuration or not.

The way to do this in a package is to enter the full path to each configuration file (usually in /etc), one per line, in a file called If your program uses configuration files but also rewrites them on its own, it's best not to mark them as conffiles because dpkg will then prompt users to verify the changes all the time.

If the program you're packaging requires every user to modify the configuration file in order to work at all, also consider not marking the file as a conffile.

You can handle example configuration files from the `maintainer scripts', for more information see .

If your program has no conffiles, you can safely delete the cron.d.ex

If your package requires regularly scheduled tasks to operate properly, you an use this file to set it up.

Note that this doesn't include log rotation; for that, see and .

If not, remove it. dirs

This file specifies the directories which we need but the normal installation procedure (make install) somehow doesn't create.

By default, it looks like this:

usr/bin usr/sbin

Note that the preceding slash is not included. We would have normally changed it to look like this:

usr/bin usr/man/man1

but those directories are already created in the Makefile, so we won't need this file, and we will instead delete it. docs

This file specifies the file names of documentation files we can have dh_installdocs install into the temporary directory for us.

By default, it will include all existing files in the top-level source directory that are called "BUGS", "README*", "TODO" etc.

For gentoo, I also included some other stuff:

BUGS CONFIG-CHANGES CREDITS ONEWS README README.gtkrc TODO

We can also remove this file and instead list these files on the dh_installdocs BUGS CONFIG-CHANGES CREDITS ONEWS README \ README.gtkrc TODO

How ever unlikely it may seem, you may not have any such files in your package's sources. In that case you can safely remove this file. But don't remove the emacsen-*.ex

If your package supplies Emacs files that can be bytecompiled at package installation time, you can use these files to set it up.

They are installed into the temporary directory by , so don't forget to uncomment that line in the If you don't need these, remove them. init.d.ex

If your package is a daemon that needs to be run at system startup, you've obviously disregarded my initial recommendation, haven't you? :-)

This is a fairly generic skeleton file for an /etc/init.d/ script, so you'll likely have to edit it, a lot. It gets installed into the temporary directory by .

If you don't need this, remove the file. manpage.1.ex, manpage.sgml.ex

Your program(s) should have a manual page. If they don't, each of these files is a template that you can fill out.

Manual pages are normally written in . The manual page for a brief description of how to edit such a file.

If on the other hand you prefer writing SGML instead of nroff, you can use the install the add remove the comment from the docbook-to-man invocation in the `build' rule of your

And remember to rename the file to something like The final manual page file name should include the name of the program it is documenting, so we will rename it from "manpage" to "gentoo". The file name also includes ".1" as the first suffix, which means it's a manual page for a user command. Be sure to verify that this section is indeed the correct one. Here's a short list of manual page sections:

Section | Description | Notes 1 User commands Executable commands or scripts. 2 System calls Functions provided by the kernel. 3 Library calls Functions within system libraries. 4 Special files Usually found in /dev 5 File formats E.g. /etc/passwd's format 6 Games Or other frivolous programs 7 Macro packages Such as man macros. 8 System administration Programs typically only run by root. 9 Kernel routines Non-standard calls and internals.

So gentoo's man page should be called menu.ex

X Window System users usually have a window manager with a menu that can be customized to launch programs. If they have installed the Debian Here's the default ?package(gentoo):needs=X11|text|vc|wm section=Apps/see-menu-manual\ title="gentoo" command="/usr/bin/gentoo"

The first field after the colon character is "needs", and it specifies what kind of interface the program needs. Change this to one of the listed alternatives, e.g. "text" or "X11".

The next is "section", where the menu and submenu the entry should appear in. The current list of sections is at: /usr/share/doc/debian-policy/menu-policy.html/ch2.html#s2.1

The "title" field is the name of the program. You can start this one in uppercase if you like. Just keep it short.

Finally, the "command" field is the command that runs the program.

Now we'll change the menu entry to this:

?package(gentoo): needs=X11 section=Apps/Tools title="Gentoo" command="gentoo"

You can also add other fields like "longtitle", "icon", "hints" etc. See , and /usr/share/doc/debian-policy/menu-policy.html/ for more information. watch.ex

This file is used to configure the and programs (in the Here's what I put in it:

# watch control file for uscan # Site Directory Pattern Version Script ftp.obsession.se /gentoo gentoo-(.*)\.tar\.gz debian uupdate

Hint: connect to the Internet, and try running "uscan" in the program directory once you create the file. And read the manuals! :) ex.package.doc-base

If your package has documentation other than manual pages and info docs, you should use the `, or .

This usually includes HTML, PS and PDF files, shipped in /usr/share/doc/packagename/.

This is how gentoo's doc-base file gentoo.doc-base looks like:

Document: gentoo Title: Gentoo Manual Author: Emil Brink Abstract: This manual describes what Gentoo is, and how it can be used. Section: Apps/Tools Format: HTML Index: /usr/share/doc/gentoo/html/index.html Files: /usr/share/doc/gentoo/html/*.html

For information on the file format, see and the /usr/share/doc/doc-base/doc-base.html/. postinst.ex, preinst.ex, postrm.ex, prerm.ex

These files are called maintainer scripts. They are scripts which are put in the control area of the package and run by For now, you should try to avoid any manual editing of maintainer scripts if you possibly can because they tend to get complex. For more information look in the Policy Manual, chapter 6, and take a look at these example files provided by dh_make. Building the package

We should now be ready to build the package. Complete rebuild

Enter the program's main directory and then issue this command:

dpkg-buildpackage -rfakeroot

This will do everything for you. It will: clean the source tree (debian/rules clean), using build the source package (dpkg-source -b) build the program (debian/rules build) build the binary package (debian/rules binary), using sign the source create and sign the upload

The only input that will be required of you is your GPG key secret pass phrase, twice.

After all this is done, you will see the following files in the directory above (~/gentoo/):

gentoo_0.9.12.orig.tar.gz

This is the original source code tarball, merely renamed to the above so that it adheres to the Debian standard. Note that this was created using the `-f' option to gentoo_0.9.12-1.dsc

This is a summary of the contents of the source code. The file is generated from your `control' file, and is used when unpacking the source with . This file is GPG signed, so that people can be sure that it's really yours. gentoo_0.9.12-1.diff.gz

This compressed file contains each and every addition you made to the original source code, in the form known as "unified diff". It is made and used by . Warning: if you don't name the original tarball packagename_version.orig.tar.gz, If someone else wants to re-create your package from scratch, they can easily do so using the above three files. The extraction procedure is trivial: just copy the three files somewhere else and run dpkg-source -x gentoo_0.9.12-1.dsc. gentoo_0.9.12-1_i386.deb

This is your completed binary package. You can use gentoo_0.9.12-1_i386.changes

This file describes all the changes made in the current package revision, and it is used by the Debian FTP archive maintenance programs to install the binary and source packages in it. It is partly generated from the `changelog' file and the .dsc file. This file is GPG signed, so that people can be sure that it's really yours.

As you keep working on the package, behavior will change and new features will be added. People downloading your package can look at this file and quickly see what has changed. Debian archive maintenance programs will also post the contents of this file to the debian-devel-changes mailing list.

The long strings of numbers in the .dsc and .changes files are MD5 checksums for the files mentioned. A person downloading your files can test them with and if the numbers don't match, they'll know the file is corrupt or has been tampered with. Quick rebuild

With a large package, you may not want to rebuild from scratch every time while you tune a detail in debian/rules. For testing purposes, you can make a .deb file without rebuilding the upstream sources like this:

fakeroot debian/rules binary

Once you are finished with your tuning, remember to rebuild following the above, proper procedure. You may not be able to upload correctly if you try to upload .deb files built this way. The debuild command

You can automate package build process further with debuild command. See .

Customization of the debuild command can be done through /etc/devscripts.conf or ~/.devscripts. I would suggest at least following items:

DEBSIGN_KEYID="Your_SSH_keyID" DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -ICVS -I.svn" With these, you can build package always with your GPG key and avoid including undesired components. (This is good for sponsoring too.) For example, cleaning source and rebuilding package from a user account is as simple as:

debuild clean debuild The dpatch system

The simple use of dh_make and dpkg-buildpackage commands will create a single large diff.gz file which contains package maintenance files in debian/ and patch files to the source. Such package is a bit cumbersome to inspect and understand for each source tree modification later. This is not so nice. If you are not yet Debian Developer and asking your sponsor to upload your package after his package review, you should make package as easy as possible for him to review.

Several methods for the patch set maintenance have been proposed and in use with Debian packages. The dpatch system is one of the simplest of such patch maintenance system proposed. Other ones are dbs, cdbs, etc.

A package which is packaged properly with the dpatch system has modifications to the source clearly documented as patch set files in debian/patches/ and the source tree is untouched outside of debian/ directory. If you are asking sponsor to upload your package, this kind of clear separation and documentation of your changes are very important to expedite the package review by your sponsor. The usage method of dpatch is explained in .

When someone (including yourself) provides you with a patch to the source later, then the package modification under dpatch is quite simple: Edit patch to make it a -p1 patch to the source tree. Add header using dpatch patch-template command. Drop it into debian/patches Add this dpatch filenames to debian/patches/00list

Also, dpatch has a capability to make patches architecture dependent using CPP macro. Including orig.tar.gz for upload

When you first upload the package to the archive, you need to include the original orig.tar.gz source. If package version is not at -1 debian revision, you must provide dpkg-buildpackage command with the "-sa" option. Checking the package for errors

The lintian and linda packages

Run and on your .changes file; these programs will check for many common packaging errors. The commands are:

lintian -i gentoo_0.9.12-1_i386.changes linda -i gentoo_0.9.12-1_i386.changes

Of course, replace the filename with the name of the .changes file generated for your package. If it appears that there are some errors (lines beginning with E:), read the explanation (the N: lines), correct mistakes, and rebuild as described in . If there are lines that begin with W:, those are warnings, so tune the package or verify that the warnings are spurious (and make Lintian overrides; see the documentation for details).

Note that you can build the package with . The dpkg-deb andf mc commands

You can unpack contents of *.deb package with command. This can be automated using a file manager like which will let you browse not only the contents of *.deb package files but also *.diff.gz and *.tar.gz files.

Be on the lookout for extra unneeded files, both in the binary and source package. Often cruft doesn't get cleaned up properly; adjust your rules file to compensate for that. Tips: `zgrep ^+++ ../gentoo_0.9.12-1.diff.gz` will give you a list of your changes/additions to the source files, and `dpkg-deb -c gentoo_0.9.12-1_i386.deb` will list the files in the binary package. The debi command

Install the package to test it yourself, e.g. using the command as root. Try to install and run it on machines other than your own and watch closely for any warnings or errors both during the installation and while the program is being run. The pbuilder package

For clean room (chroot) build environment to verify the build dependencies, pbuilder package is very useful. This ensures clean build from source under the auto-builder for different architectures and avoid the severity serious FTBFS (Fails To Build From Source) bug which is always in the RC (release critical) category. See for more on the Debian package auto-builder.

The most basic use of pbuilder package is the direct invocation of pbuilder command from root. For example, issue following commands in the directory where .orig.tar.gz, .diff.gz, and .dsc exist to build a package. root # pbuilder create # if second time, pbuilder update root # pbuilder build foo.dsc The newly build packages will be located in /var/cache/pbuilder/result/ with root ownership.

The pdebuild command helps you to use pbuilder package functions from the normal user account with numeric_UID and numeric_GID . I would suggest first customize your system by setting: BUILDRESULTUID=numeric_UID BUILDRESULTGID=numeric_GID AUTO_DEBSIGN=yes in ~/.pbuilderrc or /etc/pbuilderrc . You need to change the ownership of /var/cache/pbuilder/result/ to something like numeric_UID:numeric_GID with the permission 2775 to enable signing from your user account with numeric_UID where you keep your secret GPG key under ~/.gnupg/. You also need to set up this user account with sudo command.

Then, from the root of source tree while having orig.tar.gz file in its parent directory, you issue following commands: $ sudo pbuilder create # if second time, sudo pbuilder update $ pdebuild The newly build packages will be located in /var/cache/pbuilder/result/ with non-root ownership.

See , , , and . Uploading the package

Now that you have tested your new package thoroughly, you will be ready to start the Debian new maintainer application process, as described at

Once you become an official developer, you'll need to upload the package to the Debian archive. You can do this manually, but it's easier to use the provided automated tools, like or . We'll describe how it's done with First you have to set up dupload's config file. You can either edit the system-wide /etc/dupload.conf file, or have your own ~/.dupload.conf file override the few things you want to change. Put something like this in the file:

package config; $default_host = "ftp-master"; $cfg{"ftp-master"}{"login"} = "yourdebianusername"; $cfg{"non-us"}{"login"} = "yourdebianusername"; 1;

Of course, change my personal settings to yours, and read the manual page to understand what each of these options means.

The $default_host option is the trickiest one -- it determines which of the upload queues will be used by default. "ftp-master" is the primary one, but it's possible that you will want to use another, faster one. For more information about the upload queues, read the Developers' Reference, section "Uploading a package", at &uploading;

Then connect to your Internet provider, and issue this command:

dupload gentoo_0.9.12-1_i386.changes

so it can properly upload.

If you upload to "ftp-master", If you want to create a personal package archive at URL="http://people.debian.org/~account_name" as a developer with simple invocation of dupload -t target_name, you should add following to /etc/dupload.conf file: # Developer account $cfg{'target_name'} = { fqdn => "people.debian.org", method => "scpb", incoming => "/home/account_name/public_html/package/", # I do not need to announce dinstall_runs => 1, }; $cfg{'target_name'}{preupload}{'changes'} = " echo 'mkdir -p public_html/package' | ssh people.debian.org 2>/dev/null ; echo 'Package directory created!'"; $cfg{'target_name'}{postupload}{'changes'} = " echo 'cd public_html/package ; dpkg-scanpackages . /dev/null >Packages || true ; dpkg-scansources . /dev/null >Sources || true ; gzip -c Packages >Packages.gz ; gzip -c Sources >Sources.gz ' | ssh people.debian.org 2>/dev/null ; echo 'Package archive created!'"; Here, APT archive is built with a quick and dirty remote shell execution with SSH. The override files required by dpkg-scanpackages and dpkg-scansources are given as /dev/null. This technique can be used by non Debian Developer to host his packages in his personal web host site. Updating the package New Debian revision

Let's say that a bug report was filed against your package, #54321, and it describes a problem that you can solve. To create a new Debian revision of the package, you need to: Correct the problem in the package source, of course. Add a new revision at the top of the Debian changelog file, for example with `dch -i`, or explicitly with `dch -v <version>-<revision>` and then insert the comments using your preferred editor.

Tip: how to easily get the date in required format? Use `822-date`, or `date -R`. Include a short description of the bug and the solution in the changelog entry, followed by this: "Closes: #54321". That way, the bug report will be automagically closed by the archive maintenance software the moment your package gets accepted in the Debian archive. Repeat what you did in , , and . The difference is that this time, original source archive won't be included, as it hasn't been changed and it already exists in the Debian archive. New upstream release

Now let's consider a different, a wee bit more complicated situation - a new upstream version was released, and of course you want it packaged. You need to do the following: Download the new sources and put the tarball (e.g. named `gentoo-0.9.13.tar.gz') in the directory above the old source tree (e.g. ~/gentoo/). Enter the old source directory, and run: uupdate -u gentoo-0.9.13.tar.gz

Of course, replace this file name with the name of your program's new source archive. will properly rename that tarball, try to apply all the changes from your previous .diff.gz file, and update the new debian/changelog file. Change directory to `../gentoo-0.9.13', the new package source tree, and repeat what you did in , , and .

Note that if you set up `debian/watch' file as described in , you can run to automagically look for revised sources, download them, and run The orig.tar.gz file

If you simply copy the content of debian/ directory from the old package into the new upstream version of the source tree and try to build package, you may end up unintentionally creating a native source package which comes without diff.gz file. This type of packaging is only appropriate for the debian-specific packages, which will never be useful in another distribution. Some people argue that, even for the Debian specific package, it is a better practice to package the contents of the debian/ directory residing not in the orig.tar.gz file, but in the diff.gz file.

Here, you must have the upstream tarball as <packagename>_<upstream_version>.orig.tar.gz file in the parent directory. Usually, this tarball should untar to a source tree under a directory name <packagename>-<upstream_version>/. In this cases, the orig.tar.gz source file can be obtained by simply rename the upstream's release tarball to: <packagename>_<upstream_version>.orig.tar.gz . Please note that 2 changes exist between source tree directory name and the tar file name: Change hyphen "-" to underscore "_" Add "orig." before "tar.gz."

The dh_make command usually takes care creation of orig.tar.gz file. The cvs-buildpackage command and similes

You should consider to use some source code management system to manage packaging activity. There are several wrapper scripts which are customized to be use with the most popular ones. CVS cvs-buildpackage Subversion svn-buildpackage Arch (tla) tla-buildpackage arch-buildpackage

These commands also automate the packaging of new upstream release. Verifying package upgrades

When you build a new version of the package, you should do the following to verify that the package can be safely upgraded: upgrade from the previous version downgrade back again and then remove it, install the new package remove it and then reinstall it again, purge it.

Bear in mind that if your package has previously been released in Debian, people will often be upgrading to your package from the version that was in the last Debian release. Remember to test upgrades from that version, too. Where to ask for help

Before you decide to ask your question in some public place, please just RTFM. That includes documentation in /usr/share/doc/dpkg, /usr/share/doc/debian, &autotools-dev;, /usr/share/doc/package/* files and the man/info pages for all the programs mentioned in this document. See all the information at and .

If you have questions about packaging that you couldn't find answers to in the documentation, you can ask them on the Debian Mentors' mailing list at See for more information about this mailing list.

When you receive a bug report (yes, actual bug reports!), you will know that it is time that you dig in the and read the documentation there, to be able to deal with the reports efficiently. I highly recommend reading the Developers' Reference, chapter "Handling Bugs", at &bughandling;

If you still have questions, ask on the Debian Developers' mailing list at for more information about this mailing list.

Even if it all worked well, it's time to start praying. Why? Because in just a few hours (or days) users from all around the world will start to use your package, and if you made some critical error you'll get mailbombed by numerous angry Debian users... Just kidding. :-)

Relax and be ready for bug reports, because there is a lot more work to be done before your package will be fully in line with Debian policies (once again, read the real documentation for details). Good luck!