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

Josef Stribny jstribny at fedoraproject.org
Wed Nov 12 12:39:38 UTC 2014


commit 347187a2053a6d4201a3367a5c41da84deb67c34
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 f992d3d..45c4e9f 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: 1%{?dist}
+Release: 2%{?dist}
 Group: Development/Languages
 License: MIT
 URL: http://gembundler.com
@@ -19,9 +32,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
@@ -61,7 +74,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
@@ -101,6 +114,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}/.*
@@ -129,6 +156,9 @@ EOF` rspec spec/
 %doc %{gem_docdir}
 
 %changelog
+* Tue Nov 11 2014 Josef Stribny <jstribny at redhat.com> - 1.7.3-2
+- Use symlinks for vendored libraries (rhbz#1163039)
+
 * Mon Sep 22 2014 Josef Stribny <jstribny at redhat.com> - 1.7.3-1
 - Update to 1.7.3
 


More information about the scm-commits mailing list