[Rpm-metadata] createrepo makefiles patch for byte compiling .py file

Gareth Armstrong gareth.armstrong at hp.com
Thu Aug 10 15:08:31 UTC 2006


Hello Folks,

I would like to contribute the attached patch to enable the createrepo 
tarball to properly byte-compile its *.py components.

Let me explain the context.  While packaging createrepo for our group on 
my FC5 box, everything goes honky-dory and we have a package containing 
the following:

/usr/bin/createrepo
/usr/share/createrepo
/usr/share/createrepo/dumpMetadata.py
/usr/share/createrepo/dumpMetadata.pyc
/usr/share/createrepo/dumpMetadata.pyo
/usr/share/createrepo/genpkgmetadata.py
/usr/share/createrepo/genpkgmetadata.pyc
/usr/share/createrepo/genpkgmetadata.pyo
/usr/share/doc/createrepo-0.4.4
/usr/share/doc/createrepo-0.4.4/ChangeLog
/usr/share/doc/createrepo-0.4.4/README
/usr/share/man/man8/createrepo.8.gz

But this is not due to the makefiles in the tarball but rather 
"/usr/lib/rpm/brp-python-bytecompile".

This I found out, when I tried to rebuild my src rpm on both Rhel3 and 
Rhel4 and ended up with

/usr/bin/createrepo
/usr/share/createrepo
/usr/share/createrepo/dumpMetadata.py
/usr/share/createrepo/genpkgmetadata.py
/usr/share/doc/createrepo-0.4.4
/usr/share/doc/createrepo-0.4.4/ChangeLog
/usr/share/doc/createrepo-0.4.4/README
/usr/share/man/man8/createrepo.8.gz

For some reason, brp-python-bytecompile doesn't seem to fire on either 
Rhel 3 or 4.

So I modified the top-level Makefile to byte-compile all *.py file as 
per the original intention and now it generates .pyc files.  I also 
modified it to generate .pyo files.  This allows us fall in with the 
python packaging guidelines as currently suggested by Fedora Extras.  So 
the files section of spec file can now become:

%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*.py
%{_datadir}/%{name}/*.pyc
%ghost %{_datadir}/%{name}/*.pyo

instead of:

dir %{_datadir}/%{name}
%{_datadir}/%{name}/*

Along the way, I cleaned up the makefiles in the bin and doc dirs.  This 
might not be to everyone's taste but it makes things more consistent and 
all targets now work again (daily, etc..).  Anyway, it would be nice to 
see this applied or a variant of it.

All the best,

Gareth

-- 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: createrepo-0.4.4-makefiles.patch
Type: text/x-patch
Size: 5989 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/rpm-metadata/attachments/20060810/e5851471/attachment.bin 


More information about the Rpm-metadata mailing list