Fetching Source RPM with Yum

Find out the name of the package related to a binary of interest:

which valgrind | xargs rpm -qf

Use yumdownloader to fetch matching source RPM:

cd /tmp
yumdownloader --source valgrind

Use dnf download instead:

cd /tmp
dnf download --source valgrind

Make sure your .rpmmacros file is setup (Directions).

Install the source RPM:

rpm -Uv valgrind-3.3.0-3.src.rpm

Use rpmbuild prep to unpack the source and apply the patches:

cd ~/rpm/SPECS
rpmbuild -bp valgrind.spec

Bend the source to your nefarious purpose:

cd ~/rpm/BUILD/valgrind-3.3.0
...

See Building From Source RPM instructions for more information.