[Python-Dev] Proposal -- makefile patches and scripts to generate python RPMs

Eric S. Raymond esr@thyrsus.com
Wed, 4 Oct 2000 17:56:38 -0400

Jeremy Hylton <jeremy@beopen.com>:
> We are now distributing RPMs for RH 6 with Python and have plans to
> support other distributions we have access to, namely those available
> on the SF compile farm.
> This page has the RPMs:
> http://www.pythonlabs.com/products/python2.0/download_python2.0b2.html
> Can you compare this approach to using a hand-crafted .spec file for
> the RPMs?  It took a little while to figure out how to generate the
> .spec, but now that it has been created it does not seem hard to
> maintain.
> I imagine, without knowing any details of what you propose, that this
> is primarily beneficial for people who do not know how to build RPMs.

Actually, the point of my approach is *not* to hand-craft the spec file.
What I normally do is write a specfile generator script in shell, which
takes the release version as an argument.  Most of the point of the generator
script is so the file list part of the specfile never has to be handhacked.

So, for example, a specfile generator script for Python would know that for
each library file foo.py in the Python X.Y release tree, it needs to generate 
a file entry /usr/lib/pythonX.Y/foo.py -- that way whenever a module is
added to the library it will automatically ripple through to the RPM.

Then I embed something like this in the Makefile:

# Make RPMs.  You need to be root to make this work
RPM = rpm
rpm: dist
	cp foo-$(VERSION).tar.gz foo.xpm $(RPMROOT)/SOURCES;
	$(srcdir)/specgen.sh $(VERSION) >$(RPMROOT)/SPECS/foo.spec
	cd $(RPMROOT)/SPECS; $(RPM) $(RPMFLAGS) foo.spec	
	cp $(RPMROOT)/RPMS/`arch|sed 's/i[4-9]86/i386/'`/foo*-$(VERSION)*.rpm $(srcdir)
	cp $(RPMROOT)/SRPMS/foo*-$(VERSION)*.src.rpm $(srcdir)

Hey presto!  Instant RPMs.  I use this approach for several of my projects.
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

The most foolish mistake we could possibly make would be to permit 
the conquered Eastern peoples to have arms.  History teaches that all 
conquerors who have allowed their subject races to carry arms have 
prepared their own downfall by doing so.
        -- Hitler, April 11 1942, revealing the real agenda of "gun control"