[Mageia-dev] [soft-commits] [3012] Add ability to increase the version number of a given package

Guillaume Rousse guillomovitch at gmail.com
Thu Feb 23 11:16:24 CET 2012


Le 22/02/2012 19:59, Olav Vitters a écrit :
> On Wed, Feb 22, 2012 at 06:13:12PM +0100, Thierry Vignaud wrote:
>> On 22 February 2012 17:06,<root at mageia.org>  wrote:
>>> Revision 3012 Author ovitters Date 2012-02-22 17:06:51 +0100 (Wed, 22 Feb
>>> 2012)
>>>
>>> Log Message
>>>
>>> Add ability to increase the version number of a given package
>>>
>>> Command tries to be careful and does various checks (patches still apply,
>>> etc)
>>
>> Too sad it doesn't support this:
>>    %define rel 3
>>    %define release %mkrel %rel
>> (which is hard anyway and should be rare though it does exist among
>> mga packages)
>
> I could support that or you can commit something to support this.
> However, I want this mga-gnome to be very reliable. No "hope for the
> best". IMO, paranoia is best... best to error out if anything might
> appear strange.
You may be interested in _get_new_version() and  _get_new_release() 
functions in Youri::Package::RPM::Updater code, and their associated 
test suite:

http://www.zarb.org/cgi-bin/viewvc.cgi/youri/soft/Package-RPM-Updater/trunk/lib/Youri/Package/RPM/Updater.pm?revision=2332&view=markup
http://www.zarb.org/cgi-bin/viewvc.cgi/youri/soft/Package-RPM-Updater/trunk/t/parse.t?revision=2134&view=markup

>
>>> +def version_cmp(a, b):
> [..]
>> Please do not reinvent the whell and do sg like this instead:
>>
>> import rpm
>>
>> def compare(t1, t2):
>>     # t1 and t2 are tuples of (version, release)
>>      v1, r1 = t1
>>      v2, r2 = t2
>>      return rpm.labelCompare(('1', v1, r1), ('1', v2, r2))
>
> Cool! I knew there had to be something like this, but couldn't be
> bothered to investigate. The version_cmp I just copy/pasted from some
> Python code I wrote for GNOME.
Same hint with is_newer() function in Youri::Check::Test::Updates:

http://www.zarb.org/cgi-bin/viewvc.cgi/youri/soft/check/trunk/lib/Youri/Check/Test/Updates.pm?revision=2239&view=markup
http://www.zarb.org/cgi-bin/viewvc.cgi/youri/soft/check/trunk/t/version.t?revision=1973&view=markup
-- 
BOFH excuse #248:

Too much radiation coming from the soil.


More information about the Mageia-dev mailing list