Extracting an rpm to a local directory

Use rpm2cpio
rpm2cpio  | cpio -ivd

Use rpm unpack an srpm to a local directory

 * If you want an rpm to be built in a hierarchy other than /usr/src/ add the following to your .rpmmacros file:

«user@host»: vim ~/.rpmmacros %_topdir /home/$USER/packages


 * Then create the appropriate directory structure:

«user@host»: mkdir -p /home/$USER/packages/BUILD «user@host»: mkdir -p /home/$USER/packages/RPMS «user@host»: mkdir -p /home/$USER/packages/SRPMS «user@host»: mkdir -p /home/$USER/packages/SOURCES «user@host»: mkdir -p /home/$USER/packages/SPECS

«user@host»: cd /home/$USER/packages «user@host»: rpmbuild -bp SPECS/ .spec --nodeps > .log
 * Then run rpmbuild to unpack the source rpm and apply the patches:

''Note: --nodeps tells rpm to ignore the package dependencies. Package dependencies aren't necessary for simply applying patches.''


 * Now /home/$USER/packages/BUILD/ should have the unpacked sources with the patches applied.