[Bug 1104227] New: python2-yum: rpmsack.py has hard-coded RPM database path
http://bugzilla.opensuse.org/show_bug.cgi?id=1104227 Bug ID: 1104227 Summary: python2-yum: rpmsack.py has hard-coded RPM database path Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.0 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Other Assignee: bnc-team-screening@forge.provo.novell.com Reporter: athorlton@cray.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- I'm getting this error from yum when building CentOS images using kiwi on Leap 15: <snip> Non-fatal POSTIN scriptlet failure in rpm package libsepol-2.5-8.1.el7.x86_64 Traceback (most recent call last): File "/usr/bin/yum", line 29, in <module> yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 288, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 223, in main return_code = base.doTransaction() File "/usr/share/yum-cli/cli.py", line 599, in doTransaction resultobject = self.runTransaction(cb=cb) File "/usr/lib64/python2.7/site-packages/yum/__init__.py", line 1565, in runTransaction self.rpmdb.dropCachedDataPostTransaction(list(self.tsInfo)) File "/usr/lib64/python2.7/site-packages/yum/rpmsack.py", line 329, in dropCachedDataPostTransaction self._cached_rpmdb_mtime = os.path.getmtime(rpmdbfname) File "/usr/lib64/python2.7/genericpath.py", line 62, in getmtime return os.stat(filename).st_mtime OSError: [Errno 2] No such file or directory: '/tmp/centos75-nocp/build/image-root/var/lib/rpm/Packages' </snip> It looks like the RPM database path is hard-coded to /var/lib/rpm/Packages in yum's rpmsack.py: <snip> # grep -nm1 rpmdbfname /usr/lib64/python2.7/site-packages/yum/rpmsack.py 328: rpmdbfname = self.root + "/var/lib/rpm/Packages" </snip> This apparently causes trouble in kiwi's bootstrap phase, when the build host's yum is still being used to install packages into the image root. This issue seems to be fixed by commit 4a4521349 to the upstream yum git tree (git://yum.baseurl.org/yum.git): <snip> commit 4a452134906d7dd7577adce2bbbae26d86efde52 Author: Mike Miller <mtmiller@ieee.org> Date: Thu Jul 11 09:54:13 2013 +0200 Get correct rpmdb path from rpm configuration Fixes failure after install when system stores rpmdb in a non-standard location. diff --git a/yum/rpmsack.py b/yum/rpmsack.py index 56c37931..5b9f798d 100644 --- a/yum/rpmsack.py +++ b/yum/rpmsack.py @@ -233,6 +233,11 @@ class RPMDBPackageSack(PackageSackBase): self._persistdir = root + '/' + persistdir else: self._persistdir = persistdir + if hasattr(rpm, 'expandMacro'): + dbpath = rpm.expandMacro('%_dbpath') + else: + dbpath = '/var/lib/rpm' + self._rpmdbpath = os.path.normpath(root + '/' + dbpath) self._have_cached_rpmdbv_data = None self._cached_conflicts_data = None # Store the result of what happens, if a transaction completes. @@ -336,7 +341,7 @@ class RPMDBPackageSack(PackageSackBase): # We are keeping some data from before, and sometimes (Eg. remove only) # we never open the rpmdb again ... so get the mtime now. - rpmdbfname = self.root + "/var/lib/rpm/Packages" + rpmdbfname = self._rpmdbpath + "/Packages" self._cached_rpmdb_mtime = os.path.getmtime(rpmdbfname) def _safe_del(x, y): @@ -1146,7 +1151,7 @@ class RPMDBPackageSack(PackageSackBase): # http://lists.rpm.org/pipermail/rpm-maint/2007-November/001719.html # ...if anything gets implemented, we should change. rpmdbvfname = self._cachedir + "/version" - rpmdbfname = self.root + "/var/lib/rpm/Packages" + rpmdbfname = self._rpmdbpath + "/Packages" if os.path.exists(rpmdbvfname) and os.path.exists(rpmdbfname): # See if rpmdb has "changed" ... @@ -1169,7 +1174,7 @@ class RPMDBPackageSack(PackageSackBase): if self._cached_rpmdb_mtime is None: return # We haven't loaded any packages!!! - rpmdbfname = self.root + "/var/lib/rpm/Packages" + rpmdbfname = self._rpmdbpath + "/Packages" if not os.path.exists(rpmdbfname): return # haha @@ -1365,7 +1370,7 @@ class RPMDBPackageSack(PackageSackBase): self._name2pkg.setdefault(po.name, []).append(po) self._tup2pkg[po.pkgtup] = po if self.__cache_rpmdb__ and self._cached_rpmdb_mtime is None: - rpmdbfname = self.root + "/var/lib/rpm/Packages" + rpmdbfname = self._rpmdbpath + "/Packages" self._cached_rpmdb_mtime = os.path.getmtime(rpmdbfname) return po </snip> I grabbed the yum source RPM, and rolled in this change. Using my updated python2-yum package fixed the problems that I was having with kiwi. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1104227 Alex Thorlton <athorlton@cray.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |athorlton@cray.com -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1104227 Andreas Stieger <astieger@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |1111112 -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1104227 Bug 1104227 depends on bug 1111112, which changed state. Bug 1111112 Summary: yum: changed build architecture http://bugzilla.opensuse.org/show_bug.cgi?id=1111112 What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com