SHA256
1
0
forked from pool/ruby

Accepting request 248380 from devel:languages:ruby

1

OBS-URL: https://build.opensuse.org/request/show/248380
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ruby?expand=0&rev=54
This commit is contained in:
Stephan Kulow 2014-09-12 09:28:34 +00:00 committed by Git OBS Bridge
commit b6dad63238
17 changed files with 50 additions and 1113 deletions

1
README Normal file
View File

@ -0,0 +1 @@
This is just a dummy package to pull the default ruby for the current distribution.

View File

@ -1,16 +0,0 @@
xmlrpc is doing a wrong content size check in case the server is compressing the answer. drop the check for now.
http://bugs.ruby-lang.org/issues/8182
Index: lib/xmlrpc/client.rb
===================================================================
--- lib/xmlrpc/client.rb.orig
+++ lib/xmlrpc/client.rb
@@ -509,8 +509,6 @@ module XMLRPC # :nodoc:
expected = resp["Content-Length"] || "<unknown>"
if data.nil? or data.bytesize == 0
raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
- elsif expected != "<unknown>" and expected.to_i != data.bytesize and resp["Transfer-Encoding"].nil?
- raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
end
parse_set_cookies(resp.get_fields("Set-Cookie"))

View File

@ -1,16 +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 || :
# remove more strict in the docu
find $1/doc \( -name Makefile.ri -o -name ext \) -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,65 +0,0 @@
#! /bin/bash
set -e
# 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=
buildroot=
while [ $# -gt 0 ]
do
case $1 in
--default-gem) defaultgem=$2 ; shift;;
--gem-binary) gem_binary="$2" ; shift;;
--build-root) otheropts="$otheropts $1=$2"; buildroot=$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")
# if still empty, we pick the sources
if [ "x$gemfile" = "x" ] ; then
gemfile=$(find $RPM_SOURCE_DIR -name "$defaultgem")
fi
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
# backward compat
bins=`ls -1 *1.9 *2.0 2> /dev/null` || true
if test -n "$bins"; then
for bin in $bins; do
mv -v $bin $(echo "$bin" | sed -e 's,2.0$,,; s,1.9$,,')
done
fi
fi
if [ -d "$buildroot" ]; then
find $buildroot -type f -perm /u+x | while read file; do
# TODO: scripts in ruby/1.9.1 should call ruby1.9 for consistency
sed -i -e 's,^#!/usr/bin/env ruby,#!/usr/bin/ruby,; s,^#! *[^ ]*/ruby,#!/usr/bin/ruby,' "$file"
done
# some windows made gems are broken
find $buildroot -type d | xargs ls -ld || :
find $buildroot -type f | xargs ls -l || :
chmod -R u+w $buildroot
chmod -R o-w $buildroot
fi

View File

@ -1,208 +0,0 @@
#!/bin/sh
#
# In the current package's specfile, updates a block delimited
# by "# BEGIN" / "# END" lines to contain BuildRequires: lines
# for each rubygem rpm (or rpm matching a given pattern) which
# has been built by the project.
#
# This gives us project-build-time dependency checking without the
# performance impact that specifying BuildRequires lines within
# each gem would cause. For more information, see:
#
# http://en.opensuse.org/openSUSE:Packaging_Ruby#Compensating_for_lack_of_BuildRequires
#
# Usage:
# ------
#
# 1. Ensure you have an "all-rubygems-good" package or similar
# in your project. If in doubt, copy the one from
# devel:languages:ruby:extensions.
#
# 2. cd to a working copy
#
# If you're feeling lazy, you are probably fine skipping the next two
# steps.
#
# 3. Run this script with the -l option and make sure you understand
# any differences between each repository/arch combination in the
# numbers of matching gems found.
#
# 4. If you don't, run with -l REPO ARCH to compare individual lists
# of matching gems.
#
# 5. If you want a BuildRequires: list of matching gems from *all*
# repo/arch combinations, run again with no arguments.
#
# OR
#
# If you want a BuildRequires: list of matching gems from a specific
# repo/arch combinations, run again with REPO ARCH as arguments.
#
# 6. osc diff to review the changes to the spec file, then osc commit.
me=`basename $0`
DEFAULT_PATTERN="rubygem-"
main () {
parse_opts "$@"
if [ -z "$project" ]; then
project=$( osc info | sed -ne '/^Project name: / { s///; p }' )
if [ -z "$project" ]; then
echo "Couldn't establish build service project name." >&2
echo "Are you inside a package working directory?" >&2
exit 1
fi
fi
echo "Project: $project"
case "$project" in
home:*:branches:*)
cat <<EOF >&2
WARNING: you are running this in a branch.
You probably need to specify the parent project via -P,
otherwise you may not get the dependencies you want.
EOF
;;
esac
specfile=$( ls -1 *.spec )
if ! [ -f "$specfile" ]; then
echo "Couldn't find spec file." >&2
echo "Are you inside a package working directory?" >&2
exit 1
fi
if [ -n "$list" ]; then
if [ -n "$repo" ]; then
get_buildrequires_lines "$repo" "$arch"
else
list_matches
fi
else
if [ -n "$repo" ]; then
get_buildrequires_lines "$repo" "$arch" | update_spec
else
find_all_matches | update_spec
fi
fi
}
usage () {
# Call as: usage [EXITCODE] [USAGE MESSAGE]
exit_code=1
if [[ "$1" == [0-9] ]]; then
exit_code="$1"
shift
fi
if [ -n "$1" ]; then
echo "$*" >&2
echo
fi
cat <<EOF >&2
Usage: $me [options] [REPOSITORY ARCH]
Options:
-h, --help Show this help and exit
-l, --list List matching rpms for the given repository / arch.
If no repository specified, show counts of matching
rpms per repository / arch.
-P, --project=PROJ Retrieve rpm lists from PROJ, not the current project.
-p, --pattern=PAT Set the pattern to match rpms by [$DEFAULT_PATTERN]
EOF
exit "$exit_code"
}
parse_opts () {
list=
project=
pattern="$DEFAULT_PATTERN"
while [ $# != 0 ]; do
case "$1" in
-h|--help)
usage 0
;;
-l|--list)
list=y
shift
;;
-p|--pattern)
pattern="$2"
shift 2
;;
-P|--project)
project="$2"
shift 2
;;
-*)
usage "Unrecognised option: $1"
;;
*)
break
;;
esac
done
if [ $# = 1 ]; then
usage "Insufficient arguments."
fi
if [ $# -gt 2 ]; then
usage "Too many arguments."
fi
repo="$1"
arch="$2"
}
get_buildrequires_lines () {
repo="$1" arch="$2"
osc api "/build/$project/$repo/$arch/_repository" | \
grep "binary .*filename=\"$pattern" | \
sed -e 's,.* <binary filename=",,; s,\.rpm".*,,; s,^,BuildRequires: ,' | \
grep -v debuginfo
}
list_matches () {
echo
echo "Matching rpms per repository/arch:"
echo
osc repos | while read repo arch; do
count=$( get_buildrequires_lines "$repo" "$arch" | wc -l )
printf "%-17s %-8s %d\n" "$repo" "$arch" "$count"
done
echo
}
find_all_matches () {
osc repos "$project" | while read repo arch; do
echo "Obtaining BuildRequires from $repo $arch ..." >&2
get_buildrequires_lines "$repo" "$arch"
done | sort -u
}
edit_spec () {
sed -n -e '1,/BEGIN/p' $specfile
echo "# Automatically generated by $0"
echo "# on `date`"
echo "# See http://en.opensuse.org/openSUSE:Packaging_Ruby#Compensating_for_lack_of_BuildRequires"
cat
sed -n -e '/END/,$p' $specfile
}
update_spec () {
if edit_spec > $specfile.new; then
mv $specfile.new $specfile
echo "Updated spec: $specfile"
else
echo "Failed to generate new spec file contents; aborting." >&2
exit 1
fi
}
main "$@"

View File

@ -1,58 +0,0 @@
#!/usr/bin/awk -f
#
# Generate 'Provides' for embedded rubygems
#
# Call-seq:
# generate_rubygemprovides.awk <ruby-version> <arch> <gemname> <gemmajor> <gemminor> <gemmicro> [ <gemtiny> ]
#
# Provides: rubygem(<rubyversion>:<gemname>) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemmajorversion>) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemmajorversion>.<gemminorversion>) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemmajorversion>.<gemminorversion>.<gemtinyversion) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemversion>) = <gemversion>
# Provides: rubygem(<gemname>) = <gemversion>
# Provides: rubygem-<gemname> = <gemversion>
# Provides: rubygem-<gemname> = <gemversion>-<rubyrelease>
# Provides: rubygem-<gemname>(<arch>) = <gemversion>-<rubyrelease>
# Provides: rubygem-<gemname>-<gemmajorversion> = <gemversion>
# Provides: rubygem-<gemname>-<gemmajorversion>_<gemminorversion> = <gemversion>
# Provides: rubygem-<gemname>-<gemmajorversion>_<gemminorversion>_<gemmicroversion> = <gemversion>
# Provides: rubygem-<gemname>-<gemmajorversion>_<gemminorversion>_<gemmicroversion>_<gemtinyversion> = <gemversion>
BEGIN {
rbver = ARGV[1]
arch = ARGV[2]
name = ARGV[3]
major = ARGV[4]
minor = ARGV[5]
micro = ARGV[6]
tiny = ARGV[7]
if (tiny != "") {
version = major "." minor "." micro "." tiny
}
else {
version = major "." minor "." micro
}
print "Provides: rubygem(" rbver ":" name ") = " version
print "Provides: rubygem(" rbver ":" name ":" major ") = " version
print "Provides: rubygem(" rbver ":" name ":" major "." minor ") = " version
print "Provides: rubygem(" rbver ":" name ":" major "." minor "." micro ") = " version
if (tiny != "") {
print "Provides: rubygem(" rbver ":" name ":" major "." minor "." micro "." tiny ") = " version
}
print "Provides: rubygem(" rbver ":" name ":" version ") = " version
print "Provides: rubygem(" name ") = " version
print "Provides: rubygem-" name " = " version
# not needed currently
# if ( arch == "x86_64") {
# print "Provides: rubygem-" name "(" arch ") = " version
# }
print "Provides: rubygem-" name "-" major " = " version
print "Provides: rubygem-" name "-" major "_" minor " = " version
print "Provides: rubygem-" name "-" major "_" minor "_" micro " = " version
if (tiny != "") {
print "Provides: rubygem-" name "-" major "_" minor "_" micro "_" tiny " = " version
}
}

View File

@ -1,15 +0,0 @@
Index: ext/tk/extconf.rb
===================================================================
--- ext/tk/extconf.rb.orig
+++ ext/tk/extconf.rb
@@ -224,9 +224,7 @@ def get_shlib_path_head
else
[
- '/opt', '/pkg', '/share',
- '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local',
- '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr'
+ '/usr'
].each{|dir|
next unless File.directory?(dir)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6948b02570cdfb89a8313675d4aa665405900e27423db408401473f30fc6e901
size 11976939

View File

@ -1,2 +0,0 @@
addFilter("files-duplicate /usr/share/ri/.*")
addFilter("unexpanded-macro /usr/share/ri/.*")

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Wed Sep 10 15:25:10 UTC 2014 - mrueckert@suse.de
- to make it easier to migrate from the old scheme to the new
scheme BuildIgnore: ruby aswell
-------------------------------------------------------------------
Tue Sep 9 17:44:06 UTC 2014 - mrueckert@suse.de
- cleaned up buildrequires/requires and added buildignore for rubygem-gem2rpm
-------------------------------------------------------------------
Mon Jun 23 10:02:27 UTC 2014 - mrueckert@suse.de
- remove obsolete expand line
-------------------------------------------------------------------
Fri Jun 20 13:35:53 UTC 2014 - mrueckert@suse.de
- remove the provides to avoid have choice
-------------------------------------------------------------------
Sat Jun 14 14:55:22 UTC 2014 - mrueckert@suse.de
- migrated to just plain wrapper packages
- patches moved to ruby2.1 package:
rubygems-1.5.0_buildroot.patch
ruby-1.9.2p290_tcl_no_stupid_rpaths.patch
drop_content_size_check_in_xmlrpc.patch
ruby19-export_init_prelude.patch
-------------------------------------------------------------------
Fri May 16 20:21:05 UTC 2014 - kkaempf@suse.com

View File

@ -1,43 +0,0 @@
%rb_binary /usr/bin/ruby
%rb_arch %(%{rb_binary} -e 'print RUBY_PLATFORM')
%rb_ver %(%{rb_binary} -r rbconfig -e 'print RbConfig::CONFIG["ruby_version"]')
#
## Base
# "rubylibprefix"=>"/usr/lib64/ruby",
%rb_dir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["rubylibprefix"]' )
# "rubylibdir" =>"/usr/lib64/ruby/2.1.0",
%rb_libdir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["rubylibdir"]' )
# "archdir" =>"/usr/lib64/ruby/2.1.0/x86_64-linux",
%rb_archdir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["archdir"]' )
## Site
# "sitedir" =>"/usr/lib64/ruby/site_ruby",
%rb_sitedir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]' )
# "sitelibdir" =>"/usr/lib64/ruby/site_ruby/2.1.0",
%rb_sitelibdir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]' )
# "sitearchdir" =>"/usr/lib64/ruby/site_ruby/2.1.0/x86_64-linux",
%rb_sitearchdir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]' )
## Vendor
# "vendordir" =>"/usr/lib64/ruby/vendor_ruby",
%rb_vendordir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["vendordir"]' )
# "vendorlibdir" =>"/usr/lib64/ruby/vendor_ruby/2.1.0",
%rb_vendorlibdir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["vendorlibdir"]' )
# "vendorarchdir" =>"/usr/lib64/ruby/vendor_ruby/2.1.0/x86_64-linux",
%rb_vendorarchdir %(%{rb_binary} -rrbconfig -e 'puts RbConfig::CONFIG["vendorarchdir"]' )
# backward compat
%rb_sitearch %{rb_sitearchdir}
%rb_sitelib %{rb_sitelibdir}
%rb_vendorlib %{rb_vendorlibdir}
%rb_vendorarch %{rb_vendorarchdir}
%gem_install /usr/lib/rpm/gem_install_wrapper.sh
%gem_cleanup /usr/bin/gem_build_cleanup %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/
%gem_base %(%{rb_binary} -rrubygems -e 'print Gem::BasicSpecification.new.base_dir' )
%gem_extensions %(%{rb_binary} -rrubygems -e 'print Gem::BasicSpecification.new.extensions_dir' )
%gem_doc_ext %(%{rb_binary} -rrubygems -e 'bs = Gem::BasicSpecification.new; rp = bs.extensions_dir.rpartition(bs.base_dir); print rp[1]+"/doc"+rp[2]' )
%gem_platform %(%{rb_binary} -rrubygems -r rbconfig -e 'print Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s' )

View File

@ -1,54 +0,0 @@
# %%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}%{!?gem_binary:/usr/bin/gem} 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 \
%{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 \
%{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_binary}}
# we need to copy parts of the %fdupes macro as rpm can't expand parameters in macro "calls" ;(
%gem_cleanup() \
/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \
fdupes -q -p -n -r %{buildroot}%{gem_base} | \
while read _file; do \
if test -z "$_target" ; then \
_target="$_file"; \
else \
if test -z "$_file" ; then \
_target=""; \
continue ; \
fi ; \
ln -sf "${_target#%{buildroot}}" "$_file"; \
fi ; \
done \
%{nil}
# this is used in older gems - but it's pointless with newer ruby/rpm versions
%rubygems_requires %{nil}
%gem_base %(%{rb_binary} -rrubygems -e 'print Gem::Specification.new.base_dir' )
%gem_extensions %(%{rb_binary} -rrubygems -e 'print Gem::Specification.new.extensions_dir' || echo %{_libdir}/ruby/gems/%{rb_ver}/gems )
%gem_doc_ext %(%{rb_binary} -r rubygems -e 'bs = Gem::Specification.new; rp = bs.extensions_dir.rpartition(bs.base_dir); print rp[1]+"/doc"+rp[2]' )
%gem_platform %(%{rb_binary} -r rubygems -r rbconfig -e 'print Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s' )

413
ruby.spec
View File

@ -17,104 +17,19 @@
Name: ruby
####
#!!!
#!!! when updating, check versions of embedded rubygems in package stdlib below
#!!!
####
%define patch_level p0
Version: 2.1.2
Version: 2.1
Release: 0
# make the exported API version explicit
%define api_version 2.1.0
# ruby-macros and ruby-common version
%define rpm_macros_version 3
#
%define pkg_version %{version}
%define libname lib%{name}2_1
# keep in sync with macro file!
%define rb_ver %{api_version}
%define rb_arch %(echo %{_target_cpu}-linux-gnu | sed -e "s/ppc/powerpc/")
%define rb_libdir %{_libdir}/ruby/%{rb_ver}/
%define rb_archdir %{_libdir}/ruby/%{rb_ver}/%{rb_arch}
# keep in sync with macro file!
#
# from valgrind.spec
%ifarch %ix86 x86_64 ppc ppc64
%define use_valgrind 1
%endif
# see https://bugs.ruby-lang.org/issues/8000 - might come back
%if %suse_version < 1230
%define tk_version_supported 1
%endif
# the tests are unfortunately rather fishy
%define run_tests 0
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: awk
BuildRequires: gdbm-devel
BuildRequires: libffi-devel
BuildRequires: libyaml-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pkg-config
BuildRequires: readline-devel
BuildRequires: tk-devel
BuildRequires: zlib-devel
# this requires is needed as distros older than 11.3 have a buildignore on freetype2, without this the detection of the tk extension fails
BuildRequires: freetype2-devel
%if 0%{?suse_version} > 1010
BuildRequires: xorg-x11-libX11-devel
%else
BuildRequires: xorg-x11-devel
%endif
%if 0%{?use_valgrind}
%if 0%{?suse_version} > 1021
BuildRequires: valgrind-devel
%else
BuildRequires: valgrind
%endif
%endif
Provides: rubygem-rake = 10.1.0
Provides: ruby(abi) = %{rb_ver}
Provides: ruby-common = %{rpm_macros_version}
Obsoletes: ruby-common < %{rpm_macros_version}
Provides: ruby21
Conflicts: ruby18
Conflicts: ruby19
Conflicts: ruby20
Requires: ruby-stdlib
PreReq: update-alternatives
BuildRequires: update-alternatives
Provides: ruby-macros = %{rpm_macros_version}
#
Source: README
Url: http://www.ruby-lang.org/
Source: http://cache.ruby-lang.org/pub/ruby/2.1/ruby-%{pkg_version}.tar.bz2
# sources from former ruby-common
Source1: gem_build_cleanup
Source2: ruby.macros
Source3: ruby.rpm-macros
Source4: rubygems.attr
Source5: rubygemsdeps.rb
Source6: gem_install.sh
Source7: generate_buildrequires.sh
Source8: generate_rubygemprovides.awk
Patch0: rubygems-1.5.0_buildroot.patch
Patch1: ruby-1.9.2p290_tcl_no_stupid_rpaths.patch
Patch2: drop_content_size_check_in_xmlrpc.patch
#
Summary: An Interpreted Object-Oriented Scripting Language
License: BSD-2-Clause or Ruby
Group: Development/Languages/Ruby
License: MIT
BuildRequires: ruby%{version}-devel
#!BuildIgnore: ruby
#!BuildIgnore: rubygem-gem2rpm
%requires_ge ruby%{version}
Provides: rubygems = 1.8.15
Obsoletes: rubygems < 1.8.15
%description
Ruby is an interpreted scripting language for quick and easy
@ -145,321 +60,29 @@ simple, straight-forward, and extensible.
- Highly Portable (works on many UNIX machines; DOS, Windows, Mac,
BeOS, and more)
%package -n %{libname}
Summary: Dynamic runtime library for Ruby
Group: System/Libraries
%description -n %{libname}
Dynamic runtime library libruby2.1.so.2.0.0 for Ruby
%package doc
Summary: Documentation and samples for Ruby
Group: Development/Languages/Ruby
%description doc
Documentation and samples for Ruby
%package stdlib
Summary: The Ruby standard library
Group: Development/Languages/Ruby
################################
# generate provides for embedded rubygems
# must be 'manually' generated since
# - the final .gemspec files are created during %build and %install
# - the usual means to generate provides for rubygems is using ruby
# and ruby is not available while building ruby :-/
%define gen_embedded_provides4() %(awk -f %{S:8} -- %api_version %arch %1 %2 %3 %4)
%define gen_embedded_provides5() %(awk -f %{S:8} -- %api_version %arch %1 %2 %3 %4 %5)
%gen_embedded_provides4 io-console 0 4 2
%gen_embedded_provides4 json 1 8 1
%gen_embedded_provides4 minitest 4 7 5
%gen_embedded_provides4 psych 2 0 3
%gen_embedded_provides4 rake 10 1 0
%gen_embedded_provides4 rdoc 4 1 0
%gen_embedded_provides5 test-unit 2 1 1 0
################################
%description stdlib
The Ruby standard library
%package devel
Summary: Development files to link against Ruby
Group: Development/Languages/Ruby
Requires: %{name} = %{version}
Provides: rubygems = 1.3.7
Provides: rubygems_with_buildroot_patch
Requires: ruby-common
Requires: %{name}
%requires_ge ruby%{version}-devel
%description devel
Development files to link against Ruby.
%package devel-extra
Summary: Special development files of ruby, normally not installed
Group: Development/Languages/Ruby
Requires: %{name}-devel = %{version}
%description devel-extra
Development files to link against Ruby.
%if 0%{?tk_version_supported} > 0
%package tk
Summary: TCL/TK bindings for Ruby
Group: Development/Languages/Ruby
Requires: %{name} = %{version}
%description tk
TCL/TK bindings for Ruby
%endif
%package doc-ri
Summary: Ruby Interactive Documentation
Group: Development/Languages/Ruby
Requires: %{name} = %{version}
%if 0%{?suse_version} >= 1121
BuildArch: noarch
%endif
%description doc-ri
This package contains the RI docs for ruby
%package doc-html
Summary: This package contains the HTML docs for ruby
Group: Development/Languages/Ruby
Requires: %{name} = %{version}
%if 0%{?suse_version} >= 1121
BuildArch: noarch
%endif
%description doc-html
This package contains the HTML docs for ruby
%package examples
Summary: Example scripts for ruby
Group: Development/Languages/Ruby
Requires: %{name} = %{version}
%if 0%{?suse_version} >= 1121
BuildArch: noarch
%endif
%description examples
Example scripts for ruby
%package test-suite
Requires: %{name} = %{version}
Summary: An Interpreted Object-Oriented Scripting Language
Group: Development/Languages/Ruby
%if 0%{?suse_version} >= 1121
BuildArch: noarch
%endif
%description test-suite
Ruby is an interpreted scripting language for quick and easy
object-oriented programming. It has many features for processing text
files and performing system management tasks (as in Perl). It is
simple, straight-forward, and extensible.
* Ruby features:
- Simple Syntax
- *Normal* Object-Oriented features (class, method calls, for
example)
- *Advanced* Object-Oriented features(Mix-in, Singleton-method, for
example)
- Operator Overloading
- Exception Handling
- Iterators and Closures
- Garbage Collection
- Dynamic Loading of Object Files (on some architectures)
- Highly Portable (works on many UNIX machines; DOS, Windows, Mac,
BeOS, and more)
%prep
%setup -q -n ruby-%{pkg_version}
%patch0
%patch1
%patch2
find sample -type f -print0 | xargs -r0 chmod a-x
grep -Erl '^#! */' benchmark bootstraptest ext lib sample test \
| xargs -r perl -p -i -e 's|^#!\s*\S+(\s+.*)?$|#!/usr/bin/ruby2.1$1|'
%build
%configure \
--with-soname=ruby \
--target=%{_target_platform} \
%if 0%{?use_valgrind}
--with-valgrind \
%endif
--with-mantype=man \
--enable-shared \
--disable-static \
--disable-rpath
%{__make} all V=1
%install
%makeinstall V=1
%{__install} -D -m 0644 %{S:2} %{buildroot}/etc/rpm/macros.ruby
echo "%defattr(-,root,root,-)" > devel-extra-excludes
echo "%defattr(-,root,root,-)" > devel-extra-list
for i in iseq.h insns.inc insns_info.inc revision.h version.h thread_pthread.h \
ruby_atomic.h method.h internal.h id.h vm_core.h vm_opts.h node.h eval_intern.h vm_debug.h; do
install -m 644 $i %{buildroot}%{_includedir}/ruby-%{rb_ver}/
echo "%exclude %{_includedir}/ruby-%{rb_ver}/$i" >> devel-extra-excludes
echo "%{_includedir}/ruby-%{rb_ver}/$i" >> devel-extra-list
done
# Create gem native extensions dir
# use shell scripting here as we're executing the just installed binary
%define rb_binary %{buildroot}/usr/bin/ruby -I %{buildroot}%{rb_libdir} -I %{buildroot}%{rb_archdir}
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
export GEM_EXTENSIONS=`%{rb_binary} -rrubygems -e 'print Gem::BasicSpecification.new.extensions_dir'`
export GEM_PLATFORM=`%{rb_binary} -r rubygems -r rbconfig -e 'print Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s'`
# mkdir -p %{buildroot}$GEM_EXTENSIONS/$GEM_PLATFORM/%{rb_ver}
mkdir -p %{buildroot}$GEM_EXTENSIONS
# formerly ruby-common
# we need to make sure it overwrites older macro versions and rpm sorts alphabetically
install -D -m 0644 %{S:3} $RPM_BUILD_ROOT/etc/rpm/macros.suse-ruby
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
install -D -m 0755 %{S:7} $RPM_BUILD_ROOT/usr/lib/rpm/generate_buildrequires.sh
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for bin in rake rdoc ri; do
# dummy
touch %{buildroot}%{_sysconfdir}/alternatives/$bin
mv %{buildroot}%_bindir/$bin %{buildroot}%_bindir/$bin.ruby
ln -s %{_sysconfdir}/alternatives/$bin %{buildroot}%_bindir/$bin
done
%post
for bin in rake rdoc ri; do
/usr/sbin/update-alternatives --install \
%{_bindir}/$bin $bin %{_bindir}/$bin.ruby 2
done
%preun
if [ "$1" = 0 ] ; then
for bin in rake rdoc ri; do
/usr/sbin/update-alternatives --remove $bin %{_bindir}/$bin.ruby
done
fi
%if 0%{?run_tests}
%check
export LD_LIBRARY_PATH="$PWD"
# we know some tests will fail when they do not find a /usr/bin/ruby
make check V=1 ||:
%endif
%post -n %{libname}
/sbin/ldconfig
%postun -n %{libname}
/sbin/ldconfig
install -D -m 0644 %{S:0} %{buildroot}/usr/share/doc/packages/ruby/README
install -D -m 0644 %{S:0} %{buildroot}/usr/share/doc/packages/ruby-devel/README
%files
%defattr(-,root,root,-)
%config(noreplace) /etc/rpm/macros.ruby
%ghost %{_sysconfdir}/alternatives/rake
%ghost %{_sysconfdir}/alternatives/rdoc
%ghost %{_sysconfdir}/alternatives/ri
%{_bindir}/erb
%{_bindir}/gem
%{_bindir}/irb
%{_bindir}/rake
%{_bindir}/rdoc
%{_bindir}/ri
%{_bindir}/ruby
%{_bindir}/testrb
%{_bindir}/rake.ruby
%{_bindir}/rdoc.ruby
%{_bindir}/ri.ruby
%if 0%{?tk_version_supported} > 0
%exclude %{rb_libdir}/multi-tk.rb
%exclude %{rb_libdir}/remote-tk.rb
%exclude %{rb_libdir}/tcltk.rb
%exclude %{rb_libdir}/tk*.rb
%exclude %{rb_libdir}/tk/
%exclude %{rb_libdir}/tkextlib/
%exclude %{rb_archdir}/tcltklib.so
%exclude %{rb_archdir}/tkutil.so
%endif
%{_mandir}/man1/ri.1*
%{_mandir}/man1/irb.1*
%{_mandir}/man1/erb.1*
%{_mandir}/man1/rake.1*
%{_mandir}/man1/ruby.1*
%doc ChangeLog COPYING COPYING.ja GPL KNOWNBUGS.rb LEGAL NEWS README README.EXT README.EXT.ja README.ja
# former ruby-common files
/etc/rpm/macros.suse-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
/usr/lib/rpm/generate_buildrequires.sh
%defattr(-,root,root)
%doc /usr/share/doc/packages/ruby/
%files -n %{libname}
%defattr(-,root,root,-)
%{_libdir}/libruby.so.2.1*
%files doc
%defattr(-,root,root,-)
%doc doc/* sample/
%files stdlib
%defattr(-,root,root,-)
%{_libdir}/ruby/
%if 0%{?tk_version_supported} > 0
%exclude %{rb_libdir}/multi-tk.rb
%exclude %{rb_libdir}/remote-tk.rb
%exclude %{rb_libdir}/tcltk.rb
%exclude %{rb_libdir}/tk*.rb
%exclude %{rb_libdir}/tk/
%exclude %{rb_libdir}/tkextlib/
%exclude %{rb_archdir}/tcltklib.so
%exclude %{rb_archdir}/tkutil.so
%endif
%files devel -f devel-extra-excludes
%defattr(-,root,root,-)
%{_includedir}/ruby-%{rb_ver}
%{_libdir}/libruby.so
%{_libdir}/libruby-static.a
%{_libdir}/pkgconfig/ruby-2.1.pc
%files devel-extra -f devel-extra-list
%if 0%{?tk_version_supported} > 0
%files tk
%defattr(-,root,root,-)
%{rb_libdir}/multi-tk.rb
%{rb_libdir}/remote-tk.rb
%{rb_libdir}/tcltk.rb
%{rb_libdir}/tk*.rb
%{rb_libdir}/tk/
%{rb_libdir}/tkextlib/
%{rb_archdir}/tcltklib.so
%{rb_archdir}/tkutil.so
%endif
%files doc-ri
%defattr(-,root,root,-)
%dir %{_datadir}/ri/
%{_datadir}/ri/%{rb_ver}/
%files devel
%defattr(-,root,root)
%doc /usr/share/doc/packages/ruby-devel/
%changelog

View File

@ -1,25 +0,0 @@
Index: ruby-1.9.3-p194/include/ruby/ruby.h
===================================================================
--- ruby-1.9.3-p194.orig/include/ruby/ruby.h
+++ ruby-1.9.3-p194/include/ruby/ruby.h
@@ -1225,6 +1225,7 @@ void ruby_init_stack(volatile VALUE*);
VALUE variable_in_this_stack_frame; \
ruby_init_stack(&variable_in_this_stack_frame);
void ruby_init(void);
+void ruby_init_prelude(void);
void *ruby_options(int, char**);
int ruby_run_node(void *);
int ruby_exec_node(void *);
Index: ruby-1.9.3-p194/ruby.c
===================================================================
--- ruby-1.9.3-p194.orig/ruby.c
+++ ruby-1.9.3-p194/ruby.c
@@ -1091,7 +1091,7 @@ proc_options(long argc, char **argv, str
return argc0 - argc;
}
-static void
+void
ruby_init_prelude(void)
{
Init_prelude();

View File

@ -1,59 +0,0 @@
Index: lib/rubygems/dependency_installer.rb
===================================================================
--- lib/rubygems/dependency_installer.rb.orig
+++ lib/rubygems/dependency_installer.rb
@@ -72,6 +72,7 @@ class Gem::DependencyInstaller
def initialize options = {}
@only_install_dir = !!options[:install_dir]
@install_dir = options[:install_dir] || Gem.dir
+ @build_root = options[:build_root]
options = DEFAULT_OPTIONS.merge options
@@ -382,6 +383,7 @@ class Gem::DependencyInstaller
:security_policy => @security_policy,
:user_install => @user_install,
:wrappers => @wrappers,
+ :build_root => @build_root,
:install_as_default => @install_as_default
}
options[:install_dir] = @install_dir if @only_install_dir
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb.orig
+++ lib/rubygems/installer.rb
@@ -590,8 +590,17 @@ class Gem::Installer
# (or use) a new bin dir under the gem_home.
@bin_dir = options[:bin_dir] || Gem.bindir(gem_home)
@development = options[:development]
+ @build_root = options[:build_root]
@build_args = options[:build_args] || Gem::Command.build_args
+
+ unless @build_root.nil?
+ require 'pathname'
+ @build_root = Pathname.new(@build_root).expand_path
+ @bin_dir = File.join(@build_root, options[:bin_dir] || Gem.bindir(@gem_home))
+ @gem_home = File.join(@build_root,@gem_home)
+ alert_warning "You build with buildroot.\n Build root: #{@build_root}\n Bin dir: #{@bin_dir}\n Gem home: #{@gem_home}"
+ end
end
# DOC: Missing docs or :nodoc:.
Index: lib/rubygems/install_update_options.rb
===================================================================
--- lib/rubygems/install_update_options.rb.orig
+++ lib/rubygems/install_update_options.rb
@@ -59,6 +59,12 @@ module Gem::InstallUpdateOptions
end
end
+ add_option(:"Install/Update", '--build-root DIR',
+ 'Temporary installation root. Useful for building',
+ 'packages. Do not use this when installing remote gems.') do |value, options|
+ options[:build_root] = File.expand_path(value)
+ end
+
add_option(:"Install/Update", '-N', '--no-document',
'Disable documentation generation') do |value, options|
options[:document] = []

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,150 +0,0 @@
#!/usr/bin/ruby
# Copyright (c) 2012 Stephan Kulow
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require 'optparse'
require 'rubygems'
#require 'rubygems/format'
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
file_match=".*/gems/[^/]*/specifications/.*\.gemspec$"
opts.on("-m", "--file-match REGEX", String,
"Override the regex against which the input file names",
"matched with the supplied regex") do |val|
file_match=val
end
in_file=nil
opts.on("-g", "--gemspec FILE", String,
"Take gemspec from FILE, not filename in STDIN",
"Can be a .gem file or a .gemspec file") do |file|
in_file=file
end
rest = opts.permute(ARGV)
unless provides || requires
exit(0)
end
def fatal(msg)
$stderr.puts msg
exit 1
end
def register_gemspec_from_file(gemspecs, rubyabi, file)
fatal "Couldn't read '#{file}'" unless File.readable? file
case file
when /\.gem$/
gem = Gem::Format.from_file_by_path(file)
fatal "Failed to load gem from '#{file}'" unless gem
spec = gem.spec
when /\.gemspec$/
spec = Gem::Specification.load(file)
fatal "Failed to load gem spec from '#{file}'" unless spec
else
fatal "'#{file}' must be a .gem or .gemspec file"
end
gemspecs << [ rubyabi, spec ]
end
def rubyabi_from_path(path)
m = path.match(%r{.*/gems/([^/]*)/.*})
return m ? m[1] : RbConfig::CONFIG["ruby_version"]
end
gemspecs = Array.new
if in_file
# This mode will not be used during actual rpm builds, but only by
# gem packagers for debugging / diagnostics, so that they can
# predict in advance what the dependencies will look like.
rubyabi = rubyabi_from_path(in_file) || '$RUBYABI'
register_gemspec_from_file(gemspecs, rubyabi, in_file)
else
$stdin.each_line do |line|
line.chomp!
m = line.match(%r{#{file_match}$})
if m
register_gemspec_from_file(gemspecs, rubyabi_from_path(line), line)
end
end
end
gemspecs.each do |rubyabi, spec|
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}"
if rubyabi
puts "rubygem(#{rubyabi}:#{spec.name}) = #{spec.version}"
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}) = #{spec.version}" if versions.length > 0
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}) = #{spec.version}" if versions.length > 1
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}.#{versions[2]}) = #{spec.version}" if versions.length > 2
end
end
if requires
puts "ruby(abi) = #{rubyabi}" if rubyabi
puts "rubygems" if rubyabi.to_f < 1.9
spec.runtime_dependencies.each do |dep|
dep.requirement.requirements.each do |r|
if r.first == '~>'
minversion = r.last.to_s.split('.')
versions = minversion[0,minversion.length-1]
# ~> 2 is pretty nonsense, so avoid being tricked
if versions.length > 0
if minversion[minversion.length-1] == '0'
# ~> 1.2.0 is the same as >= 1.2 for rpm and it avoids problems when 1.2 is followed by 1.2.1
minversion = versions
end
puts "rubygem(#{rubyabi}:#{dep.name}:#{versions.join('.')}) >= #{minversion.join('.')}"
else
puts "rubygem(#{rubyabi}:#{dep.name}) >= #{minversion.join('.')}"
end
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