[Rpm-maint] spec file unification across distributions

Pixel pixel at mandriva.com
Tue Jun 24 16:07:45 UTC 2008


Stanislav Brabec <sbrabec at suse.cz> writes:

[...]

> My first mail starts with comparing of basic conventions of openSUSE and
> Fedora. It's still far from being complete. Some things regarding Fedora
> or upstream RPM may be even outdated.
>
>
> External links:
>
> openSUSE packaging http://en.opensuse.org/Packaging
>
> Fedora packaging https://fedoraproject.org/wiki/Packaging/Guidelines

Mandriva packaging: http://wiki.mandriva.com/en/Development/Howto/RPM

[...]

> Higher level solutions built on top of RPM
>
> Official openSUSE solution is ZYPP: http://en.opensuse.org/Libzypp

Mandriva uses urpmi

[...]

> RPM patches
>
> openSUSE uses patched rpm, which does some things differently. For example:

we have a patch to handle %defaultbuildroot

> - safely removes $RPM_BULD_ROOT
>
> - %makeinstall uses DESTDIR

in Mandriva, %makeinstall is vanilla. 
we use %makeinstall_std for DESTDIR compliant Makefile:

%makeinstall_std make DESTDIR=%{?buildroot:%{buildroot}} install

(we didn't want to break)

[...]

> - openSUSE supports Recommends:, Supplements:, Enhances:, Suggests:

part of openSUSE patch is included in mandriva's rpm. It is used for
"Suggests".

[...]

> openSUSE still use PreReq, Fedora uses newer Requires(pre) (note:
> Requires(posttrans) is even not yet implemented).

Well, Requires is usually enough for Requires(posttrans).

(except that Requires(posttrans) may not imply Requires, just like
currently Requires(pre) doesn't fully imply Requires, cf
https://lists.dulug.duke.edu/pipermail/rpm-maint/2008-February/000774.html
https://bugzilla.redhat.com/show_bug.cgi?id=223642)

anyway, Mandriva uses Requires(pre,post) and the like

[...]

> Macros
>
> Here is a set of macros defined in /usr/lib/rpm/suse_macros:

some macros used in Mandriva 
(from /etc/rpm/macros.d: mostly 10manbo-build.macros, 10manbo.macros, 20build.macros, 20common.macros)

%make
%makeinstall_std
%configure2_5x
%ldflags
%setup_compile_flags
%before_configure
%serverbuild

%mklibname
%mdkversion
%mkrel %manbo_mkrel

%_gamesbindir %_gamesdatadir
%_xfontdir
%_webconfdir %_webappconfdir %webappconfdir

%_install_info %_remove_install_info
%_extension

%create_ghostfile
%_get_password
%_create_ssl_certificate
%_post_service %_preun_service
%_pre_useradd %_postun_userdel
%_pre_groupadd %_postun_groupdel
%_post_shelladd %_preun_shelldel
%_post_syslogadd %_preun_syslogdel
%_post_webapp %_postun_webapp

and some more perl/python/ruby/java macros

[...]

> Sysconfig
>
> openSUSE uses a special way to maintain sysconfig files. All sysconfig
> files must have a special sysconfig comments for sysconfig editor.

no such stuff in Mandriva.

[...]

> GConf:
>
> openSUSE and Fedora use three scriptlets to perform the update. As the
> update process combining old and new instance scriptlets is very
> fragile, they are incompatible and clean cross-distro update is
> impossible.

Mandriva removes schema in %preun, but only on package removal.

Installation of schema is done using filetrigger
(http://wiki.mandriva.com/en/Rpm_filetriggers), and is safe in case of
rename or merge.

The only thing not properly handled is: a schema that has less entries
than before, the old entries will not be removed.

[...]

> Texinfo:
>
> openSUSE and Fedora do the same, but openSUSE defines macros %
> install_info and %install_info_delete.

we have %_install_info %_remove_install_info

>
> Actually used scriptlets are fragile and in some situations they keep
> unwanted orphans or delete wanted items.

in case of obsolete? or ?

[...]

> Scrollkeeper:
>
> Fedora uses scriptlets to perform scrollkeeper-update. openSUSE has
> patched scrollkeeper/rarian and can live without scriptlets here.

we use filetrigger to call scrollkeeper-update

[...]

> desktop-database:

we use filetrigger to call "update-desktop-database /usr/share/applications"

[...]

> mimeinfo:

we use filetrigger to call "update-mime-database /usr/share/mime"

[...]

> GTK+ icon cache:

we use filetrigger

[...]

> Fonts:
>
> openSUSE has %run_suseconfig_fonts and a a SuSEconfig script conditionally
> called after every installation. Reverting to RPM based solutions would
> mean a hour or more of installation time in a worst case on slow
> machines.
>
> Fedora calls it at the end of the transaction many times at
> once. Peformance loss is not as bad here, because subsequent runs
> reuse file system cache and run faster.

we call fc-cache in %post (and %postun if package is removed)

we'll switch to filetrigger later

>
>
> Shared libraries:
>
> openSUSE and Fedora do the same (including the tricky way), but
> several openSUSE packages still use deprecated %run_ldconfig.

we use filetrigger to call "ldconfig -X"

[...]

> Initscripts Conventions:
>
> openSUSE has macros doing stuff in a very similar way altogether with
> fillup:
>
> %fillup_and_insserv
> %insserv_only
> %stop_on_removal
> %restart_on_update
>
> The bad thing is the fact, that it may fail badly in case of package
> rename. To fix this failure, a new RPM feature may be needed.

we have %_post_service %_preun_service

it fails badly in case of package&service rename

[...]

> User and group handling:
>
> Both use a very similar approach, but I think there is no convention.
>
> The bad thing is the fact, that calling userdel is unsafe and may fail
> badly for a similar reasons like init scripts.

we do not have pre-allocated users, 

%_pre_useradd %_postun_userdel

but currently %_postun_userdel calls a script which is a noop.

[...]

> libexecdir:
>
> Fedora allows /usr/libexec.
>
> /usr/libexec is not allowed in openSUSE, --libexecdir=%{_prefix}/lib/%{name} is
> preferred. But openSUSE %configure still uses buggy --libexecdir=%{_libdir} and
> each package has to set it explicitly.
> https://bugzilla.novell.com/show_bug.cgi?id=157894

we set %_libexecdir to %_libdir

and so %configure sets --libexecdir=/usr/lib by default.

we have considered reverting to use /usr/libexec again, with no clear
cons.



More information about the Rpm-maint mailing list