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