[lfs-dev] Once more: Package Management

Pierre Labastie pierre.labastie at neuf.fr
Mon May 21 23:46:13 PDT 2012

Le 22/05/2012 01:58, Armin K. a écrit :
> Also, I see you mention package managers ... For me, Debian's dpkg is
> the hardest one. debian/rules file uses Makefile syntax which I am not
> familiar with. Red Hat's rpm uses some kind of spec file which doesn't
> seem that hard to understand, but still it's medium-hard for newbies and
> for me, too. Gentoo's portage is difficult like hell, I never even
> bothered to look at one of it's files. Archlinux's pacman seems most
> easiest. It uses bash syntax, it's just like LFS "input" commands are
> pasted into that file. So, if you people decide to "make book generate
> spec files", go for pacman, it will be the most easiest to implement.
It depends on what you want to do with a package manager. I would 
separate two main uses :
(a) Building from sources using a spec file.
(b) Packaging and installing.

As far as (B)LFS is concerned, (a) involves some kind of rewriting of 
the book instructions to make a spec file. I do not know whether it is 
the purpose of (B)LFS to show how to do that. Among the PM I know 
(mainly dpkg and pacman), pacman is by far the easiest for this purpose. 
The spec files used by Bent linux were very simple too, but the project 
seems to have been stale for a few years. I agree that dpkg is more work 
to learn, but at least it is Makefile instructions, not a completely new 
language as rpm.

If the only aim is to do (b), and I would believe that it is what is 
needed by (B)LFS, dpkg is by far the simplest: it amounts to build per 
the book instructions adding DESTDIR to the install commands, making a 
very simple description file (sample below), and running dpkg-deb then 
dpkg -i. Even Pacman is slightly more complicated, because (a) and (b) 
are not well separated. The advantage is that the PM warns you about 
overwritten files, and you can uninstall with just one command.

Sample of the description file for gcc in chapter 6 of LFS:


mkdir -v DEBIAN

cat > DEBIAN/control << EOF

Package: gcc-lfs

Version: 4.4.3

Architecture: i386

Maintainer: Pierre Labastie <lnimbus at club-internet.fr>

Depends: mpfr

Provides: gcc, g++

Description: GNU compiler collection (C and C++)

This package is the LFS installation of the GNU compiler collection, 
which contains only

C and C++. You need to install gcc-blfs for the other compilers.


Only five lines are mandatory:
Package, Version, Architecture, Maintainer, Description. Depends and 
Provides are of course rather useful. It can be made (slightly or much) 
more sophisticated, regarding the post installation instructions and the 
management of config files. This is the same for other PMs. Those 
sophistications are not really needed for (B)LFS, IMHO.


More information about the lfs-dev mailing list