- split out ruby-common into a package on its own

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=43
This commit is contained in:
Stephan Kulow 2012-07-26 07:36:40 +00:00 committed by Git OBS Bridge
parent 53dbe04f09
commit 4b4c0dfe59
8 changed files with 8 additions and 201 deletions

View File

@ -1,14 +0,0 @@
#!/bin/sh
if [ ${#*} = 1 ] ; then
if [ -d "$1" ] ; then
find $1 \
\( -name \*.o -o -name Makefile -o -name config.log -o -name config.status -o -name Makefile.html -o -name gem_make.out -o -name mkmf.log -o -name \*.bak -o -name .deps -o -name .libs -o -name CVS \) \
-print0 | xargs -r0 rm -rv || :
else
echo "'$1' does not exists or is not a directory! Exiting." >&2
exit 1
fi
else
echo "Please pass exact one argument to this script! Exiting." >&2
exit 1
fi

View File

@ -1,45 +0,0 @@
#! /bin/bash
# options may be followed by one colon to indicate they have a required argument
if ! options=$(getopt -o dEf -l ignore-dependencies,force,no-rdoc,rdoc,no-ri,ri,env-shebang,no-env-shebang,default-gem:,build-root:,gem-binary: -- "$@")
then
# something went wrong, getopt will put out an error message for us
exit 1
fi
eval set -- "$options"
gem_binary=gem
defaultgem=
gemfile=
otheropts=
while [ $# -gt 0 ]
do
case $1 in
--default-gem) defaultgem=$2 ; shift;;
--gem-binary) gem_binary="$2" ; shift;;
--build-root) otheropts="$otheropts $1=$2"; shift;;
(--) ;;
(-*) otheropts="$otheropts $1";;
(*) gemfile=$1; otheropts="$otheropts $1"; break;;
esac
shift
done
if [ "x$gemfile" = "x" ] ; then
gemfile=$(find . -maxdepth 2 -type f -name "$defaultgem")
otheropts="$otheropts $gemfile"
fi
set -x
$gem_binary install --verbose --local $otheropts
if test -d $RPM_BUILD_ROOT/usr/bin; then
cd $RPM_BUILD_ROOT/usr/bin
bins=`ls -1 *1.9 2> /dev/null`
if test -n "$bins"; then
for bin in $bins; do
mv -v $bin $(echo "$bin" | sed -e 's,1.9$,,')
done
fi
fi

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jul 26 07:36:15 UTC 2012 - coolo@suse.com
- split out ruby-common into a package on its own
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jul 25 14:52:49 UTC 2012 - coolo@suse.com Wed Jul 25 14:52:49 UTC 2012 - coolo@suse.com

View File

@ -1,4 +0,0 @@
%gem_cleanup() \
/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \
%{nil}

View File

@ -25,36 +25,3 @@
%rb_vendorlib %rb19_vendorlibdir %rb_vendorlib %rb19_vendorlibdir
%rb_vendorarch %rb19_vendorarchdir %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}

View File

@ -21,12 +21,7 @@ Version: 1.9.3
Release: 0 Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: ruby.macros Source0: ruby.macros
Source1: gem_build_cleanup
Source2: gemrc Source2: gemrc
Source3: ruby.common-macros
Source4: rubygems.attr
Source5: rubygemsdeps.rb
Source6: gem_install.sh
Provides: /usr/bin/ruby Provides: /usr/bin/ruby
Url: http://www.ruby-lang.org/ Url: http://www.ruby-lang.org/
Summary: An Interpreted Object-Oriented Scripting Language Summary: An Interpreted Object-Oriented Scripting Language
@ -35,12 +30,7 @@ Group: Development/Languages/Ruby
Requires: ruby19 Requires: ruby19
Provides: rubygems = 1.8.15 Provides: rubygems = 1.8.15
Obsoletes: rubygems < 1.8.15 Obsoletes: rubygems < 1.8.15
Provides: ruby-macros = 1 Requires: ruby-common >= 1.0
Requires: ruby-common = %{version}-%{release}
%if %suse_version < 1140
# we need a patched rpm
Requires: rpm-with-ruby-provide-hook
%endif
%description %description
Ruby is an interpreted scripting language for quick and easy Ruby is an interpreted scripting language for quick and easy
@ -81,14 +71,6 @@ Provides: rubygems_with_buildroot_patch
%description devel %description devel
Development files to link against Ruby. Development files to link against Ruby.
%package common
Summary: Files needed by all ruby versions
Group: Development/Languages/Ruby
Requires: /usr/bin/getopt
%description common
Development files to link against Ruby.
%prep %prep
%build %build
@ -101,31 +83,17 @@ done
mkdir -p $RPM_BUILD_ROOT%_libdir mkdir -p $RPM_BUILD_ROOT%_libdir
ln -s %_libdir/libruby1.9.so $RPM_BUILD_ROOT%_libdir/libruby.so 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: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:2} $RPM_BUILD_ROOT/etc/gemrc
install -D -m 0644 %{S:4} $RPM_BUILD_ROOT/usr/lib/rpm/fileattrs/rubygems.attr
install -D -m 0755 %{S:5} $RPM_BUILD_ROOT/usr/lib/rpm/rubygemsdeps.rb
install -D -m 0755 %{S:6} $RPM_BUILD_ROOT/usr/lib/rpm/gem_install.sh
install -D -m 0755 %{S:1} $RPM_BUILD_ROOT/usr/lib/rpm/gem_build_cleanup.sh
export NO_BRP_STALE_LINK_ERROR=yes export NO_BRP_STALE_LINK_ERROR=yes
%files %files
%defattr(-,root,root) %defattr(-,root,root)
/etc/rpm/macros.ruby %config /etc/gemrc
%config /etc/rpm/macros.ruby
%{_bindir}/* %{_bindir}/*
%files devel %files devel
%defattr(-,root,root) %defattr(-,root,root)
%_libdir/libruby.so %_libdir/libruby.so
%files common
%defattr(-,root,root)
/etc/gemrc
/etc/rpm/macros.common-ruby
%dir /usr/lib/rpm/fileattrs
/usr/lib/rpm/fileattrs/rubygems.attr
/usr/lib/rpm/rubygemsdeps.rb
/usr/lib/rpm/gem_install.sh
/usr/lib/rpm/gem_build_cleanup.sh
%changelog %changelog

View File

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

View File

@ -1,66 +0,0 @@
#!/usr/bin/ruby
require 'optparse'
require 'rubygems/specification'
opts = OptionParser.new("Usage: #{$0}")
provides=false
opts.on("-P", "--provides", "Output the provides of the package") do |val|
provides=true
end
requires=false
opts.on("-R", "--requires", "Output the requires of the package") do |val|
requires=true
end
rest = opts.permute(ARGV)
unless provides || requires
exit(0)
end
gemspecs=Array.new
$stdin.each_line do |line|
line.match(%r{.*/specifications/.*\.gemspec$}) do |m|
gemspecs << [m[0], Gem::Specification.load(m[0])]
end
end
gemspecs.each do |file, spec|
rubyabi=nil
file.match(%r{.*/gems/([^/]*)/.*}) do |m|
rubyabi=m[1]
end
if provides
# old forms
puts "rubygem-#{spec.name} = #{spec.version}"
versions = spec.version.to_s.split('.')
puts "rubygem-#{spec.name}-#{versions[0]} = #{spec.version}" if versions.length > 0
puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]} = #{spec.version}" if versions.length > 1
puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]}_#{versions[2]} = #{spec.version}" if versions.length > 2
# version without ruby version - asking for trouble
puts "rubygem(#{spec.name}) = #{spec.version}"
puts "rubygem(#{rubyabi}:#{spec.name}) = #{spec.version}" if rubyabi
end
if requires
puts "ruby(abi) = #{rubyabi}" if rubyabi
spec.runtime_dependencies.each do |dep|
dep.requirement.requirements.each do |r|
if r.first == '~>'
next_version = Gem::Version.create(r.last).bump
puts "rubygem(#{rubyabi}:#{dep.name}) >= #{r.last}"
puts "rubygem(#{rubyabi}:#{dep.name}) < #{next_version}"
elsif r.first == '!='
# this is purely guessing, but we can't generate conflicts here ;(
puts "rubygem(#{rubyabi}:#{dep.name}) > #{r.last}"
#puts "rubygem(#{rubyabi}:#{dep.name}) < #{r.last}"
else
puts "rubygem(#{rubyabi}:#{dep.name}) #{r.first} #{r.last}"
end
end
end
end
end