Hi all,

I am working on rubygem-asciidoctor-mallard review [1] and since there
was not released stable version yet, the pre-release version (actually
git snapshot) needs to be packaged. And now I realized it is more PITA
then it should be.

The main issue is with the way, how pre-release packages are versioned.
E.g. in rubygem-asciidoctor-mallard case, the upstream version is
"0.1.0.dev" which transforms in Fedora into "0.1.0-0.1.dev" and
subsequently, no standard macro works.

But the remedy could be quite simple. With this change:

```

$ git diff
diff --git a/macros.rubygems b/macros.rubygems
index 45c59c4..0652ec6 100644
--- a/macros.rubygems
+++ b/macros.rubygems
@@ -3,12 +3,12 @@
 %gem_archdir %{_libdir}/gems
 
 # Common gem locations and files.
-%gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}
-%gem_extdir_mri %{gem_archdir}/%{name}/%{gem_name}-%{version}
+%gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}%{?prerelease}
+%gem_extdir_mri %{gem_archdir}/%{name}/%{gem_name}-%{version}%{?prerelease}
 %gem_libdir %{gem_instdir}/lib
-%gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem
-%gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec
-%gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}
+%gem_cache %{gem_dir}/cache/%{gem_name}-%{version}%{?prerelease}.gem
+%gem_spec
%{gem_dir}/specifications/%{gem_name}-%{version}%{?prerelease}.gemspec
+%gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}%{?prerelease}
 
 
 # %gem_install - Install gem into appropriate directory.
@@ -28,7 +28,7 @@ gem install \\\
         --build-root %{-d*}%{!?-d:.} \\\
         --force \\\
         --document=ri,rdoc \\\
-        %{-n*}%{!?-n:%{gem_name}-%{version}.gem} \
+        %{-n*}%{!?-n:%{gem_name}-%{version}%{?prerelease}.gem} \
 %{nil}
 
 

```

It would be enough to specify:


```

%global    prerelease        .dev

```


in your .spec file and half of the lines I needed to add into the
pre-release package could be removed.

Please note that this is inspired by macros Mamoru is using for ages in
some of his packages (Nokogiri for example [2]).

(Actually, now I realized that the proposal in the review is more
complex then it should be, but that is a different story ...)

Any thoughts?


Vít


[1] https://bugzilla.redhat.com/show_bug.cgi?id=1343977#add_comment

[2]
http://pkgs.fedoraproject.org/cgit/rpms/rubygem-nokogiri.git/tree/rubygem-nokogiri.spec?id=7f3b8d1685a6069868a83bbc412b176d43c70fb5

_______________________________________________
ruby-sig mailing list -- ruby-sig@lists.fedoraproject.org
To unsubscribe send an email to ruby-sig-le...@lists.fedoraproject.org

Reply via email to