openSUSE / gem2rpm

Generate an rpm from a rubygem (git mirror of svn://rubyforge.org/var/svn/gem2rpm)
http://rubyforge.org/projects/gem2rpm/
Other
3 stars 7 forks source link

How to specify %post or %postun calls for the subpackages? #18

Open johanneskastl opened 9 months ago

johanneskastl commented 9 months ago

How does one set %post or %postun settings for the per-ruby-version subpackages?

I tried this in gem2rpm.yml:

:scripts:
  :post: |-
    update-alternatives --install krane %{_bindir}/krane
  :postun: |-
    update-alternatives --remove krane %{_bindir}/krane

https://build.opensuse.org/package/show/home:ojkastl_buildservice:Branch_devel_kubic/rubygem-krane

But OBS aka rpmlint still complains about missing update-alternatives calls

Question

Is this a false positive in OBS or is this not the right way to do that? What would be the right way?

Thanks in advance Johannes

darix commented 9 months ago
rpm -q --scripts ruby3.2-rubygem-pry-0.14.2-66.3.x86_64
postinstall scriptlet (using /bin/sh):
/usr/sbin/update-alternatives --install \
    /usr/bin/pry pry /usr/bin/pry.ruby3.2-0.14.2 1402
/usr/sbin/update-alternatives --install \
    /usr/bin/pry-0.14.2    pry-0.14.2 /usr/bin/pry.ruby3.2-0.14.2 1402
/usr/sbin/update-alternatives --install \
    /usr/bin/pry.ruby3.2        pry.ruby3.2 /usr/bin/pry.ruby3.2-0.14.2 1402
preuninstall scriptlet (using /bin/sh):
if [ "$1" = 0 ] ; then
    /usr/sbin/update-alternatives --remove pry /usr/bin/pry.ruby3.2-0.14.2
    /usr/sbin/update-alternatives --remove pry-0.14.2 /usr/bin/pry.ruby3.2-0.14.2
    /usr/sbin/update-alternatives --remove pry.ruby3.2 /usr/bin/pry.ruby3.2-0.14.2
fi

you shouldnt have to care about this. it is done automatically by https://github.com/openSUSE/gem2rpm/blob/master/templates/gem_packages.spec.erb#L167

johanneskastl commented 9 months ago

Hi Darix, thanks for the quick reply.

Hmm, I'm confused. Are you saying that I do not have to add that scripts: stanza to gem2rpm.yml?

And this would imply that the OBS "warning" is a false warning, i.e. the check does not properly detect the calls being present?

darix commented 9 months ago

it could be false yes. maybe the multiline stuff confuses it.