diff --git a/ruby-common.changes b/ruby-common.changes index ebe4844..fac4b2a 100644 --- a/ruby-common.changes +++ b/ruby-common.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Mon Jun 13 11:43:30 UTC 2022 - Marcus Rueckert + +- 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 diff --git a/ruby.rpm-macros b/ruby.rpm-macros index 7357c83..07d90ea 100644 --- a/ruby.rpm-macros +++ b/ruby.rpm-macros @@ -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 ...