Best way to clean up Yum repository

repositoryyum

We have a custom Yum repo that our developers upload builds to.

The problem is that after some time it becomes cluttered with old versions.

Removing the old versions manually is quite annoying, so before we try to automate it ourselves, I wonder if there any script that would clean old RPM's based on version (preferred) or time of upload.

Best would be if we could specify to simple save X last versions, and erase anything else. Then we could cron it and just let it run daily.

Thanks for any idea.

Best Answer

The "simple" way is to just dump everything in a directory and run:

rm $(repomanage --keep=2 --old /path/to/repo)
createrepo /path/to/repo

...the more complicated way is to setup koji/etc. to do your builds and create the repos.