[rubygem-bundler/f20] Use symlinks for vendored libraries (rhbz#1163039)

Josef Stribny jstribny at fedoraproject.org
Wed Nov 12 13:07:25 UTC 2014


commit 57f4eba2a0da238b8a59e0ce6227a5e2653a454d
Author: Josef Stribny <jstribny at redhat.com>
Date:   Wed Nov 12 12:29:36 2014 +0100

    Use symlinks for vendored libraries (rhbz#1163039)

 rubygem-bundler.spec |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/rubygem-bundler.spec b/rubygem-bundler.spec
index fd0a16b..6809735 100644
--- a/rubygem-bundler.spec
+++ b/rubygem-bundler.spec
@@ -2,10 +2,23 @@
 
 %{!?enable_test: %global enable_test 0}
 
+# Macro for symlinking system RubyGems as a replacement for removed vendored libs
+%global symlink_vendored_libs \
+for dependency in \\\
+  net-http-persistent \\\
+  thor \
+do \
+  for fileordir in \\\
+    %{gem_dir}/gems/$dependency-*/lib/* \
+  do \
+    ln -s -f $fileordir %{gem_libdir}/bundler/vendor/$(basename "$fileordir") \
+  done \
+done
+
 Summary: Library and utilities to manage a Ruby application's gem dependencies
 Name: rubygem-%{gem_name}
 Version: 1.7.3
-Release: 2%{?dist}
+Release: 3%{?dist}
 Group: Development/Languages
 License: MIT
 URL: http://gembundler.com
@@ -20,9 +33,9 @@ BuildRequires: rubygems-devel
 BuildRequires: ruby
 %if 0%{enable_test} > 0
 BuildRequires: ruby-devel
+BuildRequires: rubygem(rspec)
 BuildRequires: rubygem(thor)
 BuildRequires: rubygem(net-http-persistent)
-BuildRequires: rubygem(rspec)
 BuildRequires: rubygem(psych)
 BuildRequires: git sudo
 %endif
@@ -66,7 +79,7 @@ find %{buildroot}%{gem_instdir}/lib/bundler/templates/newgem/bin -type f | xargs
 chmod 755 %{buildroot}%{gem_instdir}/lib/bundler/templates/Executable*
 
 # Remove bundled libraries
-rm -rf %{buildroot}/%{gem_libdir}/bundler/vendor
+rm -rf %{buildroot}%{gem_libdir}/bundler/vendor/*
 
 # Man pages are used by Bundler internally, do not remove them!
 mkdir -p %{buildroot}%{_mandir}/man5
@@ -106,6 +119,20 @@ EOF` rspec spec/
 
 %endif
 
+%post
+# Create symlinks to system RubyGems as a replacement for vendored libs
+# See rhbz#1163039
+%symlink_vendored_libs
+
+%postun
+# Remove the symlinks for vendored libs after uninstallation
+rm -f %{gem_libdir}/bundler/vendor/*
+
+%triggerpostun -- rubygem-thor, rubygem-net-http-persistent
+# We need to recreate the symlinks after the old package of vendored lib
+# has been removed, not before
+%symlink_vendored_libs
+
 %files
 %dir %{gem_instdir}
 %exclude %{gem_instdir}/.*
@@ -134,6 +161,9 @@ EOF` rspec spec/
 %doc %{gem_docdir}
 
 %changelog
+* Tue Nov 11 2014 Josef Stribny <jstribny at redhat.com> - 1.7.3-3
+- Use symlinks for vendored libraries (rhbz#1163039)
+
 * Thu Oct 16 2014 Josef Stribny <jstribny at redhat.com> - 1.7.3-2
 - Fix: load extensions correctly for both old and new RubyGems
 


More information about the scm-commits mailing list