#416 Two Ruby fixes
Merged 2 years ago by ngompa. Opened 2 years ago by oturpe.
oturpe/FedoraReview ruby-fixes  into  master

file modified
+29 -15
@@ -109,20 +109,6 @@ 

          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 @@ 

          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 @@ 

          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 """

  
@@ -429,7 +443,7 @@ 

          self.type = "SHOULD"

  

      def run_on_applicable(self):

-         gem_install_re = re.compile(r"^.*gem\s+install", re.I)

+         gem_install_re = re.compile(r"^(?!#).*gem\s+install", re.I)

          self.set_passed(self.FAIL if self.spec.find_re(gem_install_re) else self.PASS)

  

  

Allow saying 'gem install' in a Ruby spec comment

Ruby check GemCheckInstallMacro was asserting the usage of %gem_install
by checking that raw command gem install was not used.
The check extended to comment rows, too.
There is no reason to complain about that in comments,
and in particular, gem2rpm automatically generates such comments.
Relaxing the check to skip comment rows.

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.

rebased onto cc276a90a6c22988c6f821f1ebb6a0ddadaf1868

2 years ago

Fix ruby check for 'ruby(release)'

Just to clarify, this applies to .spec file, but the resulting RPMs has to always contain ruby(release), the difference is that for rubygem- packages, this require is autogenerated.

I have not checked the code if this is reflected or not, so feel free to ignore the comment if the fix applies just to .spec files.

Just to clarify, this applies to .spec file, but the resulting RPMs has to always contain ruby(release), the difference is that for rubygem- packages, this require is autogenerated.

I have not checked the code if this is reflected or not, so feel free to ignore the comment if the fix applies just to .spec files.

Here fedora-review checks what Requires lines appear in the specfile. The relevant guidelines also only talk about that, so fedora-review is checking the right thing. This pull request corrects the check for gem packages.

Relevant line of code: plugins/ruby.py line 122

rebased onto b8b2b174df776ccc885bdf06b7f84e7e8ff48b03

2 years ago

Added an issue about the problem, so reproduction steps and actual and expected behavior can be discussed in a clear manner: #420

rebased onto 67b07c8

2 years ago

Pull-Request has been merged by ngompa

2 years ago
Metadata