Friedrich Clausen wrote: > Hello All, > > At my $WORK we have lots of in-house applications used to support the > services we offer to customers and we deploy these to servers as RPMS. > This works well for us except we have thousands of obsolete packages > in our Yum repository that need to be cleaned up. What I would like to > achieve is to keep the latest version + the last 3 revisions of a > package and delete the older revisions. > > I was attempting to do this based on file timestamps but they are not > reliable and in some cases packages were restored from backup in a way > that did not preserve timestamps. So I am investigating writing a Perl > script to do this but it is far from trivial due to the vast variety > of version and release strings used. And there are certain situations > in which the version strings are completely ambiguous (even to me) > but, even if those have to be handled manually, then great time > savings in cleaning up the rest automatically can still be achieved. > > So, before I start (re)inventing this particular wheel, I thought I > would check with the folks on this list since I cannot be the only > person with this problem. Are there any ready to use tools available > to trim down an overwheight RPM repository by deleting obsolete > packages? > > Many thanks! > > Fred. Hi, I've also faced this problem, and you're right: relying on timestamps and/or sort order of the RPM filenames doesn't work. The best tool I've found is "repomanage.py" from the yum-utils package available at: http://yum.baseurl.org/download/yum-utils/ Even though yum-utils claims it needs a newer version of yum than I usually have, I've run the repomanage.py script that's included without any problems. My typical use has been: repomanage.py -o RPMS | xargs rm -f where 'RPMS' is a directory with a whole mess of RPMs. The repomanage.py script with '-o' as an argument spits out only obsoleted RPMs, so the above command removes all but the most recent version. I see that there's a '--keep' option that *might* do what you're looking for (keeping the last 3 or 4 versions), but I have not used this option before. -Greg _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos