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

How to create Debian GNU/Hurd packages (part I)



Gordon asked me to post this here, so here it is:

---------- Forwarded message ----------
Date: Fri, 31 Jul 1998 22:40:46 +0200 (CET)
From: Santiago Vila <sanvila@unex.es>
To: Gordon Matzigkeit <gord@trick.fig.org>
Cc: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>,
    gnu-hurd-faq@fig.org
Subject: How to create Debian GNU/Hurd packages (part I)

On 31 Jul 1998, Gordon Matzigkeit wrote:

> I have a FAQ for the two of you:
> 
> Q. What do I need to know in order to create Debian GNU/Hurd packages
> on my existing non-Debian GNU/Linux system?

Good question!

I will answer first to this question:

What do I need to know in order to create Debian GNU/Linux packages
on my existing non-Debian GNU/Linux system?

[ I will answer the question about creating Debian GNU/Hurd packages
in the next mail ].



First, you have to unpack the Debian source: A Debian source package is
normally distributed as three files, .dsc, .diff.gz and .orig.tar.gz.
(sometimes there are only two, .dsc and .tar.gz, for a Debian "native"
package, which has no diffs).

They may be unpacked manually by using tar and patch but it is usually
better to do it with dpkg tools, because this way it is less work:

dpkg-source -x foo.dsc

automatically unpacks the source and apply the diffs.

[dpkg-source is a perl script and it comes with the "dpkg-dev" package,
more on installing a Debian package in a non Debian Linux system later].

For example, to unpack the Debian source of fileutils, we need the
following three files:

fileutils_3.16.orig.tar.gz
fileutils_3.16-5.3.diff.gz
fileutils_3.16-5.3.dsc

And we would have to write:

dpkg-source -x fileutils_3.16-5.3.dsc

The Debian source is then unpacked into the fileutils-3.16
directory. Next step is to enter into this directory:

cd fileutils-3.16

Now, the building of the Debian package is carried via an executable
Makefile called debian/rules, which has several targets.

debian/rules build

does the configuration and compiles the program.
It may be executed as a normal user.

debian/rules binary

creates the binary .deb packages. It must be run as root.

A Debian source package may produce sometimes several .deb packages,
some of them may be architecture dependent and some of them not.
Since the architecture independent packages are shared between
architectures, we do not want to generate them.

For this, the binary target always depends on "binary-arch" and
"binary-indep" targets, so we will only have to use binary-arch.

Summary so far:

debian/rules build         (as a normal user or as root) followed by
debian/rules binary-arch   (as root)

would create the arch-dependent .deb packages for this source package.


How to upload to the Debian archives: For every .deb file
is created, there must be a corresponding .changes file, describing
many things about the .deb package(s) are being uploaded. This .changes
file is automatically created by dpkg-genchanges, and it must be
PGP-signed, but in practice, it is never created by hand. The command
dpkg-buildpackage takes care of almost everything. The command:

dpkg-buildpackage -B -rsudo

first calls the clean target, then calls the build target, then uses
"sudo" to obtain root privileges, and calls the "binary-arch" target to
create the .deb, creates the changes file and automatically calls PGP to
sign it (but only if I remember well; since this is a high-level command,
I do not care so much about what exactly it does...).

There is a nice Debian package called fakeroot which allows to be root
without really being root. Using fakeroot, we can write

dpkg-buildpackage -B -rfakeroot

instead.

[ fakeroot works by wrapping some essential libc system calls
  regarding user ids and such ].



Well, what do we need then if we are not using a Debian system?

The packages "dpkg" and "dpkg-dev", at least. You can use alien to convert
them into .rpm format and install them. They are available at any Debian
mirror in:

dists/stable/main/binary-i386/base/dpkg_1.4.0.23.2.deb
dists/stable/main/binary-i386/utils/dpkg-dev_1.4.0.23.2.deb

with respect to the top level directory.

[*] dpkg is used in the debian/rules file, typically in a line
saying:

	dpkg --build debian/tmp ..


Sometimes a Debian source package needs some other Debian-specific
package, for example, some debian/rules files uses "install -p",
which will be a feature in the next GNU fileutils release, but it is
already present in the Debian release.

Also, if the package which is going to be built contains files not owned
by root, the system in which the package is being built needs to have a
similar /etc/passwd database than the target system (i.e. a Debian
system), so having a base /etc/passwd file like the one in the Debian
"base-passwd" package would be mandatory.


Complete details about creating packages may be found in the Debian
packaging manual available from the dpkg-dev package in
/usr/doc/dpkg/packaging.html.


Next mail will be about cross-compiling for Debian GNU/Hurd from
a GNU/Linux system having the essential tools (dpkg, dpkg-dev and maybe
some other).

Stay tuned...


-- 
To UNSUBSCRIBE, email to debian-hurd-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: