2 # This package uses Bundler to download and install all gems in deployment
3 # mode (i.e. into isolated directory inside application). That's not PLD Linux
4 # way how it should be done, but GitLab has too many dependencies that it will
5 # be too difficult to maintain them via distro packages.
7 # install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.6/doc/install/installation.md
10 # - [timfel-krb5-auth] doesn't build with heimdal (https://github.com/timfel/krb5-auth/issues/8)
14 %bcond_with krb5 # build with kerberos support
15 %bcond_without gem_cache # use local cache to speedup gem installation
17 Summary: A Web interface to create projects and repositories, manage access and do code reviews
22 Group: Applications/WWW
23 # md5 deliberately omitted until this package is useful
24 Source0: https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz
25 Source1: gitlab.target
26 Source2: gitlab-sidekiq.service
27 Source3: gitlab-sidekiq.init
28 Source4: gitlab-unicorn.service
29 Source5: gitlab-unicorn.init
30 Source6: gitlab.logrotate
31 Source7: gitlab.tmpfiles.d
33 Source9: gitlab-rake.sh
35 Source11: gitlab-ctl.sh
36 Source12: clean-vendor.sh
40 URL: https://www.gitlab.com/gitlab-ce/
42 BuildRequires: gmp-devel
43 BuildRequires: libgit2-devel
44 BuildRequires: libicu-devel
45 BuildRequires: libstdc++-devel
46 BuildRequires: libxml2-devel
47 BuildRequires: mysql-devel
48 BuildRequires: postgresql-devel
49 BuildRequires: rpm-rubyprov
50 BuildRequires: rpmbuild(macros) >= 1.647
51 BuildRequires: ruby-bundler
52 BuildRequires: ruby-devel >= 1:2.1.0
53 BuildRequires: zlib-devel
54 Requires(post,preun): /sbin/chkconfig
56 Requires: git-core >= 2.7.4
57 Requires: gitlab-shell >= 3.2.1
60 Requires: ruby-bundler
61 Requires: systemd-units >= 0.38
63 Suggests: redis-server
64 Obsoletes: gitlab <= 8.1.4
65 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
67 %define _noautoreqfiles redcloth_scan.jar primitives.jar
71 %define homedir %{_localstatedir}/lib/gitlab
74 GitLab Community Edition (CE) is open source software to collaborate
75 on code. Create projects and repositories, manage access and do code
76 reviews. GitLab CE is on-premises software that you can install and
77 use on your server(s).
80 Summary: Manual for GitLab
81 Summary(fr.UTF-8): Documentation pour GitLab
82 Summary(it.UTF-8): Documentazione di GitLab
83 Summary(pl.UTF-8): Podręcznik dla GitLab
85 # noarch subpackages only when building with rpm5
86 %if "%{_rpmversion}" >= "5"
91 Documentation for GitLab.
94 %setup -qn gitlabhq-%{version}
95 mv config/gitlab.yml.example config/gitlab.yml
96 mv config/unicorn.rb.example config/unicorn.rb
101 mv config/database.yml.mysql config/database.yml
103 find -name .gitkeep | xargs rm
106 %if %{with gem_cache}
107 cachedir="%{_specdir}/cache/%{version}.%{_arch}"
108 install -d vendor/bundle
109 test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
112 bundle install %{_smp_mflags} \
115 --without development test aws %{!?with_krb5:kerberos}
117 # install newer rugged to fix diff view showing garbage
118 # https://gitlab.com/gitlab-org/gitlab-ce/issues/14972
120 test -d vendor/bundle/ruby/gems/rugged-$v || \
121 bundle exec gem install -v $v rugged --no-rdoc --no-ri --verbose
124 # use modified config so it doesn't croak
125 cp -p config/gitlab.yml{,.production}
126 sed -i -e '/secret_file:/d' config/gitlab.yml
127 sed -i -e 's#/home/git/repositories/#./#' config/gitlab.yml
128 bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
129 mv -f config/gitlab.yml{.production,}
131 # avoid bogus ruby dep
132 chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
134 # remove secrets, log and cache that assets compile initialized
135 rm .gitlab_shell_secret
137 rm config/secrets.yml
138 rm log/production.log
141 %if %{with gem_cache}
142 install -d "$cachedir"
143 cp -aul vendor/bundle/* "$cachedir"
147 rm -rf $RPM_BUILD_ROOT
149 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
150 $RPM_BUILD_ROOT%{homedir}/satellites \
151 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
152 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
153 $RPM_BUILD_ROOT%{_docdir}/gitlab \
154 $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
156 # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
157 if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
159 rm -f $RPM_BUILD_ROOT/VERSION
162 cp -a$l . $RPM_BUILD_ROOT%{homedir}
164 # cleanup unneccessary cruft (gem build files, etc)
165 sh -x %{SOURCE12} $RPM_BUILD_ROOT%{homedir}
167 # replace the contents, yet leave it believe it has proper version installed (for gem dependencies)
170 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-$ov
171 mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-{$v,$ov}
172 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-$ov
173 mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-{$v,$ov}
175 # rpm cruft from repackaging
176 rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
179 chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
180 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
183 rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
184 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
185 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
186 ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
188 # move $source to $target leaving symlink in original path
190 local source=$1 target=$2
191 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
192 ln -s $target $RPM_BUILD_ROOT$source
195 # Install config files
196 for f in gitlab.yml unicorn.rb database.yml; do
197 move_symlink %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
200 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/.gitconfig
201 ln -s %{_sysconfdir}/.gitconfig $RPM_BUILD_ROOT%{homedir}/.gitconfig
203 touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/skip-auto-migrations
205 # relocate to /etc as it's updated runtime, see 77cff54
206 move_symlink %{homedir}/db/schema.rb %{_sysconfdir}/gitlab/schema.rb
208 install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
209 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
211 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
212 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
213 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
214 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
216 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
217 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
218 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
219 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
220 install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
221 install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
224 rm -rf $RPM_BUILD_ROOT
227 if [ "$1" = "2" ]; then
228 # Looks like an RPM upgrade
233 /sbin/chkconfig --add gitlab-sidekiq
234 /sbin/chkconfig --add gitlab-unicorn
235 %service gitlab-sidekiq restart
236 %service gitlab-unicorn restart
237 %systemd_post gitlab-sidekiq.service gitlab-unicorn.service
239 %banner -e -o %{name} << EOF
241 Create and configure database in %{_sysconfdir}/gitlab/database.yml
244 # gitlab-rake gitlab:setup
249 if [ "$1" = "0" ]; then
250 # Looks like an RPM upgrade
255 if [ "$1" = "0" ]; then
256 %service -q gitlab-sidekiq stop
257 %service -q gitlab-unicorn stop
258 /sbin/chkconfig --del gitlab-sidekiq
259 /sbin/chkconfig --del gitlab-unicorn
261 %systemd_preun gitlab-sidekiq.service gitlab-unicorn.service
264 if [ $1 -eq 0 ]; then
271 %defattr(644,root,root,755)
273 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/database.yml
274 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab.yml
275 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/unicorn.rb
276 %config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/schema.rb
277 %config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/.gitconfig
278 %ghost %{_sysconfdir}/gitlab/skip-auto-migrations
279 %config(noreplace) %verify(not md5 mtime size) /etc/httpd/webapps.d/gitlab.conf
280 /etc/logrotate.d/gitlab.logrotate
281 %attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
282 %attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
283 %attr(755,root,root) %{_sbindir}/gitlab-rake
284 %attr(755,root,root) %{_sbindir}/gitlab-ctl
285 %{systemdunitdir}/gitlab-sidekiq.service
286 %{systemdunitdir}/gitlab-unicorn.service
287 %{systemdunitdir}/gitlab.target
288 %{systemdtmpfilesdir}/gitlab.conf
291 %{homedir}/.gitconfig
294 %attr(-,root,root) %{homedir}/bin/*
299 %{homedir}/generator_templates
302 %dir %{homedir}/public
304 %{homedir}/public/*.*
305 %attr(-,%{uname},%{gname}) %{homedir}/public/uploads
306 %attr(-,%{uname},%{gname}) %{homedir}/public/assets
307 %dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
309 %dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
310 %attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
311 %attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
312 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
313 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
314 %attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
316 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared
317 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
318 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
319 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
320 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
321 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
322 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
324 %dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
325 %attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
326 %attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
327 %attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
328 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
329 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
330 %attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
331 %attr(-,%{uname},%{gname}) %{homedir}/LICENSE
332 %attr(-,%{uname},%{gname}) %{homedir}/*.md
333 %attr(-,%{uname},%{gname}) %{homedir}/Rakefile
334 %attr(-,%{uname},%{gname}) %{homedir}/VERSION
335 %attr(-,%{uname},%{gname}) %{homedir}/config.ru
338 %dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
339 %dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
341 %defattr(-,root,root,-)
342 %dir %{homedir}/vendor
346 %defattr(644,root,root,755)