diff --git a/filters/need_kconfig.rb b/filters/need_kconfig.rb index 1b24b0c59..5611ac2bf 100755 --- a/filters/need_kconfig.rb +++ b/filters/need_kconfig.rb @@ -50,27 +50,25 @@ def kernel_match_version?(kernel_version, expected_kernel_versions) expected_kernel_versions.all? do |expected_kernel_version| match = expected_kernel_version.match(/(?==|!=|<=|>|>=)?\s*(?v[0-9]\.\d+(-rc\d+)*)/) - if match.nil? || match[:kernel_tag].nil? - raise Job::SyntaxError, "Wrong syntax of kconfig setting: #{expected_kernel_versions}" - else - operator = match[:operator] || '>=' - - # rli9 FIXME: hack code to handle <= - # Take below example, MEMORY_HOTPLUG_SPARSE is moved in 5.16-rc1, thus we configure - # as <= 5.15. But we use rc_tag to decide the kernel of commit, 50f9481ed9fb or other - # commit now use kernel v5.15 to compare. This matches the <= and expects MEMORY_HOTPLUG_SPARSE - # is y, which leads to job filtered wrongly on these commits. - # - # fa55b7dcdc43 ("Linux 5.16-rc1") - # c55a04176cba ("Merge tag 'char-misc-5.16-rc1' ...") - # 50f9481ed9fb ("mm/memory_hotplug: remove CONFIG_MEMORY_HOTPLUG_SPARSE") - # 8bb7eca972ad ("Linux 5.15") - # - # To workaround this, change operator to < to mismatch the kernel - operator = '<' if operator == '<=' - - kernel_version.method(operator).call(KernelTag.new(match[:kernel_tag])) - end + raise Job::SyntaxError, "Wrong syntax of kconfig setting: #{expected_kernel_versions}" if match.nil? || match[:kernel_tag].nil? + + operator = match[:operator] || '>=' + + # rli9 FIXME: hack code to handle <= + # Take below example, MEMORY_HOTPLUG_SPARSE is moved in 5.16-rc1, thus we configure + # as <= 5.15. But we use rc_tag to decide the kernel of commit, 50f9481ed9fb or other + # commit now use kernel v5.15 to compare. This matches the <= and expects MEMORY_HOTPLUG_SPARSE + # is y, which leads to job filtered wrongly on these commits. + # + # fa55b7dcdc43 ("Linux 5.16-rc1") + # c55a04176cba ("Merge tag 'char-misc-5.16-rc1' ...") + # 50f9481ed9fb ("mm/memory_hotplug: remove CONFIG_MEMORY_HOTPLUG_SPARSE") + # 8bb7eca972ad ("Linux 5.15") + # + # To workaround this, change operator to < to mismatch the kernel + operator = '<' if operator == '<=' + + kernel_version.method(operator).call(KernelTag.new(match[:kernel_tag])) end end