Building rubygem-asciidoctor-pdf

I am trying to build my newly created project in OBS.
https://build.opensuse.org/package/show/home:DJViking/rubygem-asciidoctor-pdf

Inspiration taken from https://build.opensuse.org/package/show/home:pevik/rubygem-asciidoctor-pdf

I am planning on building it on Leap 15.2, and SLES 15 SP2, since the orignal project does not.
Also because I want that package in the SLES 15 SP2 PackageHub.

The rubygems I could find in the OBS used an gem2rpm.yml to generate the RPM spec file

This file was generated with a gem2rpm.yml and not just plain gem2rpm.

All sections marked as MANUAL, license headers, summaries and descriptions

can be maintained in that file. Please consult this file before editing any

of those fields

However I could not find any information how they did that.

I tried to generate a simple RPM spec using gem2rpm. However it required some manual editing on the end result.
> gem2rpm --template default asciidoctor-pdf-1.5.3.gem
I had to edit the RPM spec

Change the Source spec

Source1: rubygem-%{rbname}.spec.in

to

Source1: rubygem-%{rbname}.spec

Change

ruby-gems

to

rubygem

Change

Requires: ruby ""]

to

Requires: ruby >= 2.5

Change the

%{_bindir}/asciidoctor-pdf

to

%{_bindir}/asciidoctor-pdf.ruby2.5

Remove 98 of the 99 duplicated lines under %files

%{gemdir}/gems/asciidoctor-pdf-1.5.3/

Remove the doc under %files that did not exist

%doc %{gemdir}/doc/asciidoctor-pdf-1.5.3

What I then got, which builds fine


# Generated from asciidoctor-pdf-1.5.3.gem by gem2rpm -*- rpm-spec -*-
%define rbname asciidoctor-pdf
%define version 1.5.3
%define release 1


Summary: Converts AsciiDoc documents to PDF using Asciidoctor and Prawn
Name: rubygem-%{rbname}


Version: %{version}
Release: %{release}
Group: Development/Ruby
License: Distributable
URL: https://asciidoctor.org/docs/asciidoctor-pdf
Source0: %{rbname}-%{version}.gem
# Make sure the spec template is included in the SRPM
Source1: rubygem-%{rbname}.spec
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: ruby >= 2.5
Requires: rubygem >= 2.7.6.2
Requires: rubygem-asciidoctor >= 1.5.3
Requires: rubygem-asciidoctor < 3.0.0
Requires: rubygem-prawn => 2.2.0
Requires: rubygem-prawn < 2.3
Requires: rubygem-ttfunk => 1.5.0
Requires: rubygem-ttfunk < 1.6
Requires: rubygem-ttfunk >= 1.5.1
Requires: rubygem-prawn-table => 0.2.0
Requires: rubygem-prawn-table < 0.3
Requires: rubygem-prawn-templates => 0.1.0
Requires: rubygem-prawn-templates < 0.2
Requires: rubygem-prawn-svg => 0.30.0
Requires: rubygem-prawn-svg < 0.31
Requires: rubygem-prawn-icon => 2.5.0
Requires: rubygem-prawn-icon < 2.6
Requires: rubygem-safe_yaml => 1.0.0
Requires: rubygem-safe_yaml < 1.1
Requires: rubygem-thread_safe => 0.3.0
Requires: rubygem-thread_safe < 0.4
Requires: rubygem-concurrent-ruby => 1.1.0
Requires: rubygem-concurrent-ruby < 1.2
Requires: rubygem-treetop => 1.6.0
Requires: rubygem-treetop < 1.7
Requires: rubygem-rake => 13.0.0
Requires: rubygem-rake < 13.1
Requires: rubygem-rspec => 3.9.0
Requires: rubygem-rspec < 3.10
Requires: rubygem-pdf-inspector => 1.3.0
Requires: rubygem-pdf-inspector < 1.4
Requires: rubygem-rouge => 3.0
Requires: rubygem-rouge < 4
Requires: rubygem-coderay => 1.1.0
Requires: rubygem-coderay < 1.2
Requires: rubygem-chunky_png => 1.3.0
Requires: rubygem-chunky_png < 1.4
BuildRequires: ruby >= 2.5
BuildRequires: rubygem >= 2.7.6.2
BuildArch: noarch
Provides: ruby(Asciidoctor-pdf) = %{version}


%define gemdir /usr/lib64/ruby/gems/2.5.0
%define gembuilddir %{buildroot}%{gemdir}


%description
An extension for Asciidoctor that converts AsciiDoc documents to PDF using the
Prawn PDF library.




%prep
%setup -T -c


%build


%install
%{__rm} -rf %{buildroot}
mkdir -p %{gembuilddir}
gem install --local --install-dir %{gembuilddir} --force %{SOURCE0}
mkdir -p %{buildroot}/%{_bindir}
mv %{gembuilddir}/bin/* %{buildroot}/%{_bindir}
rmdir %{gembuilddir}/bin


%clean
%{__rm} -rf %{buildroot}


%files
%defattr(-, root, root)
%{_bindir}/asciidoctor-pdf
%{_bindir}/asciidoctor-pdf-optimize
%{gemdir}/gems/asciidoctor-pdf-1.5.3/
%{gemdir}/cache/asciidoctor-pdf-1.5.3.gem
%{gemdir}/specifications/asciidoctor-pdf-1.5.3.gemspec


%changelog

How do I create the RPM spec with the gem2rpm.yml?
I want the build process to be a similar as the other rubygems that builds on OBS.

I tried to build the existing project, but it fails to build on Leap 15.2
https://build.opensuse.org/package/show/home:pevik/rubygem-asciidoctor-pdf
I can create the source RPM, but building it complains about many missing files
Installed (but unpackaged) file(s) found:

Not sure what I am doing wrong locally.

My own created spec file I can build locally on Leap 15.2
Trying to build it on openSUSE:Factory, fails.

If I commit the spec file from home pevik instead, then it builds on OBS, but it will not build locally.
https://build.opensuse.org/package/view_file/home:pevik/rubygem-asciidoctor-pdf/rubygem-asciidoctor-pdf.spec?expand=1

According to the OBS recommondation, the repository should be a closed transitive.
Meaning it should contain all the necessary RPMs needed?

The rubygem asciidoctor-pdf have the following Runtime and Development requirements.
Does it mean that I have to build each and every one of these myself in my OBS namespace?

Runtime:
asciidoctor 2.0.11 >= 1.5.3, < 3.0.0
concurrent-ruby 1.1.7 ~> 1.1.0
prawn 2.2.2 ~> 2.2.0
prawn-icon 2.5.0 ~> 2.5.0
prawn-svg 0.30.0 ~> 0.30.0
prawn-table 0.2.2 ~> 0.2.0
prawn-templates 0.1.2 ~> 0.1.0
safe_yaml 1.0.5 ~> 1.0.0
thread_safe 0.3.6 ~> 0.3.0
treetop 1.6.11 ~> 1.6.0
ttfunk 1.5.1 ~> 1.5.0, >= 1.5.1
Development:
chunky_png 1.3.14 ~> 1.3.0
coderay 1.1.3 ~> 1.1.0
pdf-inspector 1.3.0 ~> 1.3.0
rake 13.0.1 ~> 13.0.0
rouge 3.24.0 ~> 3.0
rspec 3.9.0 ~> 3.9.0

Some of these packages are not available through the OpenSUSE OSS.
Some of these packages are available through OpenSUSE OSS, but with an older incompatible version
Some of these packages are available through the Ruby Extensions repository.

Available from OpenSUSE:
ruby2.5-rubygem-asciidoctor | 2.0.10-lp152.1.1
ruby2.5-rubygem-concurrent-ruby | 1.0.5-lp152.3.3
ruby2.5-rubygem-safe_yaml | 1.0.4-lp152.2.3
ruby2.5-rubygem-thread_safe | 0.3.6-lp152.3.3
ruby2.5-rubygem-coderay | 1.1.2-lp152.3.3

Availble from Ruby Extensions:
ruby2.5-rubygem-prawn-icon | 2.5.0-lp152.3.2
ruby2.5-rubygem-prawn-svg | 0.30.0-lp152.3.2
ruby2.5-rubygem-prawn-table | 0.2.2-lp152.4.2
ruby2.5-rubygem-treetop | 1.6.11-lp152.46.2 (OpenSUSE OSS has an older version 1.4.15-lp152.3.3)
ruby2.5-rubygem-chunky_png | 1.3.12-lp152.1.2
ruby2.5-rubygem-rake | 13.0.1-lp152.1.5 (OpenSUSE OSS has an older version 12)
ruby2.5-rubygem-rouge | 3.23.0-lp152.29.2 (OpenSUSE OSS has an older version 1.11.1-lp152.1.1)
ruby2.5-rubygem-rspec | 3.9.0-lp152.25.5 (OpenSUSE OSS has an older version 3.7.0-lp152.3.5)

Not Available in any official repositories:
rubygem-prawn 2.2.2
rubygem-prawn-templates 0.1.2
rubygem-ttfunk 1.5.1
rubygem-pdf-inspector 1.3.0

I was able to build/package the rubygem-asciidoctor-pdf in RPM on OpenSUSE Leap 15.2, and SLES 15 SP2, without many of these Requirements.
https://build.opensuse.org/package/show/home:DJViking/rubygem-asciidoctor-pdf