]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
up to 8.8.5
[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
dc27d1e6 15%bcond_without gem_cache # use local to speedup gem installation
1bfc7ca0 16
edff9e13
ER
17Summary: A Web interface to create projects and repositories, manage access and do code reviews
18Name: gitlab-ce
23735c26 19Version: 8.8.5
9e34f17e 20Release: 0.37
edff9e13
ER
21License: MIT
22Group: Applications/WWW
3af24041 23# md5 deliberately omitted until this package is useful
1bfc7ca0 24Source0: https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz
edff9e13
ER
25Source1: gitlab.target
26Source2: gitlab-sidekiq.service
7db376f0
ER
27Source3: gitlab-sidekiq.init
28Source4: gitlab-unicorn.service
29Source5: gitlab-unicorn.init
30Source6: gitlab.logrotate
31Source7: gitlab.tmpfiles.d
32Source8: gitlab-apache-conf
6ba051e8 33Source9: gitlab-rake.sh
e29cce1b 34Source10: gitconfig
e62d7f31
ER
35Source11: gitlab-ctl.sh
36Patch0: 3774.patch
37Patch1: pld.patch
38Patch2: bug-14972.patch
c06de8c3 39URL: https://www.gitlab.com/gitlab-ce/
99acef11 40BuildRequires: cmake
b70ed759 41BuildRequires: gmp-devel
8b1af143 42BuildRequires: libgit2-devel
99acef11
ER
43BuildRequires: libicu-devel
44BuildRequires: libstdc++-devel
45BuildRequires: libxml2-devel
99acef11
ER
46BuildRequires: mysql-devel
47BuildRequires: postgresql-devel
8b1af143 48BuildRequires: rpm-rubyprov
e17ca829 49BuildRequires: rpmbuild(macros) >= 1.228
edff9e13 50BuildRequires: ruby-bundler
b70ed759 51BuildRequires: ruby-devel >= 1:2.1.0
99acef11 52BuildRequires: zlib-devel
e17ca829 53Requires(post,preun): /sbin/chkconfig
edff9e13 54Requires: apache-base
6f80237a 55Requires: git-core >= 2.7.4
63c66c76 56Requires: gitlab-shell >= 2.7.2
0f5b396e 57Requires: nodejs
e17ca829 58Requires: rc-scripts
edff9e13 59Requires: ruby-bundler
1bfc7ca0
ER
60Suggests: mysql
61Suggests: redis-server
63c66c76 62Obsoletes: gitlab <= 8.1.4
edff9e13
ER
63BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
64
a92c651e
ER
65%define _noautoreqfiles redcloth_scan.jar primitives.jar
66
e2b24ef1
G
67%define uname git
68%define gname git
69%define homedir %{_localstatedir}/lib/gitlab
edff9e13
ER
70
71%description
72GitLab Community Edition (CE) is open source software to collaborate
73on code. Create projects and repositories, manage access and do code
74reviews. GitLab CE is on-premises software that you can install and
75use on your server(s).
76
77%prep
1bfc7ca0 78%setup -qn gitlabhq-%{version}
c06de8c3
ER
79mv config/gitlab.yml.example config/gitlab.yml
80mv config/unicorn.rb.example config/unicorn.rb
79bdc113 81%patch0 -p1
c06de8c3 82%patch1 -p1
481dc9f6 83#%patch2 -p1
b262a96c 84
e3e185ca
ER
85# use mysql for now
86mv config/database.yml.mysql config/database.yml
87
d6fb12dc
ER
88find -name .gitkeep | xargs rm
89rm -r docker
90rm -r features
d6fb12dc
ER
91rm -r lib/support/{deploy,init.d}
92rm -r scripts
93rm -r spec
6f80237a 94rm .csscomb.json
d6fb12dc
ER
95rm .flayignore
96rm .foreman
cd662819 97rm .gitattributes
d6fb12dc
ER
98rm .gitignore
99rm .gitlab-ci.yml
100rm .hound.yml
101rm .pkgr.yml
102rm .rspec
103rm .rubocop.yml
104rm .scss-lint.yml
105rm .simplecov
106rm .teatro.yml
107rm Procfile
108rm bin/pkgr_before_precompile.sh
298ba786 109rm docker-compose.yml
99acef11 110
edff9e13 111%build
dc27d1e6
ER
112%if %{with gem_cache}
113cachedir="%{_specdir}/cache/%{version}.%{_arch}"
114install -d vendor/bundle
115test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
116%endif
117
edff9e13 118bundle install %{_smp_mflags} \
7470b5a8 119 --verbose \
dc27d1e6
ER
120 --deployment \
121 --without development test aws %{!?with_krb5:kerberos}
edff9e13 122
ea8d688f
ER
123cp -p config/gitlab.yml{,.production}
124sed -i -e '/secret_file:/d' config/gitlab.yml
a5202e18 125bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 126mv -f config/gitlab.yml{.production,}
a3c02bfc 127
a92c651e
ER
128# avoid bogus ruby dep
129chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
130
a3c02bfc
ER
131# remove secrets, log and cache that assets compile initialized
132rm .gitlab_shell_secret
133rm .secret
134rm config/secrets.yml
135rm log/production.log
136rm -r tmp/cache/*
137
dc27d1e6
ER
138%if %{with gem_cache}
139install -d "$cachedir"
140cp -aul vendor/bundle/* "$cachedir"
141%endif
142
edff9e13
ER
143%install
144rm -rf $RPM_BUILD_ROOT
145install -d \
6eb5e245
ER
146 $RPM_BUILD_ROOT%{homedir}/www \
147 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
148 $RPM_BUILD_ROOT%{homedir}/satellites \
1a7bab8e 149 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
edff9e13 150 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
6eb5e245 151 $RPM_BUILD_ROOT%{_docdir}/gitlab \
bab42173 152 $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
edff9e13 153
b262a96c
ER
154# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
155if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
156 l=l
157 rm -f $RPM_BUILD_ROOT/VERSION
158fi
159
160cp -a$l . $RPM_BUILD_ROOT%{homedir}
edff9e13 161
fb518a6f
ER
162# rpm cruft from repackaging
163rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
164
321d2ad5
ER
165# nuke tests
166chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
167rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
168
edff9e13 169# Creating links
bab42173
ER
170rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
171ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
172ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
173ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
edff9e13 174
fb518a6f
ER
175move_config() {
176 local source=$1 target=$2
177 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
178 ln -s $target $RPM_BUILD_ROOT$source
179}
180
edff9e13
ER
181# Install config files
182for f in gitlab.yml unicorn.rb database.yml; do
fb518a6f 183 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13 184done
c4379f31 185touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 186
6ba051e8 187install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 188 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 189
c7ba61b6 190cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
191install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
192cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
193install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
194
195cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
196cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
197cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
198cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
e29cce1b 199cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
6ba051e8 200install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
e62d7f31 201install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
edff9e13
ER
202
203%clean
204rm -rf "$RPM_BUILD_ROOT"
205
a6fcdc58 206%pre
d5651fee 207if [ "$1" = "2" ]; then
a6fcdc58
ER
208 # Looks like an RPM upgrade
209 gitlab-ctl preinst
210fi
211
edff9e13 212%post
e17ca829
ER
213/sbin/chkconfig --add gitlab-sidekiq
214/sbin/chkconfig --add gitlab-unicorn
215%service gitlab-sidekiq restart
216%service gitlab-unicorn restart
217
edff9e13
ER
218if [ $1 -ge 1 ]; then
219 systemctl -q daemon-reload
220 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
221 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
222fi
223if [ $1 -eq 1 ]; then
224 systemctl -q enable gitlab-unicorn
225 systemctl -q enable gitlab-sidekiq
226 systemctl -q enable gitlab.target
227 systemctl -q start gitlab-unicorn
228 systemctl -q start gitlab-sidekiq
229 systemctl -q start gitlab.target
c4379f31 230 echo "Create and configure database in %{_sysconfdir}/gitlab/database.yml"
edff9e13
ER
231 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
232 echo
233else
037664ba
ER
234 systemctl -q try-restart gitlab-unicorn || :
235 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
236fi
237
a6fcdc58
ER
238%posttrans
239if [ "$1" = "0" ]; then
240 # Looks like an RPM upgrade
241 gitlab-ctl posttrans
242fi
243
e17ca829
ER
244%preun
245if [ "$1" = "0" ]; then
246 %service -q gitlab-sidekiq stop
247 %service -q gitlab-unicorn stop
248 /sbin/chkconfig --del gitlab-sidekiq
249 /sbin/chkconfig --del gitlab-unicorn
250fi
251
edff9e13
ER
252%postun
253if [ $1 -eq 0 ]; then
254 %userremove gitlab
255 %groupremove gitlab
256fi
257
258%files
259%defattr(644,root,root,755)
260%doc LICENSE
c4379f31
ER
261%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/database.yml
262%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab.yml
263%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/unicorn.rb
264%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
265%ghost %{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 266/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
267%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
268%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 269%attr(755,root,root) %{_sbindir}/gitlab-rake
e62d7f31 270%attr(755,root,root) %{_sbindir}/gitlab-ctl
edff9e13
ER
271%{systemdunitdir}/gitlab-sidekiq.service
272%{systemdunitdir}/gitlab-unicorn.service
273%{systemdunitdir}/gitlab.target
274%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1 275%dir %attr(755,%{uname},%{gname}) %{homedir}
e29cce1b 276%dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
e2b24ef1
G
277%dir %attr(755,%{uname},%{gname}) %{homedir}/app
278%attr(-,%{uname},%{gname}) %{homedir}/app/*
279%dir %attr(755,%{uname},%{gname}) %{homedir}/bin
280%attr(-,%{uname},%{gname}) %{homedir}/bin/*
281%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
282%dir %attr(755,%{uname},%{gname}) %{homedir}/config
283%attr(-,%{uname},%{gname}) %{homedir}/config/*
284%dir %attr(755,%{uname},%{gname}) %{homedir}/db
285%attr(-,%{uname},%{gname}) %{homedir}/db/*
286%dir %attr(755,%{uname},%{gname}) %{homedir}/doc
287%attr(-,%{uname},%{gname}) %{homedir}/doc/*
e2b24ef1
G
288%dir %attr(755,%{uname},%{gname}) %{homedir}/lib
289%attr(-,%{uname},%{gname}) %{homedir}/lib/*
e2d7a1f0 290
c76cceba 291%{homedir}/fixtures
e2d7a1f0
ER
292%{homedir}/generator_templates
293
4c1de6fa 294%dir %{homedir}/public
a14207d0 295%{homedir}/public/ci
4c1de6fa
ER
296%{homedir}/public/*.*
297%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
298%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1 299%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
bab42173 300
e2b24ef1 301%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
bab42173
ER
302%attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
303%attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
304%attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
305%attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
306%attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
307
e2b24ef1 308%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 309
cd662819
ER
310%dir %attr(750,%{uname},%{gname}) %{homedir}/shared
311%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
312%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
313%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
314%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
315%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
a329122f 316%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
cd662819 317
e2b24ef1
G
318%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
319%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
e2b24ef1 320%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
e2b24ef1
G
321%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
322%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
323%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
324%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
325%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
326%attr(-,%{uname},%{gname}) %{homedir}/*.md
e2b24ef1
G
327%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
328%attr(-,%{uname},%{gname}) %{homedir}/VERSION
329%attr(-,%{uname},%{gname}) %{homedir}/config.ru
580f84c4 330
e4edb538 331%{homedir}/log
bab42173
ER
332%dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
333%dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
e4edb538 334
580f84c4
ER
335%defattr(-,root,root,-)
336%dir %{homedir}/vendor
337%{homedir}/vendor/*
This page took 0.457679 seconds and 4 git commands to generate.