Blob Blame History Raw
# Upstream git:
# https://github.com/rubygems/rubygems.git
#

# The RubyGems library has to stay out of Ruby directory three, since the
# RubyGems should be share by all Ruby implementations.
%global rubygems_dir %{_datadir}/rubygems

# Specify custom RubyGems root and other related macros.
%global gem_dir %{_datadir}/gems
# TODO: These folders should go into rubygem-filesystem but how to achieve it,
# since noarch package cannot provide arch dependent subpackages?
# http://rpm.org/ticket/78
%global gem_extdir %{_exec_prefix}/lib{,64}/gems

# Executing testsuite (enabling %%check section) will cause dependency loop.
# To avoid dependency loop when necessary, please set the following value to 0
%global	enable_check	1

# It cannot be relied on %%{_libdir} for noarch packages. Query Ruby for
# the right value.
# https://fedorahosted.org/rel-eng/ticket/5257
%{!?buildtime_libdir:%global buildtime_libdir $(ruby -rrbconfig -e 'puts RbConfig::CONFIG["libdir"]')}

Summary:	The Ruby standard for packaging ruby libraries
Name:		rubygems
Version:	2.0.0
# Bump release for now
Release:	101%{?dist}
Group:		Development/Libraries
License:	Ruby or MIT

URL:		https://rubygems.org/
Source0:	http://production.cf.rubygems.org/rubygems/%{name}-%{version}.tgz

# Sources from the works by Vít Ondruch <vondruch@redhat.com>
# Please keep Source100 and Patch{109,113,114} in sync with ruby.spec

Source100:	operating_system.rb

# Will discuss upstream
# https://github.com/rubygems/rubygems/issues/120
# rubygems-Patches-28631
#Patch1:		rubygems-1.8.6-show-extension-build-process-in-sync.patch
# rubygems-Patches-29049
# https://github.com/rubygems/rubygems/issues/118
#Patch3:		rubygems-1.8.5-show-rdoc-process-verbosely.patch
# Fix Gem.all_load_paths (although it is deprecated and will be removed
# on 2011-10-01)

# Add support for installing binary extensions according to FHS.
# https://github.com/rubygems/rubygems/issues/210
# Note that 8th patch might be resolved by
# https://bugs.ruby-lang.org/issues/7897
Patch109: rubygems-2.0.0-binary-extensions.patch
# This slightly changes behavior of "gem install --install-dir" behavior.
# Without this patch, Specifications.dirs is modified and gems installed on
# the system cannot be required anymore. This causes later issues when RDoc
# documentation should be generated, since json gem is sudenly not accessible.
# https://github.com/rubygems/rubygems/pull/452
Patch113: rubygems-2.0.0-Do-not-modify-global-Specification.dirs-during-insta.patch
# This prevents issues, when ruby configuration specifies --with-ruby-version=''.
# https://github.com/rubygems/rubygems/pull/455
Patch114: rubygems-2.0.0-Fixes-for-empty-ruby-version.patch


Requires:	ruby(release)
Requires:	rubygem(rdoc) >= 4.0.0
Requires:	rubygem(io-console) >= 0.4.1
Requires:	rubygem(psych) >= 2.0.0
Requires:	ca-certificates
BuildRequires:	ruby(release) = 2.0.0
%if %{enable_check}
# For mkmf.rb
BuildRequires:	ruby-devel
BuildRequires:	rubygem(minitest)
BuildRequires:	rubygem(rake)
BuildRequires:	rubygem(rdoc) >= 4.0.0
BuildRequires:	rubygem(io-console) >= 0.4.1
BuildRequires:	rubygem(psych) >= 2.0.0
%endif
# Unbundle cert.pem
BuildRequires:	ca-certificates
BuildArch:	noarch
Provides:	ruby(rubygems) = %{version}-%{release}
Provides:   gem = %{version}-%{release}

%description
RubyGems is the Ruby standard for publishing and managing third party
libraries.

%package 	devel
Summary:	Macros and development tools for packagin RubyGems
Group:		Development/Libraries
License:	Ruby or MIT
Requires:	%{name} = %{version}-%{release}
BuildArch:	noarch

%description	devel
Macros and development tools for packagin RubyGems.

%package	doc
Summary:	Documentation for %{name}
Group:		Development/Libraries
License:	Ruby or MIT
Requires:	%{name} = %{version}-%{release}
BuildArch:	noarch

%description	doc
Documentation for %{name}

%prep
%setup -q
#%%patch0 -p1 -b .noarch
%if 1
#%%patch1 -p1 -b .insync
#%%patch3 -p1 -b .rdoc_v
#%%patch6 -p1 -b .load_path
%endif
%patch109 -p1 -b .109
%patch113 -p1 -b .113
%patch114 -p1 -b .114

# Some of the library files start with #! which rpmlint doesn't like
# and doesn't make much sense
for f in `find lib -name \*.rb` ; do
  head -1 $f | grep -q '^#!/usr/bin/env ruby' && sed -i -e '1d' $f
done

%build
# Nothing

%install
# LANG=C does not work
env \
    LANG=en_US.UTF-8 \
    GEM_HOME=%{buildroot}/%{gem_dir} \
    ruby setup.rb \
%if 0
    --rdoc \
%endif
    --prefix=/ \
        --destdir=%{buildroot}/%{rubygems_dir}/

mkdir -p %{buildroot}/%{_bindir}
mv %{buildroot}/%{rubygems_dir}/bin/gem %{buildroot}/%{_bindir}/gem
rm -rf %{buildroot}/%{rubygems_dir}/bin

mv %{buildroot}/%{rubygems_dir}/lib/* %{buildroot}/%{rubygems_dir}/.
# No longer needed
rmdir %{buildroot}%{rubygems_dir}/lib

# Install custom operating_system.rb.
mkdir -p %{buildroot}%{rubygems_dir}/rubygems/defaults
install -cpm 0644 %{SOURCE100} %{buildroot}%{rubygems_dir}/rubygems/defaults/

# Kill bundled cert.pem
mkdir -p %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/
ln -sf %{_sysconfdir}/pki/tls/cert.pem \
	%{buildroot}%{rubygems_dir}/rubygems/ssl_certs/ca-bundle.pem

# Create gem folders.
mkdir -p %{buildroot}%{gem_dir}/{cache,gems,specifications,doc}
mkdir -p %{buildroot}%{gem_extdir}/ruby

# Create macros.rubygems file for rubygems-devel
mkdir -p %{buildroot}%{_sysconfdir}/rpm

cat >> %{buildroot}%{_sysconfdir}/rpm/macros.rubygems << \EOF
# The RubyGems root folder.
%%gem_dir %{gem_dir}

# Common gem locations and files.
%%gem_instdir %%{gem_dir}/gems/%%{gem_name}-%%{version}
%%gem_extdir %%{_libdir}/gems/ruby/%%{gem_name}-%%{version}
%%gem_libdir %%{gem_instdir}/lib
%%gem_cache %%{gem_dir}/cache/%%{gem_name}-%%{version}.gem
%%gem_spec %%{gem_dir}/specifications/%%{gem_name}-%%{version}.gemspec
%%gem_docdir %%{gem_dir}/doc/%%{gem_name}-%%{version}

# Install gem into appropriate directory.
# -n<gem_file>      Overrides gem file name for installation.
# -d<install_dir>   Set installation directory.
%%gem_install(d:n:) \
mkdir -p %%{-d*}%%{!?-d:.%%{gem_dir}} \
\
CONFIGURE_ARGS="--with-cflags='%%{optflags}' $CONFIGURE_ARGS" \\\
gem install \\\
        -V \\\
        --local \\\
        --install-dir %%{-d*}%%{!?-d:.%%{gem_dir}} \\\
        --bindir .%%{_bindir} \\\
        --force \\\
        --document=ri,rdoc \\\
        %%{-n*}%%{!?-n:%%{gem_name}-%%{version}.gem}
EOF

# Create below
mkdir -p %{buildroot}%{gem_dir}/specifications/default

%if %{enable_check}
%check
# Create an empty operating_system.rb, so that the system's one doesn't get used,
# otherwise the test suite fails.
mkdir -p lib/rubygems/defaults
touch lib/rubygems/defaults/operating_system.rb

# It is necessary to specify the paths using RUBYOPT to let the test suite pass."
export GEM_PATH=%{gem_dir}
RUBYOPT="-Itest -Ilib" 
RUBYOPT="$RUBYOPT -I%{buildtime_libdir}/gems/exts/io-console-0.4.1/lib/"
RUBYOPT="$RUBYOPT -I%{gem_dir}/gems/json-1.7.7/lib"
RUBYOPT="$RUBYOPT -I%{buildtime_libdir}/gems/ruby/json-1.7.7/lib"
RUBYOPT="$RUBYOPT -I%{gem_dir}/gems/psych-2.0.0/lib"
RUBYOPT="$RUBYOPT -I%{buildtime_libdir}/gems/ruby/psych-2.0.0/lib"
export RUBYOPT

#DEBUG:   1) Failure:
#DEBUG: test_build_extensions_extconf_bad(TestGemInstaller) 
#[/builddir/build/BUILD/rubygems-2.0.0/test/rubygems/test_gem_installer.rb:86]:
#DEBUG: Expected /\/usr\/bin\/ruby: No such file/ to match 
#"/usr/bin/ruby extconf.rb\n/usr/bin/ruby-mri: No such file or directory -- extconf.rb (LoadError)\n".
#DEBUG: 1207 tests, 3731 assertions, 1 failures, 0 errors, 3 skips
testrb test || testrb test -x test_gem_installer.rb
%endif

%files
%doc README* 
%doc History.txt
%doc MIT.txt LICENSE.txt
%dir %{gem_dir}
%dir %{gem_dir}/build_info
%dir %{gem_dir}/cache
%dir %{gem_dir}/gems
%dir %{gem_dir}/specifications
%dir %{gem_dir}/specifications/default
%{_bindir}/gem

%dir %{rubygems_dir}/
# The following directory is killed on rubygem 2.0.0!!
#%%{rubygems_dir}/rbconfig/
%{rubygems_dir}/rubygems/
%{rubygems_dir}/rubygems.rb
%{rubygems_dir}/ubygems.rb
%{rubygems_dir}/gauntlet_rubygems.rb

%dir %{_exec_prefix}/lib/gems
%dir %{_exec_prefix}/lib64/gems
%dir %{_exec_prefix}/lib/gems/ruby
%dir %{_exec_prefix}/lib64/gems/ruby

%files	devel
%config(noreplace)  %{_sysconfdir}/rpm/macros.rubygems

%files	doc
%doc %{gem_dir}/doc


%changelog
* Mon Feb 25 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.0.0-101
- Split out ri-generated documentation

* Mon Feb 25 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.0.0-100
- Update to 2.0.0

* Mon Feb 25 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.8.25-3
- Backport %%gem_install macro

* Tue Feb  5 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.8.25-2
- Fix rubygem(json) path

* Tue Feb  5 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.8.25-1
- 1.8.25

* Tue Feb  5 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.8.24-4
- Bump release

* Wed Sep 05 2012 Vít Ondruch <vondruch@redhat.com> - 1.8.24-3
- Fixed Fedora 18 mass rebuild issue.

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.24-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Apr 28 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.24-1
- 1.8.24

* Sat Apr 21 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.23-20
- 1.8.23
- Use system-wide cert.pem

* Thu Apr 18 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.22-1
- 1.8.22

* Thu Jan 26 2012 Vít Ondruch <vondruch@redhat.com> - 1.8.15-2
- Make test suite green.

* Thu Jan 26 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.15-1
- 1.8.15

* Thu Jan 26 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.11-10
- Incorpolate works by Vít Ondruch <vondruch@redhat.com>
  made for ruby 1.9.x

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Nov 11 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.11-1
- 1.8.11

* Sun Aug 28 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.10-1
- 1.8.10

* Thu Aug 25 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.9-1
- 1.8.9

* Sun Aug 21 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.8-1
- 1.8.8

* Sat Aug  6 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.7-1
- 1.8.7

* Wed Jul 27 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.6-1
- 1.8.6

* Sat Jun 25 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.5-2
- Fix Gem.latest_load_paths (for rubygem-gettext FTBFS)
- Fix Gem.all_load_paths (for rubygem-gettext FTBFS, although it is already
  deprecated from 1.7.0)

* Wed Jun  1 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.8.5-1
- Try 1.8.5

* Tue May 24 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.7.2-2
- Handle gemspec file with containing "invalid" date format
  generated with psych (ref: bug 706914)

* Sat Apr 30 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.7.2-1
- Update to 1.7.2

* Sat Mar 12 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.6.2-1
- Update to 1.6.2

* Fri Mar  4 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.6.1-1
- Update to 1.6.1
- Patch2, 4 upstreamed

* Thu Mar  3 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.6.0-1
- Update to 1.6.0

* Sun Feb 27 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 1.5.3-1
- Update to 1.5.3

* Sun Feb 20 2011 Mamoru Tasaka <mtasaka@fedorapeople.org> - 1.5.2-1
- Update to 1.5.2
- Show rdoc process verbosely in verbose mode

* Fri Feb 11 2011 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.5.0-2
- Modify in-sync patch to keep the original behavior (for testsuite)
- Patch to make testsuite succeed, enabling testsuite

* Thu Feb 10 2011 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.5.0-1
- Update to 1.5.0

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Oct  8 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.3.7-2
- Show build process of extension library in sync

* Mon May 17 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.3.7-1
- Update to 1.3.7, dropping upstreamed patch

* Wed Apr 28 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.3.6-1
- Update to 1.3.6
- Show prefix with gem contents by default as shown in --help

* Mon Sep 21 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.3.5-1
- Update to 1.3.5

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sun Nov 09 2008 Jeroen van Meeuwen <kanarip@kanarip.com> - 1.3.1-1
- New upstream version

* Tue Sep 16 2008 David Lutterkort <dlutter@redhat.com> - 1.2.0-2
- Bump release because I forgot to check in newer patch

* Tue Sep 16 2008 David Lutterkort <dlutter@redhat.com> - 1.2.0-1
- Updated for new setup.rb
- Simplified by removing conditionals that were needed for EL-4;
  there's just no way we can support that with newer rubygems

* Wed Sep  3 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0.9.4-2
- fix license tag

* Fri Jul 27 2007 David Lutterkort <dlutter@redhat.com> - 0.9.4-1
- Conditionalize so it builds on RHEL4

* Tue Feb 27 2007 David Lutterkort <dlutter@redhat.com> - 0.9.2-1
- New version
- Add patch0 to fix multilib sensitivity of Gem::dir (bz 227400)

* Thu Jan 18 2007 David Lutterkort <dlutter@redhat.com> - 0.9.1-1
- New version; include LICENSE.txt and GPL.txt
- avoid '..' in gem_dir to work around a bug in gem installer
- add ruby-rdoc to requirements

* Tue Jan  2 2007 David Lutterkort <dlutter@redhat.com> - 0.9.0-2
- Fix gem_dir to be arch independent
- Mention dual licensing in License field

* Fri Dec 22 2006 David Lutterkort <dlutter@redhat.com> - 0.9.0-1
- Updated to 0.9.0
- Changed to agree with Fedora Extras guidelines

* Mon Jan  9 2006 David Lutterkort <dlutter@redhat.com> - 0.8.11-1
- Updated for 0.8.11

* Sun Oct 10 2004 Omar Kilani <omar@tinysofa.org> 0.8.1-1ts
- First version of the package