[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Need some tips on building Debian packages



Hi I'm new here.

I've been asking around for help on building debian packages.  I've
been building RPMS for about 1 decade, but never tried to build a
Debian package.   As preparation, I've read through the New
Maintainer's Guide and miscellaneous other web pages.   I came in
through the Ubuntu door.  My friends forwarded some questions to a
person in your list, who suggested I ask here.

Keep in mind that my background is in RPM building, where the emphasis
is on distributing "pristine" source code.  I was initially
shocked/dismayed by the Debian approach because the source code gets
untarred and fiddled with by the packager.  Some of the example guides
that people referred me to may have been bad examples--packagers were
opening the source directory and liberally applying patches and making
changes, and all of those fiddles were getting wrapped up into the one
big diff file, making it impossible to figure out who did what.

I eventually found out that these were bad examples.  At the end of
the day, the recommendation for Debian packaging is essentially the
same as in RedHat: we are aiming to distribute unchanged source that
is patched in a clear and orderly way. There's not much information on
how to manage patches in the Debian New Maintainer's Guide, but in
section 6.4 it does acknowledge the problem and refers to dpatch.

I keep wondering, "If the goal is to re-distribute 'pristine' source
code and patches, why doesn't Debian discourage users from untarring
the sourced code?"    Why can't you make it so the debian directory is
not inside the source tree?  One response I've received is that "we
are not RedHat, try to get over it."

I wonder how you do your day-to-day work on building debs?  I have
followed the dh_make approach of opening the source, and dh_make gives
me template files in  "debian" for  control, rules and such.  I
understand completely that all these different files are just doing
the same thing as the one big SPEC file does in an rpm framework.
After configuring those, I try to do a package build.  While testing
this out, I realize I've made some mistakes while attempting to revise
the Makefile to match the packaging requirements.  It appears to me
that I have to 1) move the debian directory to a safe place, 2) erase
the code tree, 3) untar a fresh copy, 4) copy the debian directory
back into the source tree, and 5) start over trying to fix the
Makefile.  Is that how you do it?  One suggestion I receive is to do
this work in a directory managed by rcs or subversion.  I think that
would be fine too, but harder to set up when you just want to quickly
build some small package that somebody distributed for, say, RedHat or
such. And the Debian diff for the package would then pick up all the
rcs files, right?

In a test case I was working on, the build failed because of a
mismatch between the libtool & automake that were used to create the
source_orig.tar.gz file and the versions available on the current
system.  As a result, it was necessary to run "autogen.sh" in the
source directory before trying configure.  That process creates a
bunch of files that should NOT be included in the Debian diff file,
such as changes in config.sub or such, but the Debian package does
include those things.

In building RPMS, the source code patches are applied, but the output
from autogen and configure is not wrapped up into the changes that are
packaged.

It occurred to me that I could try to work around this by using a
build directory that is completely outside of the source code tree.
In many packages that use autotools, we've found it convenient to
build outside of the source tree and add the --srcdir option to the
configure command.  This leaves the source completely unchanged.  I've
not succeeded in doing this while building a Debian package, however,
because it seems to always want to build stuff in the source tree
itself.  In the process of changing that, I've become confused about
the sorting of installed files into packages.  I'm building library
packages and haven't yet mastered the problem of installing the files
into debian/tmp and then using package.listing files to specify the
files that need to be selected for each Debian package.

-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas


Reply to: