Extracting an rpm to a local directory
From Devpit
Use rpm2cpio
rpm2cpio <rpm-name> | 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
- Then run rpmbuild to unpack the source rpm and apply the patches:
«user@host»: cd /home/$USER/packages «user@host»: rpmbuild -bp SPECS/<package>.spec --nodeps > <package>.log
Note: --nodeps tells rpm to ignore the package dependencies. Package dependencies aren't necessary for simply applying patches.
- Now /home/$USER/packages/BUILD/<package> should have the unpacked sources with the patches applied.