If the rpm package, you want to unpack, is for Fedora 11 or older, the Fedora 11 {rpm, rpm2cpio} can extract the file with e.g. unPack_rpm.sh
:
#!/bin/bash
# Purpose: Unpack RPM archives (by @unSpawn)
# Args: /path/to/archive
# Deps: Bash, GNU utils, RPM
rpmDetails() { for Q in changelog provides requires scripts triggers triggerscripts; do
rpm -q -p --${Q} "${f}" 2>&1 | grep -v NOKEY > "${Q}.log"; done; }
rpmUnpack() { f=$(readlink -f "${f}"); file "${f}"|grep -q "RPM.v" && \
{ d=$(basename "${f}" .rpm); d="./${d:=ERROR_$$}"; mkdir -p "${d}" && \
{ cd "${d}" && rpm2cpio "${f}" | cpio -idmv && rpmDetails "${f}"; }; }; }
for f in $@; do rpmUnpack "${f}"; done
exit 0
When you have edited the unpacked files, copy the top directory/directories to BUILDROOT/ . When/if rpmbuild -bb name.spec
reports "not found", create the folder with the app name asked for inside BUILDROOT/, and copy your files there. And run rpmbuild -bb name.spec
again.
My recommended rpmbuild setup : http://www.linuxquestions.org/questions/linux-software-2/need-rpm-package-for-php-version-5-2-7-and-up-on-redhat-5-1-a-766486/#13