f888830 format: XML.etree_rng_validator_proper_specs: use namever_partition

Authored and Committed by jpokorny 6 years ago
1 file changed. 3 lines added. 3 lines removed.
    format: XML.etree_rng_validator_proper_specs: use namever_partition
    
    Originally, pacemaker was treating versions of its CIB schemas
    (respectively named files) as floats, simplifying comparisons in
    a simplistic single-digit minor version realms.  As the necessity
    to roll out a new schema version catering the new needs is around
    the corner, it was decided[1] that pacemaker will not bump the
    major part abrubtly (against the rules[2]), but rather the overflow
    to a new higher digit in the minor part will occur.  That breaks
    assumption of easy comparisons in two previously common angles:
    
    - string (e.g. when looking at /cib@validate-with XPath within CIB
      or at the available, respectively named schema files);
      example: pacemaker-2.10 < pacemaker-2.2
    
    - mentioned float (when parsing the numerical part out of the string):
      example: 2.11 < 2.2
    
    Here, just the former is relevant; XML.etree_rng_validator_proper_specs
    was supposed to return ordered sequence of embedded/available schemas,
    which is used, for instance, to grab the lowest possible for the
    purpose of upgrading the schema for particular CIB document internally.
    Formerly, the sorting was based on lexicographical comparison, now,
    thanks to `namever_partition` (added with the previous commit) wired
    into the process, it performs combined lexicographical+version
    comparison so everything should keep working as expected even
    when 2.10+ versions of CIB schemas are common.
    
    Note: misc/pacemaker-borrow-schemas with it's "sort -V" should be
    covered, but the eye should be kept on that when pacemaker-2.10.rng
    actually arrives.
    
    [1] https://github.com/ClusterLabs/pacemaker/pull/1308
    [2] https://github.com/ClusterLabs/pacemaker/blob/master/xml/Readme.md
    
    Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
    
        
file modified
+3 -3