Red Hat packaging (and hello all)



Hello,

Just saw this new project mentioned on Gnotices.  I am glad that someone
else is interested in packaging Gnome as a community effort rather than as a
business.

It's somewhat fitting that I got my start learning RPM back in the day (okay
so only a few years ago) of Gnome betas.  I remember version 0.30.1 and
I think I remember an 0.26.something too.  Gnome was why I learned RPM,
trying to keep track of all the damn files it lays all over the place.

It's sad to say it, but RPM documentation is extremely poor.  Over the years
I have picked up several things.  There needs to be a set of guidelines for
gnome packages to ensure quality control and ease of installation.

While everyone is focusing on binary packages, source packages are every bit
as important.  I'll admit I am not very familiar with dpkg, but here are
some things that definitely apply to RPM and might apply to DPKG.

1. The packages should always be built as a non-root user.
2. The source packages should be rebuildable with a simple rpm --rebuild
package.src.rpm
3. Packages must have appropriate Requires and even more important have
appropriate Prereqs
4. Autoconf is great and all, but if a certain library is not available then
package building should fail.  I cannot think of any specifics at the
moment, but if a package is missing functionality because the system it was
built on didn't have libfoo.so that is not a good thing.  Part of this
involves maintaining configure.in and friends appropriately.
5. RPM supports relocating packages, it would be good to support this.  For
example, it may be desirable to install a newer version of gnome packages
into /opt/gnome to test it before going ahead and putting it in the standard
/usr heirarchy.
6. RPM scriptlets are just that, scriptLETS.  That is mini scripts.  The
scriptlets should do the bare minimum for making the package run.  They
should not reconfigure half of the system.  There is a huge difference in
what is considered right and proper for a debian package to do and what is
considered right for an RPM to do.  Debian has interactive configuration.
RPM does not.  There should be absolutely no scriptlets that requires user
input.  There should also not be any scriptlets that require user
interaction after installation for the package to work correctly.
7. Try to maintain the users configuration as much as possible.  Red Hat's
apache packages are bad about this (although it has a lot to do with the way
apache's config file is one large file).

There are many more guidelines I am sure, but those are off the top of my
head.  Most of these are actually my pet peeves with RPM packagers.

On a final note:  I love writing specs and working out the build process and
designing really good packages, /BUT/ A 350 Mhz Pentium II is a bit slow at
compiling gnome.  Given that as previously mentioned an 800 Mhz machine
takes about a day to build gnome I would guess it would take my machine 2
days.

Also, when building packages it often happens that you will have included an
extra file in the files list or something stupid like that causing the past
2 hours of compiling to be lost because RPM will not package something that
it did not build itself.

To deal with this situation I generally do something like this in the
package:

%if "%{fullbuild}" == "0"
%{warn:YOU ARE A BASTARD. DON'T RELEASE THIS }
%else
%define fullbuild 1
%endif

Okay, so maybe the warning is a bit harsh.  Fortunately after building one
of these assuming you used -ba then you can do a --rebuild on the source
RPM and thus you have killed two birds with one stone (1. You know that
--rebuild works, and 2. You know that the package actually builds
correctly).

Then you do something like this:

%prep
%if ! %{fullbuild}
%setup -D -T -n linux
exit 0
%endif
%setup -q -n linux

The last line there is the usual %setup macro, the stuff in the %if block
simply makes sure you are in the build directory for each section of the
build process.

For the build section you want something like:
%build
%if ! %{fullbuild}
exit 0
%endif

Assuming you did something like:
rpm -ba kernel.spec
And then found out during the build that you needed to patch the source or
you were missing files or something then you can do:
rpm --define "fullbuild 0" -ba kernel.spec
That is assuming you were already done building the whole thing and you just
want to install and package it now.

I have noticed that Ximian seems to do something similar (although they use
environment variables rather than RPM macros).

Anyway, I am really looking forward to joining the packaging team!

-Dave





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