]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
8.14.2 (2016-12-01)
[packages/gitlab-ce.git] / gitlab-ce.spec
CommitLineData
1bfc7ca0
ER
1# NOTE:
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.
8f15c340 6#
a92c651e 7# install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.6/doc/install/installation.md
8f15c340 8#
1bfc7ca0
ER
9# TODO
10# - [timfel-krb5-auth] doesn't build with heimdal (https://github.com/timfel/krb5-auth/issues/8)
11#
12#
13# Conditional build:
14%bcond_with krb5 # build with kerberos support
9a13c814 15%bcond_without gem_cache # use local cache to speedup gem installation
1bfc7ca0 16
cde2eaab 17%define shell_version 4.0.0
38243d97 18%define workhorse_version 1.0.1
edff9e13
ER
19Summary: A Web interface to create projects and repositories, manage access and do code reviews
20Name: gitlab-ce
38243d97 21Version: 8.14.2
6fcca392 22Release: 0.81
edff9e13
ER
23License: MIT
24Group: Applications/WWW
3af24041 25# md5 deliberately omitted until this package is useful
7b6828be 26Source0: https://gitlab.com/gitlab-org/gitlab-ce/repository/archive.tar.bz2?ref=v%{version}&/%{name}-%{version}.tar.bz2
edff9e13
ER
27Source1: gitlab.target
28Source2: gitlab-sidekiq.service
7db376f0
ER
29Source3: gitlab-sidekiq.init
30Source4: gitlab-unicorn.service
31Source5: gitlab-unicorn.init
32Source6: gitlab.logrotate
33Source7: gitlab.tmpfiles.d
b647c30f 34Source8: apache.conf
6ba051e8 35Source9: gitlab-rake.sh
e29cce1b 36Source10: gitconfig
e62d7f31 37Source11: gitlab-ctl.sh
f802be87 38Source12: clean-vendor.sh
98a1e18d 39Source13: nginx.conf
e62d7f31
ER
40Patch0: 3774.patch
41Patch1: pld.patch
6fcca392 42Patch2: post_receive-any-email.patch
c06de8c3 43URL: https://www.gitlab.com/gitlab-ce/
99acef11 44BuildRequires: cmake
b70ed759 45BuildRequires: gmp-devel
8b1af143 46BuildRequires: libgit2-devel
99acef11
ER
47BuildRequires: libicu-devel
48BuildRequires: libstdc++-devel
49BuildRequires: libxml2-devel
99acef11
ER
50BuildRequires: mysql-devel
51BuildRequires: postgresql-devel
8b1af143 52BuildRequires: rpm-rubyprov
e4654b76 53BuildRequires: rpmbuild(macros) >= 1.647
edff9e13 54BuildRequires: ruby-bundler
b70ed759 55BuildRequires: ruby-devel >= 1:2.1.0
99acef11 56BuildRequires: zlib-devel
e17ca829 57Requires(post,preun): /sbin/chkconfig
6f80237a 58Requires: git-core >= 2.7.4
e2b8e51a 59Requires: gitlab-common >= 8.12-2
ae01e8f0
ER
60Requires: gitlab-shell >= %{shell_version}
61Requires: gitlab-workhorse >= %{workhorse_version}
0f5b396e 62Requires: nodejs
e17ca829 63Requires: rc-scripts
edff9e13 64Requires: ruby-bundler
e4654b76 65Requires: systemd-units >= 0.38
7b6828be 66Requires: webapps
1bfc7ca0
ER
67Suggests: mysql
68Suggests: redis-server
63c66c76 69Obsoletes: gitlab <= 8.1.4
edff9e13
ER
70BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
71
a92c651e
ER
72%define _noautoreqfiles redcloth_scan.jar primitives.jar
73
cb878643
ER
74%define uname git
75%define gname git
76%define appdir %{_prefix}/lib/gitlab
77%define vardir %{_localstatedir}/lib/gitlab
78%define cachedir %{_localstatedir}/cache/gitlab
79%define _webapps /etc/webapps
80%define _webapp gitlab
edff9e13
ER
81
82%description
83GitLab Community Edition (CE) is open source software to collaborate
84on code. Create projects and repositories, manage access and do code
85reviews. GitLab CE is on-premises software that you can install and
86use on your server(s).
87
54f50e6d
ER
88%package doc
89Summary: Manual for GitLab
90Summary(fr.UTF-8): Documentation pour GitLab
91Summary(it.UTF-8): Documentazione di GitLab
92Summary(pl.UTF-8): Podręcznik dla GitLab
93Group: Documentation
94# noarch subpackages only when building with rpm5
95%if "%{_rpmversion}" >= "5"
96BuildArch: noarch
97%endif
98
99%description doc
100Documentation for GitLab.
101
edff9e13 102%prep
7b6828be
ER
103%setup -qc
104mv gitlab-ce-v%{version}-*/{.??*,*} .
c06de8c3
ER
105mv config/gitlab.yml.example config/gitlab.yml
106mv config/unicorn.rb.example config/unicorn.rb
575e60f5 107#%patch0 -p1
c06de8c3 108%patch1 -p1
6fcca392 109%patch2 -p1
b262a96c 110
e3e185ca
ER
111# use mysql for now
112mv config/database.yml.mysql config/database.yml
113
d6fb12dc 114find -name .gitkeep | xargs rm
99acef11 115
ae01e8f0
ER
116v=$(cat GITLAB_SHELL_VERSION)
117test "$v" = "%{shell_version}"
118v=$(cat GITLAB_WORKHORSE_VERSION)
119test "$v" = "%{workhorse_version}"
120
62a51cfa 121%build
dc27d1e6
ER
122%if %{with gem_cache}
123cachedir="%{_specdir}/cache/%{version}.%{_arch}"
124install -d vendor/bundle
125test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
126%endif
127
1924cc20
ER
128# enable-gems to workaround https://github.com/ruby-prof/ruby-prof/pull/191
129# until https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6026 is merged
130RUBYOPT=--enable-gems \
edff9e13 131bundle install %{_smp_mflags} \
7470b5a8 132 --verbose \
dc27d1e6
ER
133 --deployment \
134 --without development test aws %{!?with_krb5:kerberos}
edff9e13 135
9a13c814
ER
136# install newer rugged to fix diff view showing garbage
137# https://gitlab.com/gitlab-org/gitlab-ce/issues/14972
56adf52c 138v=0.25.0b7
de0b0023 139test -d vendor/bundle/ruby/gems/rugged-$v || \
f1534eb2 140bundle exec gem install -v $v rugged --no-rdoc --no-ri --verbose
9a13c814 141
575e60f5
ER
142# precompile assets
143# use modified config so it doesn't croak
ea8d688f
ER
144cp -p config/gitlab.yml{,.production}
145sed -i -e '/secret_file:/d' config/gitlab.yml
59a3a088 146sed -i -e 's#/var/lib/gitlab/repositories/#./#' config/gitlab.yml
a5202e18 147bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 148mv -f config/gitlab.yml{.production,}
a3c02bfc 149
a92c651e
ER
150# avoid bogus ruby dep
151chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
152
a3c02bfc
ER
153# remove secrets, log and cache that assets compile initialized
154rm .gitlab_shell_secret
5ce23bfa 155cp -f config/secrets.yml{.example,}
a3c02bfc
ER
156rm log/production.log
157rm -r tmp/cache/*
158
dc27d1e6
ER
159%if %{with gem_cache}
160install -d "$cachedir"
161cp -aul vendor/bundle/* "$cachedir"
162%endif
163
edff9e13
ER
164%install
165rm -rf $RPM_BUILD_ROOT
166install -d \
044510e0
ER
167 $RPM_BUILD_ROOT%{appdir}/public/{assets,uploads} \
168 $RPM_BUILD_ROOT%{appdir}/satellites \
169 $RPM_BUILD_ROOT%{appdir}/tmp/{cache/assets,sessions,backups} \
edff9e13 170 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
cb878643 171 $RPM_BUILD_ROOT%{_webapps}/%{_webapp} \
6eb5e245 172 $RPM_BUILD_ROOT%{_docdir}/gitlab \
001a6cf5 173 $RPM_BUILD_ROOT%{vardir}/public \
0f95858b 174 $RPM_BUILD_ROOT%{cachedir}/tmp \
e2b8e51a 175 $RPM_BUILD_ROOT%{_localstatedir}/run/gitlab
edff9e13 176
b262a96c
ER
177# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
178if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
179 l=l
180 rm -f $RPM_BUILD_ROOT/VERSION
181fi
182
044510e0 183cp -a$l . $RPM_BUILD_ROOT%{appdir}
edff9e13 184
f802be87 185# cleanup unneccessary cruft (gem build files, etc)
044510e0 186sh -x %{SOURCE12} $RPM_BUILD_ROOT%{appdir}
f802be87 187
c5b62b37 188# replace the contents, yet leave it believe it has proper version installed (for gem dependencies)
56adf52c 189v=0.25.0b7
c5b62b37 190ov=0.24.0
044510e0
ER
191rm -r $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-$ov
192mv $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-{$v,$ov}
193rm -r $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/gems/rugged-$ov
194mv $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/gems/rugged-{$v,$ov}
c5b62b37 195
fb518a6f 196# rpm cruft from repackaging
044510e0 197rm -f $RPM_BUILD_ROOT%{appdir}/debug*.list
fb518a6f 198
edff9e13 199# Creating links
044510e0
ER
200rmdir $RPM_BUILD_ROOT%{appdir}/{log,tmp/{pids,sockets}}
201ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{appdir}/tmp/pids
202ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{appdir}/tmp/sockets
203ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{appdir}/log
edff9e13 204
ed85de46
ER
205# move $source to $target leaving symlink in original path
206move_symlink() {
fb518a6f
ER
207 local source=$1 target=$2
208 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
209 ln -s $target $RPM_BUILD_ROOT$source
210}
211
edff9e13 212# Install config files
cc64ce98 213for f in gitlab.yml unicorn.rb database.yml secrets.yml; do
044510e0 214 move_symlink %{appdir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13 215done
b8aa93cf 216move_symlink %{appdir}/.gitlab_workhorse_secret %{_sysconfdir}/gitlab/.gitlab_workhorse_secret
a1aafd5d 217
ed85de46 218cp -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/.gitconfig
bdb8455f 219ln -s %{_sysconfdir}/gitlab/.gitconfig $RPM_BUILD_ROOT%{vardir}/.gitconfig
ed85de46 220
c4379f31 221touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 222
a1aafd5d 223# relocate to /etc as it's updated runtime, see 77cff54
044510e0 224move_symlink %{appdir}/db/schema.rb %{_sysconfdir}/gitlab/schema.rb
a1aafd5d 225
a630f38b 226for a in satellites builds shared tmp public/{uploads,assets}; do
044510e0 227 move_symlink %{appdir}/$a %{vardir}/$a
001a6cf5
ER
228done
229
0f95858b
ER
230move_symlink %{vardir}/tmp/cache %{cachedir}/cache
231move_symlink %{vardir}/shared/artifacts/tmp/cache %{cachedir}/artifacts
232
6ba051e8 233install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 234 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 235
c7ba61b6 236cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
237install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
238cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
239install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
240
241cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
242cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
e2b8e51a 243cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab
cb878643 244cp -p %{SOURCE8} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
6ba051e8 245install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
e62d7f31 246install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
edff9e13
ER
247
248%clean
9a13c814 249rm -rf $RPM_BUILD_ROOT
edff9e13 250
a6fcdc58 251%pre
d5651fee 252if [ "$1" = "2" ]; then
a6fcdc58
ER
253 # Looks like an RPM upgrade
254 gitlab-ctl preinst
255fi
256
edff9e13 257%post
e17ca829
ER
258/sbin/chkconfig --add gitlab-sidekiq
259/sbin/chkconfig --add gitlab-unicorn
260%service gitlab-sidekiq restart
261%service gitlab-unicorn restart
e4654b76 262%systemd_post gitlab-sidekiq.service gitlab-unicorn.service
e17ca829 263
e4654b76
ER
264%banner -e -o %{name} << EOF
265
266Create and configure database in %{_sysconfdir}/gitlab/database.yml
267
268Then run:
269 # gitlab-rake gitlab:setup
270
271EOF
edff9e13 272
a6fcdc58
ER
273%posttrans
274if [ "$1" = "0" ]; then
275 # Looks like an RPM upgrade
276 gitlab-ctl posttrans
277fi
278
e17ca829
ER
279%preun
280if [ "$1" = "0" ]; then
281 %service -q gitlab-sidekiq stop
282 %service -q gitlab-unicorn stop
283 /sbin/chkconfig --del gitlab-sidekiq
284 /sbin/chkconfig --del gitlab-unicorn
285fi
e4654b76 286%systemd_preun gitlab-sidekiq.service gitlab-unicorn.service
e17ca829 287
edff9e13
ER
288%postun
289if [ $1 -eq 0 ]; then
290 %userremove gitlab
291 %groupremove gitlab
292fi
e4654b76 293%systemd_reload
edff9e13 294
cb878643
ER
295%triggerin -- apache < 2.2.0, apache-base
296%webapp_register httpd %{_webapp}
297
298%triggerun -- apache < 2.2.0, apache-base
299%webapp_unregister httpd %{_webapp}
300
edff9e13
ER
301%files
302%defattr(644,root,root,755)
303%doc LICENSE
c4379f31
ER
304%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/database.yml
305%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab.yml
306%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/unicorn.rb
7e1429dd 307%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/schema.rb
5ce23bfa 308%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/secrets.yml
ed85de46 309%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/.gitconfig
b8aa93cf
ER
310%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/.gitlab_workhorse_secret
311
cb878643
ER
312%dir %attr(750,root,http) %{_webapps}/%{_webapp}
313%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
314
c4379f31 315%ghost %{_sysconfdir}/gitlab/skip-auto-migrations
e2b8e51a 316/etc/logrotate.d/gitlab
7db376f0
ER
317%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
318%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 319%attr(755,root,root) %{_sbindir}/gitlab-rake
e62d7f31 320%attr(755,root,root) %{_sbindir}/gitlab-ctl
edff9e13
ER
321%{systemdunitdir}/gitlab-sidekiq.service
322%{systemdunitdir}/gitlab-unicorn.service
323%{systemdunitdir}/gitlab.target
324%{systemdtmpfilesdir}/gitlab.conf
ed85de46 325
044510e0
ER
326%dir %{appdir}
327%dir %{appdir}/bin
328%attr(-,root,root) %{appdir}/bin/*
001a6cf5 329# files
044510e0
ER
330%{appdir}/*.md
331%{appdir}/.bundle
b8aa93cf 332%{appdir}/.gitlab_workhorse_secret
044510e0 333%{appdir}/.ruby-version
044510e0
ER
334%{appdir}/GITLAB_SHELL_VERSION
335%{appdir}/GITLAB_WORKHORSE_VERSION
336%{appdir}/Gemfile*
337%{appdir}/LICENSE
338%{appdir}/Rakefile
339%{appdir}/VERSION
340%{appdir}/config.ru
001a6cf5
ER
341
342# dirs
044510e0
ER
343%{appdir}/app
344%{appdir}/builds
345%{appdir}/config
346%{appdir}/db
347%{appdir}/fixtures
348%{appdir}/generator_templates
349%{appdir}/lib
350%{appdir}/log
351%{appdir}/public
352%{appdir}/shared
353%{appdir}/tmp
354%{appdir}/satellites
001a6cf5 355
bdb8455f 356%{vardir}/.gitconfig
001a6cf5 357%dir %attr(755,%{uname},%{gname}) %{vardir}/satellites
a630f38b 358%dir %attr(755,%{uname},%{gname}) %{vardir}/builds
7ae6188a 359%dir %{vardir}/public
001a6cf5
ER
360%attr(-,%{uname},%{gname}) %{vardir}/public/uploads
361%attr(-,%{uname},%{gname}) %{vardir}/public/assets
362%dir %attr(755,%{uname},%{gname}) %{vardir}/tmp
363%attr(-,%{uname},%{gname}) %{vardir}/tmp/backups
0f95858b 364%{vardir}/tmp/cache
001a6cf5
ER
365%attr(-,%{uname},%{gname}) %{vardir}/tmp/sessions
366%attr(-,%{uname},%{gname}) %{vardir}/tmp/sockets
367%attr(-,%{uname},%{gname}) %{vardir}/tmp/pids
368%dir %attr(750,%{uname},%{gname}) %{vardir}/shared
369%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/artifacts
370%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/artifacts/tmp
0f95858b 371%{vardir}/shared/artifacts/tmp/cache
001a6cf5
ER
372%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/artifacts/tmp/uploads
373%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/lfs-objects
374%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/registry
375
0f95858b
ER
376%dir %attr(750,root,%{gname}) %{cachedir}
377%attr(-,%{uname},%{gname}) %{cachedir}/cache
378%dir %attr(750,%{uname},%{gname}) %{cachedir}/artifacts
7ae6188a 379
bab42173 380%dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
e4edb538 381
580f84c4 382%defattr(-,root,root,-)
044510e0
ER
383%dir %{appdir}/vendor
384%{appdir}/vendor/*
54f50e6d
ER
385
386%files doc
387%defattr(644,root,root,755)
044510e0 388%{appdir}/doc
This page took 0.120412 seconds and 4 git commands to generate.