ruby/ruby.macros
Stephan Kulow 53dbe04f09 Accepting request 128957 from openSUSE:Tools:Unstable
- map the != operator to > - which might be wrong in 50% of all cases

- require a patched rpm in case rpm does not have magic hooks

- move the option parsing to a shell script that is able to do it
  rightly (rpm macros are just *BAD*)

- make the rubygemdeps a ruby script much more clever about gemspecs

- Another take on %gem_install, the version w/o passing parameters
  seemed to be wrong

- avoid *.gemspec, we get problems if we there are two

- remove too relaxing permissions from unpacked archive

- add a provides for ruby-macros

- Fix %gem_unpack:
  Fetch Gemspec from gem metadata for gems that don't package Gemspecs
  but generate them programatically

OBS-URL: https://build.opensuse.org/request/show/128957
OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=42
2012-07-26 07:25:42 +00:00

61 lines
1.7 KiB
Plaintext

%rubygems_requires %{rubygems19_requires}
%rb_binary %{rb19_binary}
%gem_binary /usr/bin/gem1.9
%rb_arch %{rb19_arch}
%rb_ver %{rb19_ver}
%rb_dir %{rb19_dir}
%rb_libdir %{rb19_libdir}
%rb_archdir %{rb19_archdir}
%rb_sitedir %rb19_sitedir
%rb_sitelibdir %rb19_sitelibdir
%rb_sitearchdir %rb19_sitearchdir
%rb_vendordir %rb19_vendordir
%rb_vendorlibdir %rb19_vendorlibdir
%rb_vendorarchdir %rb19_vendorarchdir
# old names
%rb_sitelib %rb19_sitelibdir
%rb_sitearch %rb19_sitearchdir
#
%rb_vendorlib %rb19_vendorlibdir
%rb_vendorarch %rb19_vendorarchdir
# %%gem_unpack macro unpacks a gem file into %%{_builddir}
#
# example:
# %prep
# %gem_unpack %{SOURCE0}
# %patch1 -p1
#
%gem_unpack(s:) \
source=%{-s:%{-s*}}%{!-s:%{SOURCE0}} \
%{gem_binary} unpack --verbose $source \
cd %{mod_name}-%{version} \
chmod og-w -R . \
%{gem_binary} unpack --spec --verbose $source \
%{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} build --verbose %{mod_name}-%{version}.gemspec \
%{nil}
# %%gem_install macro ...
#
# When invoked with a single parameter, the macro retains the old macro behavior, i.e.
# building the upstream gem directly in $RPM_BUILD_ROOT without unpacking to %{_builddir} first.
#
%gem_install /usr/lib/rpm/gem_install.sh --default-gem %{mod_name}-%{version}.gem --build-root %{buildroot} --gem-binary %{gem_binary}
%gem_cleanup() \
/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \
%{nil}