[Distutils] bdist_rpm

Greg Ward gward@ase.com
Mon, 24 Apr 2000 21:54:12 -0400

On 24 April 2000, Harry Henry Gebel said:
> Would I be stepping on any toes if I posted a bdist_rpm patch? I am
> writing one as an exercise in learning Distutils internal functions, but I
> don't know if someone else is already working on an official version.

Hey, step on any toes you like.  I'll be ever so *slightly* peeved,
because this means I'll have to learn about Wise or Debian or some other
packaging/installer system in order to get any credit for generating
smart built distributions.  But I'll get over it in oh, about 20

BTW, here's the interface I had in mind for bdist_rpm:

Basic incantation to build a binary RPM:

    setup.py bdist --format=rpm     # creates binary RPM
    setup.py bdist_rpm

To build a source RPM:

    setup.py bdist --format=srpm 
    setup.py bdist_rpm --source
Any RPM-specific options should be supplied to bdist_rpm, ie. if you
want to do anything out of the ordinary, you need to run bdist_rpm,
rather than "bdist --format={rpm,srpm}".

There should be a "--arch" ("--plat"?) option to "build_rpm" to let
people specify the RPM architecture string; it should default to the
result of 'util.get_platform()' (eg. "linux2-i586", "sunos5-sun4u").

Some rules/heuristics/hacks:
  * if not self.distribution.has_ext_modules():
        use "noarch" for the architecture specification in the RPM

  * if util.get_platform() =~ /linux-i\d86/:
        use "i386" for the architecture specification in the RPM

The latter strikes me as vaguely ugly, but it will make life easier for
people generating RPMs for i86 Linux boxen.  Perhaps a similar hack
should be done for the other major Linux platforms, eg. Alpha, SPARC,
PPC, ...?  I dunno what Red Hat's convention for naming RPMs on those
platforms is; I'm not entirely sure we should follow Red Hat's lead here
(what do Mandrake and SuSE use for architecture strings in RPM

One idea that has bounced around in my head is to have a "--cheat" or
"--nasty" option which skips the whole RPM machinery and just creates
the damn binary RPM.  This is purely a speed optimization, and not
something that would save a lot of time overall, so feel free to ignore
me (or accuse me of smoking something weird, etc.).  Might require
direct access to librpm.a, which is a no-no: I don't want Distutils to
rely on any extensions apart from string, re, os, and sys.

And finally, these are just ideas -- feel free to implement whatever
seems right/natural/logical.

Thanks a bunch!

Greg Ward - programmer-at-large                         gward@python.net
Money is a powerful aphrodisiac.  But flowers work almost as well.