LWN.net Logo

RPM vs DEB on technical merits alone.

RPM vs DEB on technical merits alone.

Posted Feb 21, 2007 21:24 UTC (Wed) by mheily (guest, #27123)
In reply to: DEB compared with RPM by pizza
Parent article: ESR's goodbye note

The packaging policies have nothing to do with it. The mechanism to create a DEB package is more powerful, understandable, and flexible than the mechanism to create an RPM package.

DEB uses a Makefile to control the package build process. DEB packages use a separate subdirectory to contain packaging-related files where each file has a specific purpose. DEB provides shell scripts (debhelper) that you can use in your Makefile rules.

RPM uses a custom packaging tool (rpmbuild) to control the package build process. RPM combines all packaging information into a single specfile. RPM provides macros which are expanded into Makefile rules.

What debhelper provides is convenience scripts so you don't have to write your own Makefile rules for common tasks. My crontab example showed how you could install and uninstall a crontab(5) entry by adding a single line to the debian/rules Makefile. Perhaps there are system-specific RPM macros you could use to do the same thing -- but I doubt it. More than likely, you will have to add a line to the %postinstall section that has a bunch of system-specific macros such as:

cp %{_sharedir}/%{pkgname}/cron.entry %{_sysconfdir}/cron.d/cron.daily/%{pkgname}

And then you have to add a corresponding line to %postremove saying:

rm %{_sysconfdir}/cron.d/cron.daily/%{pkgname}

Whereas in a DEB package, you simply add a Makefile rule that says:

dh_installcron

And the debhelper script generates the code necessary to install and uninstall the crontab entry. It takes care of the details, without the use of system-specific macros or directory layouts.

Makefiles combined with shell scripts are much more powerful and flexible than macros. AFAIK, the macros in RPM can only used for lexical transformation and substitution. Shell scripts are like functions and can take arguments on the command line, produce debugging output, call other shell scripts, etc.

And you're right -- the rpm(1) utility was so bloated in the past that the package building bits were broken out into a separate rpmbuild(1) executable. I still don't see the need for a special-purpose executable to manage the package build process when we already have a great, universal and time-tested tool for building software: make(1).


(Log in to post comments)

RPM vs DEB on technical merits alone.

Posted Feb 21, 2007 22:35 UTC (Wed) by sfeam (subscriber, #2841) [Link]

Your original example for deb:
For example, if the package needs to install an entry in the system crontab, you add a line to the Makefile that calls the dh_crontab script, which merges the contents of debian/cron.d file into the system cron.d directory.
Your example for rpm:
Add a line to the %postinstall section that has a bunch of system-specific macros such as:
cp %{_sharedir}/%{pkgname}/cron.entry %{_sysconfdir}/cron.d/cron.daily/%{pkgname}

So for deb you have to write a system-specific cron.d script, place it in a directory, add a line to the Makefile. For rpm you add one one line to the spec file. And from this you conclude that the deb process is more convenient? OK.

To return to comparison of higher-level tools, I think any discussion of rpm is incomplete without mention of the excellent urpm meta-tools that let you manage queries, updates, and installations from multiple repositories.

annoyances of building an RPM

Posted Feb 21, 2007 22:48 UTC (Wed) by branden (subscriber, #7029) [Link]

The thing I find most annoying about building RPMs is that I can't just build them from source in a straightforward manner. Not with "rpmbuild" as an unprivileged user. I have to tar up the tree, compress it, and install it in /usr/src/redhat/SOURCES, and the last step requires root privileges.

An unpacked Debian source package -- or a brand-new package you've just created -- is as easy to build as "debian/rules build", and you don't need root.

If there's an easier approach than this, my RPM-savvy co-workers have not shared it with me.

"I don't know how, so it can't be done."

Posted Feb 21, 2007 23:23 UTC (Wed) by JoeBuck (subscriber, #2330) [Link]

One line in .rpmrc suffices to set up a different build area. You don't need to be root.

See here for the details.

"I don't know how, so it can't be done."

Posted Feb 22, 2007 18:22 UTC (Thu) by branden (subscriber, #7029) [Link]

JoeBuck, thanks, even if your subject line is a pretty flagrant distortion of my message. I did say, "if there is a way, my [...] co-workers have not shared it with me."

annoyances of building an RPM

Posted Feb 21, 2007 23:28 UTC (Wed) by dwa (guest, #24604) [Link]

http://myy.helia.fi/~karte/linux/doc/rpm-build-as-user.html covers the basic options you need to do so.

annoyances of building an RPM

Posted Feb 22, 2007 6:29 UTC (Thu) by zlynx (subscriber, #2285) [Link]

RPM builds everything from scratch so that you never end up in the situation where the .src.rpm cannot rebuild the .rpm.

annoyances of building an RPM

Posted Feb 23, 2007 11:27 UTC (Fri) by khim (subscriber, #9252) [Link]

This mechanism can be easily circumvented (homework: find at least 5 ways to do so) and thus again we are returning back to policy.

Basically it's Windows approach: we'll forbid you to do this because you don't deserve to have control. Sad to have this misfeature in *nix tool...

annoyances of building an RPM

Posted Feb 24, 2007 0:41 UTC (Sat) by zlynx (subscriber, #2285) [Link]

Perhaps I should have said that you can't do it as "Just a quick hack to fix the build, I don't have time to do it right."

If you are determined to evade a proper source package, you can of course.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds