Re: clear yum cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Cornette wrote:
> The idea to add an automated method to remove older version rpms while 
> keeping all copies of updated packages sounds like an ideal default 
> behavior for yum to follow. Keeping a copy of updated packages from the 
> original disks while pruning the transitional versions would work for me.
> I know of no current parameter for yum which would accomlish this. If 
> none exists, maybe an RFE filed for yum would get attention to the idea.

The problem is that yum can't know when it's safe to delete old
packages. Unfortunately, not all updates go smoothly: sometimes, if a
new version of a package is broken, the best thing to do is to go back
to the previous version until a fixed package is out.

If that last version was on the install CD, hopefully you'll be able to
install it from the CD. If it was installed through yum, then it would
be a pity to want to go back to it only to find yum has just deleted it,
especially if the update has broken your network connection.

Having said that,
cd /var/cache/yum/updates-released/packages
for i in *.rpm ; do rpm -q $(basename $i .rpm) | grep -q "is not installed" && echo $i ; done
would appear to list all cached packages that are not installed (that
were downloaded from the updates-released repository). Changing "echo"
to "rm" should delete all updates that are no longer installed.

You can change the cd line as appropriate to clear out other
repositories.

If you're scripting this, the cd line should be
cd /var/cache/yum/updates-released/packages || exit
so that you make sure you're in the right directory before you start
deleting files.

Hope this helps,

James.

-- 
E-mail address: james | Og just boggle how stupid spammer is. How stupid
@westexe.demon.co.uk  | spamhaus is. How stupid spamhaven is. Og thought
                      | there was such thing as "evolution". How all these
                      | stupid people still alive? Og boggle. Boggle Og.
                      |     -- Caveman Og


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux