[Distutils] Patch to bdist_rpm

Greg Ward gward@python.net
Sun, 4 Jun 2000 10:38:59 -0400


On 04 June 2000, Harry Henry Gebel said:
> Here is a patch to bdist_rpm. It does the following:

Cool, thanks.  A few comments...

> Reads scripts in from files rather than strings

Then why do the help strings say

  --prep-script        pre-build script  (Bourne shell code)
  --build-script       build script (Bourne shell code)
  --install-script     installation script (Bourne shell code)
  --clean-script       clean script (Bourne shell code)
  --pre-install        pre-install script (Bourne shell code)
  --post-install       post-install script (Bourne shell code)
  --pre-uninstall      pre-uninstall script (Bourne shell code)
  --post-uninstall     post-uninstall script (Bourne shell code)

?  My automatic response to those help messages would be

   setup.py bdist_rpm \
     --post-install="echo 'thanks for installing me" \
     --pre-uninstall="echo 'you bastard! how dare you uninstall me?'"

ie., put unadorned shell code into the appropriate "bdist_rpm" options.
Now I'm totally confused about the right way to proceed.
Considerations:

  * you might prefer to write your {pre,post}-{install,uninstall}
    scripts in Python rather than shell, especially if you'll use
    the same scripts on non-Unix platforms

  * you might have the same scripts for all platforms, or you might have 
    distinct Unix/Windows/Mac OS scripts, or you might even have
    distinct Debian Linux/Red Hat Linux/Free BSD/NetBSD/Solaris/IRIX/...
    scripts

  * very similar to the above: you might have the same scripts for every
    type of built distribution, or you might have different ones for
    RPM, Debian packages, BSD packages, Thomas' homebrew Windows
    installer, Wise installers, etc.

  * you might have very simple, one-command scripts (especially if
    they are shell code), or complex scripts that need to go in a file

  * very rarely would you specify all this on the "bdist_rpm" command
    line -- this is the sort of stuff that the per-distribution config
    file (setup.cfg) is just made for

I don't have a ready answer, I just thought I'd bring up these points
for anyone who thinks they might.  ;-(  I'll leave the bdist_rpm code
alone for now, since there's no point in overgeneralizing yet.

> Adds RPM 2 compatibility mode (untested). Use of this mode requires that
> --bdist-base be specified because bdist_rpm has no way of detecting where
> RPM wants to find spec files and source files. An unmodified RedHat 5.0
> system would require '--bdist-base=/usr/src/RedHat'. (You would also have
> to be root.) If the rpmrc file has been modified to allow RPMs to be built
> by normal users then --build-base would need to be changed accordingly.

Seems reasonable -- probably something you'd set in the site-wide
Distutils config file.  I'll be sure to give it a workout.

I'll check your patch in shortly...

        Greg
-- 
Greg Ward - programmer-at-large                         gward@python.net
http://starship.python.net/~gward/
I just forgot my whole philosophy of life!!!