For Ubuntu or Debian based distribution, we use APT-SMARTCLEAN to clean old version packages in APT cache. This Python script will leaves only the latest version of package in cache. It's very helpful if you often doing updates of your packages.
In Fedora we don't have this kind of tools. openSUSE community convert the APT-SMARTCLEAN script to works with RPM. But I think this script is only suitable to use in openSUSE. Although, there's another options to get this script works with another RPM based distribution.
One of them is using Luigi Bitonti's RPM Version Compare (rvc) tool and modified version of APT-SMARTCLEAN script to work with that tool. I will attach all of requirements in this articles to help you get SMARTCLEAN script works with your Fedora installation.
WARNING: Try this tutorial with your own risks! Remember to make a backup of your YUM cache before proceeding.
Since we're not using APT, I change the script name to yum-smartclean.py. To use this script, first we have to compile rvc with this command:
$ gcc -o rvc rvc.c
Give executable permission to yum-smartclean.py with this command:
$ chmod a+x yum-smartclean.py
And then copy the compiled rvc and yum-smartclean.py script to /usr/bin.
To run the script, use this command as root:
# yum-smartclean.py <cache_dir>
You can use -s parameter to try running the script in dryrun mode without deleting any files.
... Found gdm 2.26.1 have 2.26.1 Skipping gdm-2.26.1-13.fc11.i586.rpm Found cpuspeed 1.5 have 1.5 Skipping cpuspeed-1.5-9.fc11.i586.rpm Found childsplay 1.3 have 1.4 Deleting /home/indra/Master/cache/yum/updates/packages/childsplay-1.3-1.fc11.noarch.rpm Found samba 3.4.2 have 3.4.1 Deleting /home/indra/Master/cache/yum/updates/packages/samba-3.4.1-0.41.fc11.i586.rpm Found cronie 1.3 have 1.3 Skipping cronie-1.3-1.fc11.i586.rpm ...