Repackaging RPMs
July 26th, 2006 by ZackToday at work I needed to effectively “unroll”, alter files and “repackage” a Fedora Core 5 (RedHat) RPM (RedHat package Manager) that was non-architecture specific. I wanted to alter some (most) of the files in a couple RPMs and repackage them so the RedHat installer (anaconda) could not tell the difference. It took a little research but I got it figured out. Here is a brief tutorial on how to accomplish this.
We’ll call the package in question pack-1.2-fc5-1.
Get the src rpm pack-1.2-fc5-1.src.rpm
Find the name of the .spec file:
Extract the .spec file which is a configuration file that tells rpmbuild how to build the rpm file:
Extract the archive inside the src rpm (typically pack-1.2-fc5-1.tar.bz2):
Unarchive the pack-1.2-fc5-1.tar.bz2 and make changes to the files in the directory pack-1.2-fc5-1
Change the necessary tags in the .spec file. In this case it was “Platform=noarch”
Repackage the zip file: (in this case)
Move the newly created tar.bz2 file to /usr/src/redhat/SOURCE/ (or wherever your spec file is expecting it to be, with default fedora pacakges they all seem to point here).
To repackage the RPM:
This will re-create a noarch.rpm in /usr/src/redhat/RPM/noarch that contains the changes to the files that you altered.
That’s it!
This is something that I thought would have been a common enough activity that it would be documented, but, surprisingly I had to dig a little to figure it out.

