Howto get yum to install only dependencies for a given pakage?

I am looking for a way to have yum install only dependencies for a given package, something like an --prepare-for-install option so I can take a snapshot of the prepared system and test the rpm setup with different options or rebuilds of the package itself on a clean system without having to rely on the rpm uninstall and without downloading the dependencies each time.


This might be really dumb but it should work.

PACKAGE=awstats
yum deplist $PACKAGE | grep provider | awk '{print $2}' | sort | uniq | grep -v $PACKAGE | sed ':a;N;$!ba;s/\n/ /g' | xargs yum -y install

yum install $(repoquery --requires <package>)