Bug 189483

Summary: yum should clean only packages which it really installed when keepcache=0
Product: [Fedora] Fedora Reporter: Adam Pribyl <covex>
Component: yumAssignee: Jeremy Katz <katzj>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: bjohnson, katzj, n0dalus+redhat, vonbrand
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-25 14:32:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Pribyl 2006-04-20 13:14:35 UTC
Description of problem:
In FC5 there is by default set keepcache=0 and yum wipes the complete cache when
it succesfully finishes ANY job. This result is situation like this:
1. yum update (you download lot of updates e.g. 500MB), on transaction test you
end up with some kind of error or you cancel the operation. Yum keeps the cache.
2. You decide at least to update kernel. Using yum update kernel wipes complete
cache as this operation was successful.

Version-Release number of selected component (if applicable):
yum-2.6.0-1

How reproducible:
Always

Steps to Reproduce:
1. yum update
2. cancel the operation after you download all updates
3. yum install <whatever>
  
Actual results:
Complete cache is cleaned.

Expected results:
Only those package that really were installed should be deleted when keepcache=0.

Additional info:

Comment 1 n0dalus 2006-07-13 05:47:03 UTC
This happens to me with yum-2.6.1-0.fc5. Very annoying feature.

Relevant code is in __init__.py:

    def runTransaction(self, cb):
        """takes an rpm callback object, performs the transaction"""
[...]
        if errors:
            raise Errors.YumBaseError, errors

        if not self.conf.keepcache:
            self.cleanHeaders()
            self.cleanPackages()
[...]
    def cleanPackages(self):
[...]
        for repo in self.repos.listEnabled():
            repo.dirSetup()
            path = repo.pkgdir
            filelist = misc.getFileList(path, ext, filelist)

        for pkg in filelist:
            try:
                os.unlink(pkg)

In other words, any successful transaction calls cleanPackages and cleanHeaders,
which in turn unlink every file in the 'pkgdir's and 'hdrdir's respectively.

Comment 2 Horst H. von Brand 2006-07-14 01:43:03 UTC
A simple way to get this:

- Install some old i386 package on x86_64
- Upgrade to the x86_64 version

The result is a file conflict, and yum fails.

This happened in rawhide with OOo and lately with xfce from the xfce44beta repo

Comment 3 Jeremy Katz 2006-07-25 14:32:01 UTC
Patch committed upstream, will be in 2.9.4