@@ -484,6 +484,34 @@ local function get_version_suffix(suffix_candidate)
484
484
return nil
485
485
end
486
486
487
+ local function get_commits_since_from_version_part (commits_since_candidate )
488
+ if commits_since_candidate == nil then
489
+ return 0
490
+ end
491
+
492
+ local ok , val = pcall (tonumber , commits_since_candidate )
493
+ if ok then
494
+ return val
495
+ else
496
+ -- It may be unknown suffix instead.
497
+ -- Since suffix already unknown, there is no way to properly compare versions.
498
+ return 0
499
+ end
500
+ end
501
+
502
+ local function get_commits_since (suffix , commits_since_candidate_1 , commits_since_candidate_2 )
503
+ -- x.x.x.-candidate_1-candidate_2
504
+
505
+ if suffix ~= nil then
506
+ -- X.Y.Z-suffix-N
507
+ return get_commits_since_from_version_part (commits_since_candidate_2 )
508
+ else
509
+ -- X.Y.Z-N
510
+ -- Possibly X.Y.Z-suffix-N with unknown suffix
511
+ return get_commits_since_from_version_part (commits_since_candidate_1 )
512
+ end
513
+ end
514
+
487
515
utils .get_version_suffix = get_version_suffix
488
516
489
517
@@ -517,18 +545,20 @@ utils.get_version_suffix_weight = get_version_suffix_weight
517
545
518
546
519
547
local function is_version_ge (major , minor ,
520
- patch , suffix ,
548
+ patch , suffix , commits_since ,
521
549
major_to_compare , minor_to_compare ,
522
- patch_to_compare , suffix_to_compare )
550
+ patch_to_compare , suffix_to_compare , commits_since_to_compare )
523
551
major = major or 0
524
552
minor = minor or 0
525
553
patch = patch or 0
526
554
local suffix_weight = get_version_suffix_weight (suffix )
555
+ commits_since = commits_since or 0
527
556
528
557
major_to_compare = major_to_compare or 0
529
558
minor_to_compare = minor_to_compare or 0
530
559
patch_to_compare = patch_to_compare or 0
531
560
local suffix_weight_to_compare = get_version_suffix_weight (suffix_to_compare )
561
+ commits_since_to_compare = commits_since_to_compare or 0
532
562
533
563
if major > major_to_compare then return true end
534
564
if major < major_to_compare then return false end
@@ -542,33 +572,36 @@ local function is_version_ge(major, minor,
542
572
if suffix_weight > suffix_weight_to_compare then return true end
543
573
if suffix_weight < suffix_weight_to_compare then return false end
544
574
575
+ if commits_since > commits_since_to_compare then return true end
576
+ if commits_since < commits_since_to_compare then return false end
577
+
545
578
return true
546
579
end
547
580
548
581
utils .is_version_ge = is_version_ge
549
582
550
583
551
584
local function is_version_in_range (major , minor ,
552
- patch , suffix ,
585
+ patch , suffix , commits_since ,
553
586
major_left_side , minor_left_side ,
554
- patch_left_side , suffix_left_side ,
587
+ patch_left_side , suffix_left_side , commits_since_left_side ,
555
588
major_right_side , minor_right_side ,
556
- patch_right_side , suffix_right_side )
589
+ patch_right_side , suffix_right_side , commits_since_right_side )
557
590
return is_version_ge (major , minor ,
558
- patch , suffix ,
591
+ patch , suffix , commits_since ,
559
592
major_left_side , minor_left_side ,
560
- patch_left_side , suffix_left_side )
593
+ patch_left_side , suffix_left_side , commits_since_left_side )
561
594
and is_version_ge (major_right_side , minor_right_side ,
562
- patch_right_side , suffix_right_side ,
595
+ patch_right_side , suffix_right_side , commits_since_right_side ,
563
596
major , minor ,
564
- patch , suffix )
597
+ patch , suffix , commits_since )
565
598
end
566
599
567
600
utils .is_version_in_range = is_version_in_range
568
601
569
602
570
603
local function get_tarantool_version ()
571
- local version_parts = rawget (_G , ' _TARANTOOL' ):split (' -' , 1 )
604
+ local version_parts = rawget (_G , ' _TARANTOOL' ):split (' -' , 3 )
572
605
573
606
local major_minor_patch_parts = version_parts [1 ]:split (' .' , 2 )
574
607
local major = tonumber (major_minor_patch_parts [1 ])
@@ -577,17 +610,20 @@ local function get_tarantool_version()
577
610
578
611
local suffix = get_version_suffix (version_parts [2 ])
579
612
580
- return major , minor , patch , suffix
613
+ local commits_since = get_commits_since (suffix , version_parts [2 ], version_parts [3 ])
614
+
615
+ return major , minor , patch , suffix , commits_since
581
616
end
582
617
583
618
utils .get_tarantool_version = get_tarantool_version
584
619
585
620
586
- local function tarantool_version_at_least (wanted_major , wanted_minor , wanted_patch )
587
- local major , minor , patch , suffix = get_tarantool_version ()
621
+ local function tarantool_version_at_least (wanted_major , wanted_minor ,
622
+ wanted_patch , wanted_suffix , wanted_commits_since )
623
+ local major , minor , patch , suffix , commits_since = get_tarantool_version ()
588
624
589
- return is_version_ge (major , minor , patch , suffix ,
590
- wanted_major , wanted_minor , wanted_patch , nil )
625
+ return is_version_ge (major , minor , patch , suffix , commits_since ,
626
+ wanted_major , wanted_minor , wanted_patch , wanted_suffix , wanted_commits_since )
591
627
end
592
628
593
629
utils .tarantool_version_at_least = tarantool_version_at_least
@@ -596,49 +632,49 @@ utils.tarantool_version_at_least = tarantool_version_at_least
596
632
local enabled_tarantool_features = {}
597
633
598
634
local function determine_enabled_features ()
599
- local major , minor , patch , suffix = get_tarantool_version ()
635
+ local major , minor , patch , suffix , commits_since = get_tarantool_version ()
600
636
601
637
-- since Tarantool 2.3.1
602
- enabled_tarantool_features .fieldpaths = is_version_ge (major , minor , patch , suffix ,
603
- 2 , 3 , 1 , nil )
638
+ enabled_tarantool_features .fieldpaths = is_version_ge (major , minor , patch , suffix , commits_since ,
639
+ 2 , 3 , 1 , nil , nil )
604
640
605
641
-- Full support (Lua type, space format type and indexes) for decimal type
606
642
-- is since Tarantool 2.3.1 [1]
607
643
--
608
644
-- [1] https://github.com/tarantool/tarantool/commit/485439e33196e26d120e622175f88b4edc7a5aa1
609
- enabled_tarantool_features .decimals = is_version_ge (major , minor , patch , suffix ,
610
- 2 , 3 , 1 , nil )
645
+ enabled_tarantool_features .decimals = is_version_ge (major , minor , patch , suffix , commits_since ,
646
+ 2 , 3 , 1 , nil , nil )
611
647
612
648
-- Full support (Lua type, space format type and indexes) for uuid type
613
649
-- is since Tarantool 2.4.1 [1]
614
650
--
615
651
-- [1] https://github.com/tarantool/tarantool/commit/b238def8065d20070dcdc50b54c2536f1de4c7c7
616
- enabled_tarantool_features .uuids = is_version_ge (major , minor , patch , suffix ,
617
- 2 , 4 , 1 , nil )
652
+ enabled_tarantool_features .uuids = is_version_ge (major , minor , patch , suffix , commits_since ,
653
+ 2 , 4 , 1 , nil , nil )
618
654
619
655
-- Full support (Lua type, space format type and indexes) for datetime type
620
656
-- is since Tarantool 2.10.0-beta2 [1]
621
657
--
622
658
-- [1] https://github.com/tarantool/tarantool/commit/3bd870261c462416c29226414fe0a2d79aba0c74
623
- enabled_tarantool_features .datetimes = is_version_ge (major , minor , patch , suffix ,
624
- 2 , 10 , 0 , ' beta2' )
659
+ enabled_tarantool_features .datetimes = is_version_ge (major , minor , patch , suffix , commits_since ,
660
+ 2 , 10 , 0 , ' beta2' , nil )
625
661
626
662
-- Full support (Lua type, space format type and indexes) for datetime type
627
663
-- is since Tarantool 2.10.0-rc1 [1]
628
664
--
629
665
-- [1] https://github.com/tarantool/tarantool/commit/38f0c904af4882756c6dc802f1895117d3deae6a
630
- enabled_tarantool_features .intervals = is_version_ge (major , minor , patch , suffix ,
631
- 2 , 10 , 0 , ' rc1' )
666
+ enabled_tarantool_features .intervals = is_version_ge (major , minor , patch , suffix , commits_since ,
667
+ 2 , 10 , 0 , ' rc1' , nil )
632
668
633
669
-- since Tarantool 2.6.3 / 2.7.2 / 2.8.1
634
- enabled_tarantool_features .jsonpath_indexes = is_version_ge (major , minor , patch , suffix ,
635
- 2 , 8 , 1 , nil )
636
- or is_version_in_range (major , minor , patch , suffix ,
637
- 2 , 7 , 2 , nil ,
638
- 2 , 7 , math.huge , nil )
639
- or is_version_in_range (major , minor , patch , suffix ,
640
- 2 , 6 , 3 , nil ,
641
- 2 , 6 , math.huge , nil )
670
+ enabled_tarantool_features .jsonpath_indexes = is_version_ge (major , minor , patch , suffix , commits_since ,
671
+ 2 , 8 , 1 , nil , nil )
672
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
673
+ 2 , 7 , 2 , nil , nil ,
674
+ 2 , 7 , math.huge , nil , nil )
675
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
676
+ 2 , 6 , 3 , nil , nil ,
677
+ 2 , 6 , math.huge , nil , nil )
642
678
643
679
-- The merger module was implemented in 2.2.1, see [1].
644
680
-- However it had the critical problem [2], which leads to
@@ -648,52 +684,56 @@ local function determine_enabled_features()
648
684
--
649
685
-- [1]: https://github.com/tarantool/tarantool/issues/3276
650
686
-- [2]: https://github.com/tarantool/tarantool/issues/4954
651
- enabled_tarantool_features .builtin_merger = is_version_ge (major , minor , patch , suffix ,
652
- 2 , 6 , 0 , nil )
653
- or is_version_in_range (major , minor , patch , suffix ,
654
- 2 , 5 , 1 , nil ,
655
- 2 , 5 , math.huge , nil )
656
- or is_version_in_range (major , minor , patch , suffix ,
657
- 2 , 4 , 2 , nil ,
658
- 2 , 4 , math.huge , nil )
659
- or is_version_in_range (major , minor , patch , suffix ,
660
- 2 , 3 , 3 , nil ,
661
- 2 , 3 , math.huge , nil )
687
+ enabled_tarantool_features .builtin_merger = is_version_ge (major , minor , patch , suffix , commits_since ,
688
+ 2 , 6 , 0 , nil , nil )
689
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
690
+ 2 , 5 , 1 , nil , nil ,
691
+ 2 , 5 , math.huge , nil , nil )
692
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
693
+ 2 , 4 , 2 , nil , nil ,
694
+ 2 , 4 , math.huge , nil , nil )
695
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
696
+ 2 , 3 , 3 , nil , nil ,
697
+ 2 , 3 , math.huge , nil , nil )
662
698
663
699
-- The external merger module leans on a set of relatively
664
700
-- new APIs in tarantool. So it works only on tarantool
665
701
-- versions, which offer those APIs.
666
702
--
667
703
-- See README of the module:
668
704
-- https://github.com/tarantool/tuple-merger
669
- enabled_tarantool_features .external_merger = is_version_ge (major , minor , patch , suffix ,
670
- 2 , 7 , 0 , nil )
671
- or is_version_in_range (major , minor , patch , suffix ,
672
- 2 , 6 , 1 , nil ,
673
- 2 , 6 , math.huge , nil )
674
- or is_version_in_range (major , minor , patch , suffix ,
675
- 2 , 5 , 2 , nil ,
676
- 2 , 5 , math.huge , nil )
677
- or is_version_in_range (major , minor , patch , suffix ,
678
- 2 , 4 , 3 , nil ,
679
- 2 , 4 , math.huge , nil )
680
- or is_version_in_range (major , minor , patch , suffix ,
681
- 1 , 10 , 8 , nil ,
682
- 1 , 10 , math.huge , nil )
683
-
684
- enabled_tarantool_features .netbox_skip_header_option = is_version_ge (major , minor , patch , suffix ,
685
- 2 , 2 , 0 , nil )
705
+ enabled_tarantool_features .external_merger = is_version_ge (major , minor , patch , suffix , commits_since ,
706
+ 2 , 7 , 0 , nil , nil )
707
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
708
+ 2 , 6 , 1 , nil , nil ,
709
+ 2 , 6 , math.huge , nil , nil )
710
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
711
+ 2 , 5 , 2 , nil , nil ,
712
+ 2 , 5 , math.huge , nil , nil )
713
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
714
+ 2 , 4 , 3 , nil , nil ,
715
+ 2 , 4 , math.huge , nil , nil )
716
+ or is_version_in_range (major , minor , patch , suffix , commits_since ,
717
+ 1 , 10 , 8 , nil , nil ,
718
+ 1 , 10 , math.huge , nil , nil )
719
+
720
+ enabled_tarantool_features .netbox_skip_header_option = is_version_ge (major , minor , patch , suffix , commits_since ,
721
+ 2 , 2 , 0 , nil , nil )
686
722
687
723
-- https://github.com/tarantool/tarantool/commit/11f2d999a92e45ee41b8c8d0014d8a09290fef7b
688
- enabled_tarantool_features .box_watch = is_version_ge (major , minor , patch , suffix ,
689
- 2 , 10 , 0 , ' beta2' )
724
+ enabled_tarantool_features .box_watch = is_version_ge (major , minor , patch , suffix , commits_since ,
725
+ 2 , 10 , 0 , ' beta2' , nil )
690
726
691
- enabled_tarantool_features .tarantool_3 = is_version_ge (major , minor , patch , suffix ,
692
- 3 , 0 , 0 , nil )
727
+ enabled_tarantool_features .tarantool_3 = is_version_ge (major , minor , patch , suffix , commits_since ,
728
+ 3 , 0 , 0 , nil , nil )
693
729
end
694
730
695
731
determine_enabled_features ()
696
732
733
+ local function feature_in_list (feature_to_check , list_of_features )
734
+
735
+ end
736
+
697
737
for feature_name , feature_enabled in pairs (enabled_tarantool_features ) do
698
738
local util_name
699
739
if feature_name == ' tarantool_3' then
0 commit comments