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.
The "simple" way is to just dump everything in a directory and run:
...the more complicated way is to setup koji/etc. to do your builds and create the repos.
Check out the "repomanage" utility from the yum-utils RPM. It does exactly what you're looking for.
I would leverage the versioning or labeling system you use to identify builds. You could also identify packages by date with a script running on the server hosting the repository.
If the uploads happen everyday, why not consider deleting the old files which are older beyond say certain number of days(in terms of their access/modification times)? Find and just delete them. If you could have your developers upload builds such that they put the name of the current month into the filename when uploading, it would make sense from the filename directly that the file was uploaded in so called month'year and it makes sense to delete just by the basis of looking at the filename. It would make easy for your script automation to just consider removing those files or just keep those files which match previous month and current month. Just a thought.