SHA256
1
0
forked from pool/ruby

Accepting request 127050 from devel:languages:ruby

- Provide the following new RPM macros:
  + %gem_unpack
  + %gem_build
  + %gem_install (retaining the old behavior)

- add automatic provides and requires for rubygems (forwarded request 127027 from coolo)

OBS-URL: https://build.opensuse.org/request/show/127050
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ruby?expand=0&rev=32
This commit is contained in:
Stephan Kulow 2012-07-04 07:08:43 +00:00 committed by Git OBS Bridge
commit 9be1e8a4bc
5 changed files with 108 additions and 7 deletions

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Tue Jul 3 08:02:01 UTC 2012 - saschpe@suse.de
- Provide the following new RPM macros:
+ %gem_unpack
+ %gem_build
+ %gem_install (retaining the old behavior)
-------------------------------------------------------------------
Mon Jul 2 14:06:43 UTC 2012 - coolo@suse.com
- add automatic provides and requires for rubygems
-------------------------------------------------------------------
Tue Jun 19 10:10:00 UTC 2012 - coolo@suse.com

View File

@ -1,8 +1,8 @@
%gem_install %{gem19_install}
%gem_cleanup /usr/bin/gem_build_cleanup %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}
%rubygems_requires %{rubygems19_requires}
%rb_binary %{rb19_binary}
%gem_binary /usr/bin/gem
%rb_arch %{rb19_arch}
%rb_ver %{rb19_ver}
@ -26,3 +26,45 @@
%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() \
if [ %# -eq 0 ]; then \
%{gem_binary} unpack --verbose %{SOURCE0} \
else \
%{gem_binary} unpack --verbose %1 \
fi \
cd %{mod_name}-%{version} \
%{nil}
# %%gem_build macro ...
#
%gem_build() \
GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name "*.gemspec" | xargs dirname` \
cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose *.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() \
if [ %# -eq 1 ]; then \
%{gem_binary} install --verbose --local --build-root=%{buildroot} \
else \
GEM_FILE=`find . -maxdepth 2 -type f -name "%{mod_name}-%{version}.gem"` \
%{gem_binary} install --verbose --local --bindir %{buildroot}%{_bindir} --install-dir %{buildroot}%{_libdir}/ruby/gems/%{rb_ver} $GEM_FILE \
fi \
%{nil}
%gem_cleanup() \
/usr/bin/gem_build_cleanup %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \
%{nil}

View File

@ -1,7 +1,7 @@
#
# spec file for package ruby
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -15,21 +15,24 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: ruby
Version: 1.9.3
Release: 0
#
License: MIT
Group: Development/Languages/Ruby
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: ruby.macros
Source1: gem_build_cleanup
Source2: gemrc
Source3: ruby.common-macros
Source4: rubygems.attr
Source5: rubygemsdeps.sh
Provides: /usr/bin/ruby
Url: http://www.ruby-lang.org/
Summary: An Interpreted Object-Oriented Scripting Language
License: MIT
Group: Development/Languages/Ruby
Requires: ruby19
Provides: rubygems = 1.8.15
Obsoletes: rubygems < 1.8.15
@ -64,17 +67,18 @@ simple, straight-forward, and extensible.
BeOS, and more)
%package devel
Group: Development/Languages/Ruby
Summary: Development files to link against Ruby
Requires: ruby19-devel %{name}
Group: Development/Languages/Ruby
Requires: %{name}
Requires: ruby19-devel
Provides: rubygems_with_buildroot_patch
%description devel
Development files to link against Ruby.
%package common
Group: Development/Languages/Ruby
Summary: Files needed by all ruby versions
Group: Development/Languages/Ruby
%description common
Development files to link against Ruby.
@ -93,6 +97,8 @@ ln -s %_libdir/libruby1.9.so $RPM_BUILD_ROOT%_libdir/libruby.so
install -D -m 0644 %{S:0} $RPM_BUILD_ROOT/etc/rpm/macros.ruby
install -D -m 0644 %{S:3} $RPM_BUILD_ROOT/etc/rpm/macros.common-ruby
install -D -m 0644 %{S:2} $RPM_BUILD_ROOT/etc/gemrc
install -D -m 0644 %{S:4} $RPM_BUILD_ROOT/%{_rpmconfigdir}/fileattrs/rubygems.attr
install -D -m 0755 %{S:5} $RPM_BUILD_ROOT/%{_rpmconfigdir}/rubygemsdeps.sh
export NO_BRP_STALE_LINK_ERROR=yes
%files
@ -109,5 +115,8 @@ export NO_BRP_STALE_LINK_ERROR=yes
%defattr(-,root,root)
/etc/gemrc
/etc/rpm/macros.common-ruby
%{_rpmconfigdir}/fileattrs/rubygems.attr
%{_rpmconfigdir}/rubygemsdeps.sh
%_bindir/gem_build_cleanup
%changelog

4
rubygems.attr Normal file
View File

@ -0,0 +1,4 @@
%__rubygems_requires %{_rpmconfigdir}/rubygemsdeps.sh --requires
%__rubygems_provides %{_rpmconfigdir}/rubygemsdeps.sh --provides
%__rubygems_path ^%{_libdir}/ruby/gems/.*/specifications

33
rubygemsdeps.sh Normal file
View File

@ -0,0 +1,33 @@
#!/bin/bash
[ $# -ge 1 ] || {
cat > /dev/null
exit 0
}
case $1 in
-P|--provides)
shift
RPM_BUILD_ROOT="$1"
while read possible
do
case "$possible" in
*.gemspec)
possible=${possible##*/}
possible=${possible%.gemspec}
echo "$possible" | sed -e 's,^\(.*\)-,rubygem(\1) = ,'
;;
esac
done
;;
-R|--requires)
while read possible ; do
case "$possible" in
*.gemspec)
echo "$possible" | sed -ne 's,.*/gems/,ruby(abi) = ,; s,/.*,,p'
;;
esac
done
;;
esac
exit 0