[Zope-CMF] Best use of source numbers in GS upgrade steps?

Maurits van Rees m.van.rees at zestsoftware.nl
Thu Apr 16 08:09:01 EDT 2009


Hi,

I wonder what the best way is of specifying the source number of a
GenericSetup upgrade step.

Use case
--------

Case in point: Products.Poi, an issue tracker for CMFPlone.  Between
version 1.1 and 1.2 there were changes that needed an upgrade step,
which I registered like this:

  <gs:upgradeStep
      title="Issue descriptions"
      description="Fix description of issues."
      source="1.1"
      destination="1.2"
      handler="Products.Poi.migration.fix_descriptions"
      sortkey="1"
      profile="Products.Poi:default" />

Works fine: the upgrade step is shown in the Upgrades tab of
portal_setup when migrating from Poi 1.1 to 1.2.


Problem
-------

Problem is, the 1.1 version of Poi got a few minor releases.  So
someone could be upgrading from Poi 1.1.2 to 1.2.  And then the
upgrade steps do *not* get shown.  Reason: 1.1.2 is larger than 1.1 so
portal_setup assumes the upgrade step has been run already.  Asking
portal_setup to show old upgrades does still work as expected of
course.

I solved this by changing the registration of the upgrade step: it is
now defined as being an upgrade from source="1.1.9".  That version
does not (yet) exist.  The assumption is that this source will always
be higher than any possible future release from the 1.1 branch.

Even when restricting yourself to simple increasing integers in a
metadata.xml instead of a dotted number, the problem is the same.  Say
the 1.1 branch is at profile revision 1100 now.  If I then set the
profile revision of trunk to 1101 I deny the 1.1 branch any future
profile revision changes.  So I would give trunk profile revision
1200, allowing the 1.1 branch room for 99 profile revision updates.

Probably not relevant here, but for completeness sake:

- Poi branch 1.1 has 1.1.x in its version.txt and does not have a
  metadata.xml.

- Poi trunk has 1.2.x in both its version.txt and metadata.xml.

I know that it is best to use both files (or a version in setup.py
instead of version.txt) and that both versions need not be the same at
all.  But this is the current situation.


Question
--------

So my question is: is this a sane way of doing this?  Is it alright to
specify a version (or really a profile revision) as source when that
version does not yet exist?  It works fine as far as I can tell.


Thanks for any further insight,

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



More information about the Zope-CMF mailing list