#80 rubygems.prov: use tilde for prerelease version
Opened 5 months ago by mtasaka. Modified 5 months ago
rpms/ mtasaka/ruby prov-use-tilde  into  rawhide

file modified
+12 -1
@@ -35,7 +35,18 @@ 

      # with RPM .spec file.

      def self.requirement_versions_to_rpm(requirement)

        self.expand_requirement(requirement.requirements).map do |op, version|

-         version == Gem::Version.new(0) ? "" : " #{op} #{version}"

+         if version == Gem::Version.new(0)

+            ""

+         else

+           # If there is some prelease version files, such as rc1 (i.e. non-numeric

+           # field), prepend this field by tilde instead of dot.

+           if version.prerelease?

+             prerelease = version.version.sub /^#{version.release}\./, ''

+             " #{op} #{version.release}~#{prerelease}"

+           else

+             " #{op} #{version}"

+           end

+         end

        end

      end

  

rubygems.req already support tilde for prerelease. Use the same mechanism
also on rubygems.prov to make requirement consistent.

rubygems.req already use tilde since https://src.fedoraproject.org/rpms/ruby/c/0c8cdc456bea3d321c73c450eadb6ca8116db281 . Let rubygems.prov also use this.

@mtasaka Thanks for the PR! I do not understand how the macros in the rubygems.attr file in the rubygems-devel RPM called well.

/usr/lib/rpm/fileattrs/rubygems.attr

$ cat rubygems.attr 
%__rubygems_requires    %{_rpmconfigdir}/rubygems.req
%__rubygems_provides    %{_rpmconfigdir}/rubygems.prov
%__rubygems_conflicts   %{_rpmconfigdir}/rubygems.con
...

I guess the macro %__rubygems_requires is used for example when the BuildRequires: rubygem(rack) is called with BuildRequires: rubygems-devel in a spec file, right? Could you tell me how the %__rubygems_requires macro is called?

Could you show us your testing log here?

Thanks!

@fbo Could you tell me why the Zuul CI is not executed on this PR? I do not see the result here. I saw that it was executed on another PR #79 on this repository.

@mtasaka could you please elaborate bit more what is your use case which this solves? I think that I had a gut feeling that there might be also some problematic scenarios, but I don't remember anymore.

1 new commit added

  • add missing space
5 months ago

@mtasaka Thanks for the PR! I do not understand how the macros in the rubygems.attr file in the rubygems-devel RPM called well.

/usr/lib/rpm/fileattrs/rubygems.attr

$ cat rubygems.attr %__rubygems_requires %{_rpmconfigdir}/rubygems.req %__rubygems_provides %{_rpmconfigdir}/rubygems.prov %__rubygems_conflicts %{_rpmconfigdir}/rubygems.con ...

I guess the macro %__rubygems_requires is used for example when the BuildRequires: rubygem(rack) is called with BuildRequires: rubygems-devel in a spec file, right? Could you tell me how the %__rubygems_requires macro is called?

Could you show us your testing log here?

Thanks!

Well, for example, when rebuilding arbitrary srpm, for example:
https://koji.fedoraproject.org/koji/buildinfo?buildID=1732124
https://kojipkgs.fedoraproject.org//packages/rubygem-mechanize/2.8.0/1.fc35/data/logs/noarch/build.log

It shows:

Requires: (rubygem(addressable) >= 2.7 with rubygem(addressable) < 3) (rubygem(domain_name) >= 0.5.20190701 with rubygem(domain_name) >= 0.5 with rubygem(domain_name) < 1) (rubygem(http-cookie) >= 1.0.3 with rubygem(http-cookie) >= 1.0 with rubygem(http-cookie) < 2) (rubygem(mime-types) >= 3.0 with rubygem(mime-types) < 4) (rubygem(net-http-digest_auth) >= 1.4.1 with rubygem(net-http-digest_auth) >= 1.4 with rubygem(net-http-digest_auth) < 2) (rubygem(net-http-persistent) >= 2.5.2 with rubygem(net-http-persistent) < 5.0.dev) (rubygem(nokogiri) >= 1.11.2 with rubygem(nokogiri) >= 1.11 with rubygem(nokogiri) < 2) (rubygem(webrick) >= 1.7 with rubygem(webrick) < 2) (rubygem(webrobots) >= 0.1.2 with rubygem(webrobots) < 0.2) ruby(rubygems)

This is generated by %{_rpmconfigdir}/rubygems.req . You can check this by

$ echo /usr/share/gems/specifications/mechanize-2.8.0.gemspec | /usr/lib/rpm/rubygems.req

Does this answer your question?

@mtasaka could you please elaborate bit more what is your use case which this solves? I think that I had a gut feeling that there might be also some problematic scenarios, but I don't remember anymore.

Actually as I've said above, recently I upgraded rubygem-mechanize to 2.8.0, then I noticed that build.log showed:
https://koji.fedoraproject.org/koji/buildinfo?buildID=1732124
https://kojipkgs.fedoraproject.org//packages/rubygem-mechanize/2.8.0/1.fc35/data/logs/noarch/build.log

with rubygem(net-http-persistent) < 5.0.dev

Note "5.0.dev". The corresponding gemspec is: https://github.com/sparklemotion/mechanize/blob/a11329be1d7bfd188e39188f9bb4a4a9c7578da7/mechanize.gemspec#L58 .
And here gem version "5.0.dev" is before 5.0, so mechanize.gemspec is intended that net-http-persistent version 5.0 should be excluded - but rpm regards that 5.0.dev is after 5.0, so with rpm dependency http-persistent version 5.0 is allowed, which is against gem versioning intention.

With using tilde, "5.0~dev" rpmversion is regarded as before 5.0, this behavior matches rubygem versioning intention.

By the way, I've noticed a mistake on my patch, so I've pushed more one commit just a while ago.

Metadata