[packages/gitlab-ce] improve gem install caching

glen glen at pld-linux.org
Sat Apr 16 01:41:01 CEST 2016


commit dc27d1e6672a7e2f5631d15d22c1eeece5746202
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Apr 16 02:39:48 2016 +0300

    improve gem install caching

 gitlab-ce.spec | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gitlab-ce.spec b/gitlab-ce.spec
index 4d9c5fd..fb052e7 100644
--- a/gitlab-ce.spec
+++ b/gitlab-ce.spec
@@ -12,7 +12,7 @@
 #
 # Conditional build:
 %bcond_with	krb5		# build with kerberos support
-%bcond_with	gem_cache	# build from local gem cache only (avoids network)
+%bcond_without	gem_cache	# use local to speedup gem installation
 
 Summary:	A Web interface to create projects and repositories, manage access and do code reviews
 Name:		gitlab-ce
@@ -85,15 +85,25 @@ rm .csscomb.json
 find -name .gitkeep | xargs rm
 
 %build
+%if %{with gem_cache}
+cachedir="%{_specdir}/cache/%{version}.%{_arch}"
+install -d vendor/bundle
+test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
+%endif
+
 bundle install %{_smp_mflags} \
 	--verbose \
-	%{?with_gem_cache:--local} \
-	%{?debug:--no-cache --no-prune} \
-	 --deployment --without development test aws %{!?with_krb5:kerberos}
+	--deployment \
+	--without development test aws %{!?with_krb5:kerberos}
 
 # avoid bogus ruby dep
 chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
 
+%if %{with gem_cache}
+install -d "$cachedir"
+cp -aul vendor/bundle/* "$cachedir"
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d \
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gitlab-ce.git/commitdiff/dc27d1e6672a7e2f5631d15d22c1eeece5746202



More information about the pld-cvs-commit mailing list