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