[Yum-devel] [PATCH 2/5] Remove unnecessary "magic number" test

Panu Matilainen pmatilai at laiskiainen.org
Thu Feb 24 16:20:53 UTC 2011


On 02/24/2011 06:06 PM, seth vidal wrote:
> On Thu, 2011-02-24 at 11:18 +0200, Panu Matilainen wrote:
>> RPMCALLBACK_TRANS_START is only issued once. That "bytes" happens
>> to be a magic value of 6 is just an artifact of truly ancient rpm
>> versions from last century issuing RPMCALLBACK_TRANS_START more than once.
>> ---
>>   yum/rpmtrans.py |    9 ++++-----
>>   1 files changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
>> index 06b484a..30c9dd3 100644
>> --- a/yum/rpmtrans.py
>> +++ b/yum/rpmtrans.py
>> @@ -402,11 +402,10 @@ class RPMTransaction:
>>
>>
>>       def _transStart(self, bytes, total, h):
>> -        if bytes == 6:
>> -            self.total_actions = total
>> -            if self.test: return
>> -            self.trans_running = True
>> -            self.ts_all() # write out what transaction will do
>> +        self.total_actions = total
>> +        if self.test: return
>> +        self.trans_running = True
>> +        self.ts_all() # write out what transaction will do
>>
>>       def _transProgress(self, bytes, total, h):
>>           pass
>
>
> Obviously not THAT ancient, it was added around about rhel 5.0/5.1 era.
>
> What version of rpm are we talking about here?

 From what I searched rpm git archive, the multiple calls to 
RPMCALLBACK_TRANS_START were eliminated in late nineties, so that'd be 
rpm 3.x or thereabouts. Certainly rpm 4.4.x only ever calls it once. I 
know the test appeared in yum in 2007 with the introduction of 
rpmtrans.py, but I just wonder where the heck did it come from :)

	- Panu -


More information about the Yum-devel mailing list