[Yum-devel] [PATCH] Fix no script output from transaction, BZ 554462

Panu Matilainen pmatilai at laiskiainen.org
Tue Jan 19 08:40:36 UTC 2010


On Mon, 18 Jan 2010, James Antill wrote:

> On Mon, 2010-01-18 at 17:37 +0200, Panu Matilainen wrote:
>> On Mon, 18 Jan 2010, James Antill wrote:
>>
>>> ---
>>> rpmUtils/transaction.py |    9 +++++++++
>>> 1 files changed, 9 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/rpmUtils/transaction.py b/rpmUtils/transaction.py
>>> index 329de69..7e21fbf 100644
>>> --- a/rpmUtils/transaction.py
>>> +++ b/rpmUtils/transaction.py
>>> @@ -48,6 +48,15 @@ class TransactionWrapper:
>>>         # Automatically close the rpm transaction when the reference is lost
>>>         self.close()
>>>
>>> +    def _wrap_scriptFd_get(self):
>>> +        return self.ts.scriptFd
>>
>> ts.scriptFd is a write-only attribute, the above will raise AttributeError
>> on any current rpm version if used. In rpm 4.8.0 it technically *could*
>> return an FD but it just didn't get done as there's not much use for it.
>
> Yeh, for some reason the _set() thing doesn't work there either. I
> eventually just gave up and did the obvious but slightly more hacky
> thing in a new patch.

I wouldn't be surprised if that has to do with the incredibly hacky way 
ts.scriptFd is implemented in rpm < 4.8.0 or ... perhaps even more likely:

property([fget[, fset[, fdel[, doc]]]])

     Return a property attribute for new-style classes (classes that derive
     from object).

...but TransactionWrapper is an old-style class.

> Has a comment now as this is the reason it broke (yeh, not me):
>
> commit 18c55f481ad1c5edcc70afaef41414c1b8963f7f
> Author: Seth Vidal <skvidal at fedoraproject.org>
> Date:   Thu Oct 18 09:12:08 2007 -0400
>
>    apply patch from Christoph Thiel for suse's rpm handling scriptFd setting
>
> diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
> index a3cb203..05d7fbd 100644
> --- a/yum/rpmtrans.py
> +++ b/yum/rpmtrans.py
> @@ -165,7 +165,7 @@ class RPMTransaction:
>                     fcntl.fcntl(self._readpipe.fileno(),
>                                 fcntl.F_GETFL) | os.O_NONBLOCK)
>         self._writepipe = os.fdopen(w, 'w')
> -        self.base.ts.ts.scriptFd = self._writepipe.fileno()
> +        self.base.ts.scriptFd = self._writepipe.fileno()
>         rpm.setVerbosity(rpm.RPMLOG_INFO)
>         rpm.setLogFile(self._writepipe)
>
> ...which might well mean we broke something for (hopefully only old
> versions of) SuSE.

I fail to see how this could've been correct unless yum itself has been 
patched to either not use the TransactionWrapper class but rpm.ts 
directly, or TransactionWrapper patched to handle the setattr for scriptFd 
specially - neither of which is part of this patch.

 	- Panu -


More information about the Yum-devel mailing list