Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

GenericSetup: comparing version numbers

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


m.van.rees at zestsoftware

Nov 16, 2009, 9:07 AM

Post #1 of 3 (661 views)
Permalink
GenericSetup: comparing version numbers

Hi,

In the metadata.xml in your profile the best practice is currently to
use plain version numbers, right? So just 1, then 2, then 3 etc and
not 1.0 then 1.1 then 1.2, right?

Using plain version numbers I have just hit a problem that I find
strange that I have not hit before. An upgrade step from 8 to 9 went
fine. Then I did an upgrade step from 9 to 10 and suddenly
portal_setup listed theprevious upgrade step as available, since '10'
was alphabetically smaller than '9'...

As a workaround I added one or more zeroes to the source, destination
and metadata.xml version numbers and then it works. I will hit the
next problem after the 99th upgrade step. ;-)

Should we change this in GenericSetup itself and add some zeroes in
front when comparing numbers?

Cheers,

--
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


hanno at hannosch

Nov 16, 2009, 9:12 AM

Post #2 of 3 (638 views)
Permalink
Re: GenericSetup: comparing version numbers [In reply to]

Hi.

On Mon, Nov 16, 2009 at 6:07 PM, Maurits van Rees
<m.van.rees [at] zestsoftware> wrote:
> In the metadata.xml in your profile the best practice is currently to
> use plain version numbers, right?  So just 1, then 2, then 3 etc and
> not 1.0 then 1.1 then 1.2, right?

Yes.

> Using plain version numbers I have just hit a problem that I find
> strange that I have not hit before.  An upgrade step from 8 to 9 went
> fine.  Then I did an upgrade step from 9 to 10 and suddenly
> portal_setup listed theprevious upgrade step as available, since '10'
> was alphabetically smaller than '9'...
>
> As a workaround I added one or more zeroes to the source, destination
> and metadata.xml version numbers and then it works.  I will hit the
> next problem after the 99th upgrade step. ;-)
>
> Should we change this in GenericSetup itself and add some zeroes in
> front when comparing numbers?

Which version of GenericSetup was this? In the upcoming 1.5 (Plone
4.0) the code uses the pkg_resources API to parse version numbers
instead of interpreting them as simple strings. That should cover your
use-case.

Hanno
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


m.van.rees at zestsoftware

Nov 16, 2009, 2:28 PM

Post #3 of 3 (622 views)
Permalink
Re: GenericSetup: comparing version numbers [In reply to]

Hanno Schlichting, on 2009-11-16:
> On Mon, Nov 16, 2009 at 6:07 PM, Maurits van Rees
><m.van.rees [at] zestsoftware> wrote:
>> In the metadata.xml in your profile the best practice is currently to
>> use plain version numbers, right?  So just 1, then 2, then 3 etc and
>> not 1.0 then 1.1 then 1.2, right?
>
> Yes.
>
>> Using plain version numbers I have just hit a problem that I find
>> strange that I have not hit before.  An upgrade step from 8 to 9 went
>> fine.  Then I did an upgrade step from 9 to 10 and suddenly
>> portal_setup listed theprevious upgrade step as available, since '10'
>> was alphabetically smaller than '9'...
>>
>> As a workaround I added one or more zeroes to the source, destination
>> and metadata.xml version numbers and then it works. I will hit the
>> next problem after the 99th upgrade step. ;-)
>>
>> Should we change this in GenericSetup itself and add some zeroes in
>> front when comparing numbers?
>
> Which version of GenericSetup was this? In the upcoming 1.5 (Plone
> 4.0) the code uses the pkg_resources API to parse version numbers
> instead of interpreting them as simple strings. That should cover your
> use-case.

Ah, right, this is GS 1.4.5. And 1.5 does it like this, which works:

>>> from pkg_resources import parse_version
>>> parse_version('9')
('00000009', '*final')
>>> parse_version('10')
('00000010', '*final')
>>> parse_version('9') < parse_version('10')
True

I haven't seen this problem before because I mostly begin counting in
metadata.xml at 100 or 1000. I guess this is a fine way to avoid this
problem.

--
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.