From 67b07c87b563d0b860b331309381b37a84d1091a Mon Sep 17 00:00:00 2001 From: Otto Urpelainen Date: Jul 01 2021 10:47:43 +0000 Subject: Fix ruby check for 'ruby(release)' The Ruby packaging guidelines say that Requires: ruby(release) MUST be included for non-gem packages, but SHOULD NOT be included for gem packages. Fedora-review was unconditionally checking for inclusion. Fixed by splitting the check into two complementary cases. --- diff --git a/plugins/ruby.py b/plugins/ruby.py index afabdd8..8733fd0 100644 --- a/plugins/ruby.py +++ b/plugins/ruby.py @@ -109,20 +109,6 @@ class RubyCheckNotRequiresRubyAbi(RubyCheckBase): self.set_passed("ruby(abi)" not in br) -class RubyCheckRequiresRubyRelease(RubyCheckBase): - """ Check if package requires ruby(release) """ - - def __init__(self, base): - RubyCheckBase.__init__(self, base) - self.url = _gl_fmt_uri({"section": "Ruby_Compatibility"}) - self.text = "Package contains Requires: ruby(release)." - self.automatic = True - - def run_on_applicable(self): - br = self.spec.get_requires() - self.set_passed("ruby(release)" in br) - - class RubyCheckBuildArchitecture(RubyCheckBase): """ Check if package is noarch """ @@ -210,6 +196,20 @@ class RubyCheckTestsNotRunByRake(RubyCheckBase): self.set_passed(rc) +class RubyCheckRequiresRubyRelease(NonGemCheckBase): + """ Check if non-gem package requires ruby(release) """ + + def __init__(self, base): + NonGemCheckBase.__init__(self, base) + self.url = _gl_fmt_uri({"section": "Ruby_Compatibility"}) + self.text = "Non-gem package contains Requires: ruby(release)." + self.automatic = True + + def run_on_applicable(self): + br = self.spec.get_requires() + self.set_passed("ruby(release)" in br) + + class NonGemCheckUsesMacros(NonGemCheckBase): """ Check if spec files uses proper macros instead of hardcoding """ @@ -247,6 +247,20 @@ class NonGemCheckFilePlacement(NonGemCheckBase): self.automatic = False +class RubyCheckNotRequiresRubyRelease(GemCheckBase): + """ Check if gem package does not require ruby(release) """ + + def __init__(self, base): + GemCheckBase.__init__(self, base) + self.url = _gl_fmt_uri({"section": "Ruby_Compatibility"}) + self.text = "Gem package does not contain Requires: ruby(release)." + self.automatic = True + + def run_on_applicable(self): + br = self.spec.get_requires() + self.set_passed("ruby(release)" not in br) + + class GemCheckFilePlacement(GemCheckBase): """ Check if gem files are placed in correct directories """