Proposal (and yes, I'm willing to do stuff!): Must Use More Macros

Adam Williamson awilliam at redhat.com
Fri Jun 5 17:31:23 UTC 2009


Just wanted to run this by the group to make sure it's desired before I
start working on it...

I've been dipping my toes into packaging things for Fedora lately, and
one thing that feels a bit awkward is that the packaging guidelines are
full of boilerplate like:

"Use this when a desktop entry has a 'MimeType key.

%post
update-desktop-database &> /dev/null || :

%postun
update-desktop-database &> /dev/null || :"

"noarch packages 
The following macros must be used at the top of the spec file to
determine the correct installation paths:

%{!?tcl_version: %global tcl_version %(echo 'puts $tcl_version' | tclsh)}
%{!?tcl_sitelib: %global tcl_sitelib %{_datadir}/tcl%{tcl_version}}"

"If you are installing anything into the global site_packages directory,
use the following trick. First, define python_sitelib at the top of your
specfile:

%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}"

Heck, there's an entire page full of these:

https://fedoraproject.org/wiki/Packaging/ScriptletSnippets

it seems to me that this is a bit of a silly approach - it encourages
cut and paste errors (or people cutting and pasting non-canonical blocks
from other people's spec files), it just looks bad in spec files, and if
any of those snippets happens to need to be changed a bit - say, the
syntax for updating the desktop database changes, or something - we'd
have to adjust them in seven zillion different spec files.

It seems to me it'd make sense to convert all these kinds of snippets
into macros. Am I right, or is there a reason against doing this?

If I'm right, I'm happy to work on this and contribute it as patches to
the relevant packages, or as a new package in itself, or something.
Where should such macros go? Should we have a separate package for them
which is brought in when you install the development environment package
set? Or should they be added to the appropriate -devel packages - e.g.,
Tcl snippets should be turned into a /etc/rpm/macros.tcl that's in the
tcl-devel package? Or a combination of the two?

Thanks!
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Fedora Talk: adamwill AT fedoraproject DOT org
http://www.happyassassin.net




More information about the fedora-devel-list mailing list