Bug 484729
| Summary: | rpm transaction callback api has changed | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Kevin Fenzi <kevin> |
| Component: | yum | Assignee: | Seth Vidal <skvidal> |
| Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | rawhide | CC: | airlied, davej, ffesti, james.antill, nicolas.mailhot, petersen, pmatilai, tim.lauridsen |
| 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: | 2009-02-24 22:00:09 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
Kevin Fenzi
2009-02-09 17:54:03 UTC
I have a workaround, although I'm not sure if we should use it. Basically it does:
commit 8b750270e0e9549288db54cc011484aee518d30e
Author: James Antill <james>
Date: Mon Feb 9 13:04:11 2009 -0500
Let the fourth arg. to the rpm callback expand to more than 2 things
diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 85896fa..81e1672 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -406,7 +406,7 @@ class RPMTransaction:
self.lastmsg = None
hdr = None
if h is not None:
- hdr, rpmloc = h
+ hdr, rpmloc = h[0], h[1]
handle = self._makeHandle(hdr)
fd = os.open(rpmloc, os.O_RDONLY)
self.filehandles[handle]=fd
[...]
@@ -506,7 +506,7 @@ class RPMTransaction:
# right behavior should be
def _scriptError(self, bytes, total, h):
- (hdr, rpmloc) = h
+ (hdr, rpmloc) = h[0], h[1]
pkgtup = self._dopkgtup(hdr)
txmbrs = self.base.tsInfo.getMembers(pkgtup=pkgtup)
for txmbr in txmbrs:
...Panu or Florian is this the right thing to do? What is the 3rd thing in that tuple/list?
The issue is that in the case of erasure callbacks, there's just one item there but the one thing happens to be a string (the name of the package): >>> h = "packagename" >>> (hdr, rpmloc) = h Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: too many values to unpack The kinda new twist here is that unlike the other callback types, RPMCALLBACK_SCRIPT_ERROR can (and does) happen on both install/upgrade and erase. And it does mean that for %preun and %postun scriptlets, you can't reliably determine which of the packages failed as you only have the name available (essentially the same thing as bug 468418). My bad when introducing _scriptError(), didn't remember the python callback was sooooo broken. What fun... If we're going to be breaking things anyway? How about we switch it so it passes the erased nevra instead of the name as a string. We can treat it the same in yum but ideally report more information in the short term. note: 485373 - looks a lot like this but for i686. me too, just tagging in to know when it gets fixed. *** Bug 485373 has been marked as a duplicate of this bug. *** Panu, So do we need to fix this in yum or are you planning on fixing it in rpm/python bindings - b/c we've gotten 3 bugs with the same behavior, now. okay, on Florian's suggestion I checked in slightly more than james' patch. It's mostly just covers all the places where we look at the value and assume it is a 2-item tuple. Mm.. the rpm callback api didn't really change, it gives you precisely the same things as before. See comment #2, the catch here is that unlike the other callback cases, the new RPMCALLBACK_SCRIPT_ERROR can happen on both install and erase, and install vs erase callback arguments are different, always been. It'd be possible to add some sort of kludge to optionally give the full NEVRA on erase callback instead of just name, but that wont change the number of arguments you get. Again, my bad for not taking the install/erase difference into account when introducing _scriptError() in the yum patch, but rpm/python-side can't much help this without making a completely incompatible change to the callback api. *** Bug 487440 has been marked as a duplicate of this bug. *** *** Bug 513013 has been marked as a duplicate of this bug. *** yum-3.2.24-2.fc11 has been pushed to the Fedora 11 stable repository. If problems still persist, please make note of it in this bug report. yum-3.2.24-2.fc10 has been submitted as an update for Fedora 10. http://admin.fedoraproject.org/updates/yum-3.2.24-2.fc10 yum-3.2.24-2.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report. |