Accepting request 982449 from home:darix:apps

- make %gem_unpack and %gem_build work when the default system ruby
  is not installed:
  both macros now use the %{gem_binary} define and we have a common
  macro %{set_gem_binary} to set this variable. the set macro will
  use the ruby-find-versioned to find a versioned version of gem.

OBS-URL: https://build.opensuse.org/request/show/982449
OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby-common?expand=0&rev=115
This commit is contained in:
Marcus Rückert 2022-06-13 12:53:59 +00:00 committed by Git OBS Bridge
parent 4337af7220
commit ca23638520
2 changed files with 26 additions and 3 deletions

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Jun 13 11:43:30 UTC 2022 - Marcus Rueckert <mrueckert@suse.de>
- make %gem_unpack and %gem_build work when the default system ruby
is not installed:
both macros now use the %{gem_binary} define and we have a common
macro %{set_gem_binary} to set this variable. the set macro will
use the ruby-find-versioned to find a versioned version of gem.
-------------------------------------------------------------------
Wed Feb 23 22:30:46 UTC 2022 - Dirk Müller <dmueller@suse.com>

View File

@ -33,6 +33,17 @@
%rb_vendorlib %{rb_vendorlibdir}
%rb_vendorarch %{rb_vendorarchdir}
%set_gem_binary() \
%if "%{?gem_binary}" == "" \
%global gem_binary %(/usr/bin/ruby-find-versioned gem|head -n1) \
%endif \
%if "%{?gem_binary}" == "" \
echo "no gem binary found. Exiting." \
exit 1 \
%endif \
%{nil}
# %%gem_unpack macro unpacks a gem file into %%{_builddir}
#
# example:
@ -42,17 +53,19 @@
#
%gem_unpack(s:) \
source=%{-s:%{-s*}}%{!-s:%{SOURCE0}} \
%{?gem_binary}%{!?gem_binary:/usr/bin/gem} unpack --verbose $source \
%{set_gem_binary} \
%{gem_binary} unpack --verbose $source \
cd %{mod_name}-%{version} \
chmod og-w -R . \
%{?gem_binary}%{!?gem_binary:/usr/bin/gem} specification --ruby $source > %{mod_name}-%{version}.gemspec \
%{gem_binary} specification --ruby $source > %{mod_name}-%{version}.gemspec \
%{nil}
# %%gem_build macro ...
#
%gem_build() \
GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name %{mod_name}-%{version}.gemspec | xargs dirname` \
cd $GEMSPEC_SOURCE_DIR && %{?gem_binary}%{!?gem_binary:/usr/bin/gem} build --verbose %{mod_name}-%{version}.gemspec \
%{set_gem_binary} \
cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose %{mod_name}-%{version}.gemspec \
%{nil}
# %%gem_install macro ...