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.
On Wed, 2009-01-07 at 16:23 +0100, 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?I've not done this but I saw no immediate reply. So I thought I'd pass on a thought that might be viable for you. First, I wrote some scripts long ago that encountered the variability of versioning against source tarballs. So I _feel_ your pain. Unfortunately, those scripts are off line for now. Meaning: HDs are not in any system and not labeled so I can't quickly pull them up and pass them on to you. Sorry. But here's my thought. Why not just get a complete list and sort them down into a file. Then, using your editor-of-choice, delete the ones you want to keep. In a few hours or so, you should have a list of those to delete. Turn those into commands, like rpm --erase <full-versioned-package-name> and run it. Make sure you are well backed-up first, of course. With typical expertise in a reasonably powerful editor, like vi(m), after the manual deletes from the file it should go quickly.> > Many thanks! > > Fred. > <snip sig stuff>HTH -- Bill
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
Le mercredi 7 janvier 2009 ? 16:44, William L. Maltby a ?crit?:> rpm --erase <full-versioned-package-name> and run it.This rpm command erase an installed package, not a file in a directory. Regards Alain -- La version fran?aise des pages de manuel Linux http://manpagesfr.free.fr
On Wed, Jan 7, 2009 at 5:16 PM, Alain PORTAL <alain.portal at univ-montp2.fr> wrote:> Le mercredi 7 janvier 2009 ? 16:44, William L. Maltby a ?crit : >> rpm --erase <full-versioned-package-name> and run it. > > This rpm command erase an installed package, not a file in a directory. > > Regards > Alain > -- > La version fran?aise des pages de manuel Linux > http://manpagesfr.free.fr > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >Just to update you guys - the manage repo script seems to work as advertised. Great stuff! Cheers, Fred.