Python bdist_rpm & changing the package name

When you create a RPM package with python's distutils, there is something rater annoying: you can't change the package name. or at least not easily.

After a moment of bad/hard solutions, I've found a easy and clean way to do it:
Let's say you have a customized nose. When you create the RPM with "python setup.py bdist_rpm", the resulting package is nose-$version.rpm, but you want it to be python-nose-$version.rpm, so it can be recognized by redhat packages.

But a src.rpm is also created!

You just have to install (rpm -i) the src.rpm, this will create a .spec file in ~/rpmbuild/SPECS and a tar.gz in ~/rpmbuild/SOURCES. Now, edit the package name in the spec file, decompress/rename the folder/recompress the tar.gz. Run rpmbuild -ba ~/rpmbuild/SPECS/yourspecfile.spec and the new/renamed RPM is in ~/rpmbuild/RPMS.

Comments

Popular posts from this blog

Returning a array of structs with dbus-glib

Choosing a CRT-Shader for Youtube