diff options
author | Chris Lumens <clumens@redhat.com> | 2008-07-31 11:43:11 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2008-07-31 11:43:24 -0400 |
commit | dea08c6442abbcd9349dc4c6c0ff408847c3926d (patch) | |
tree | b63a4fbc6770ac32e7da6d134e2a352c3feb487c | |
parent | 96eec2bb099fc1353c19c68905f4ba38c18cb805 (diff) | |
download | anaconda-dea08c6442abbcd9349dc4c6c0ff408847c3926d.tar.gz anaconda-dea08c6442abbcd9349dc4c6c0ff408847c3926d.tar.xz anaconda-dea08c6442abbcd9349dc4c6c0ff408847c3926d.zip |
Remove all the RPM lock files before creating a new transaction (#456949).
-rw-r--r-- | packages.py | 11 | ||||
-rw-r--r-- | yuminstall.py | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/packages.py b/packages.py index af71a2f06..50424623d 100644 --- a/packages.py +++ b/packages.py @@ -23,6 +23,7 @@ # Jeremy Katz <katzj@redhat.com> # +import glob import iutil import isys import os @@ -278,14 +279,14 @@ def rpmKernelVersionList(rootPath = "/"): versions = [] - ts = rpm.TransactionSet(rootPath) - # FIXME: and make sure that the rpmdb doesn't have stale locks :/ - for rpmfile in ["__db.000", "__db.001", "__db.002", "__db.003"]: + for rpmfile in glob.glob("%s/var/lib/rpm/__db.*" % rootPath): try: - os.unlink("%s/var/lib/rpm/%s" %(rootPath, rpmfile)) + os.unlink(rpmfile) except: - log.debug("failed to unlink /var/lib/rpm/%s" %(rpmfile,)) + log.debug("failed to unlink %s" % rpmfile) + + ts = rpm.TransactionSet(rootPath) mi = ts.dbMatch('provides', 'kernel') for h in mi: diff --git a/yuminstall.py b/yuminstall.py index da077eba7..9f3a964d9 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1635,11 +1635,11 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon self._checkUpgradeArch(anaconda) def _resetRpmDb(self, rootPath): - for rpmfile in ("__db.000", "__db.001", "__db.002", "__db.003"): + for rpmfile in glob.glob("%s/var/lib/rpm/__db.*" % rootPath): try: - os.unlink("%s/var/lib/rpm/%s" %(rootPath, rpmfile)) + os.unlink(rpmfile) except Exception, e: - log.debug("error %s removing file: /var/lib/rpm/%s" %(e,rpmfile)) + log.debug("error %s removing file: %s" %(e,rpmfile)) def _checkUpgradeVersion(self, anaconda): # Figure out current version for upgrade nag and for determining weird |