]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
make db/schema.rb writable
[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
edff9e13
ER
17Summary: A Web interface to create projects and repositories, manage access and do code reviews
18Name: gitlab-ce
a468c959 19Version: 8.10.6
77cff545 20Release: 0.51
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 35Source11: gitlab-ctl.sh
f802be87 36Source12: clean-vendor.sh
e62d7f31
ER
37Patch0: 3774.patch
38Patch1: pld.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
3e2357d8 56Requires: gitlab-shell >= 3.2.1
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
54f50e6d
ER
77%package doc
78Summary: Manual for GitLab
79Summary(fr.UTF-8): Documentation pour GitLab
80Summary(it.UTF-8): Documentazione di GitLab
81Summary(pl.UTF-8): Podręcznik dla GitLab
82Group: Documentation
83# noarch subpackages only when building with rpm5
84%if "%{_rpmversion}" >= "5"
85BuildArch: noarch
86%endif
87
88%description doc
89Documentation for GitLab.
90
edff9e13 91%prep
1bfc7ca0 92%setup -qn gitlabhq-%{version}
c06de8c3
ER
93mv config/gitlab.yml.example config/gitlab.yml
94mv config/unicorn.rb.example config/unicorn.rb
575e60f5 95#%patch0 -p1
c06de8c3 96%patch1 -p1
b262a96c 97
e3e185ca
ER
98# use mysql for now
99mv config/database.yml.mysql config/database.yml
100
d6fb12dc 101find -name .gitkeep | xargs rm
575e60f5 102rm -r .github
d6fb12dc
ER
103rm -r docker
104rm -r features
d6fb12dc 105rm -r lib/support/{deploy,init.d}
575e60f5 106rm -r rubocop
d6fb12dc
ER
107rm -r scripts
108rm -r spec
6f80237a 109rm .csscomb.json
d6fb12dc
ER
110rm .flayignore
111rm .foreman
cd662819 112rm .gitattributes
d6fb12dc
ER
113rm .gitignore
114rm .gitlab-ci.yml
d6fb12dc
ER
115rm .pkgr.yml
116rm .rspec
117rm .rubocop.yml
575e60f5 118rm .rubocop_todo.yml
d6fb12dc
ER
119rm .scss-lint.yml
120rm .simplecov
575e60f5 121rm .vagrant_enabled
d6fb12dc
ER
122rm Procfile
123rm bin/pkgr_before_precompile.sh
298ba786 124rm docker-compose.yml
99acef11 125
edff9e13 126%build
dc27d1e6
ER
127%if %{with gem_cache}
128cachedir="%{_specdir}/cache/%{version}.%{_arch}"
129install -d vendor/bundle
130test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
131%endif
132
edff9e13 133bundle install %{_smp_mflags} \
7470b5a8 134 --verbose \
dc27d1e6
ER
135 --deployment \
136 --without development test aws %{!?with_krb5:kerberos}
edff9e13 137
9a13c814
ER
138# install newer rugged to fix diff view showing garbage
139# https://gitlab.com/gitlab-org/gitlab-ce/issues/14972
140v=0.25.0b6
de0b0023 141test -d vendor/bundle/ruby/gems/rugged-$v || \
f1534eb2 142bundle exec gem install -v $v rugged --no-rdoc --no-ri --verbose
9a13c814 143
575e60f5
ER
144# precompile assets
145# use modified config so it doesn't croak
ea8d688f
ER
146cp -p config/gitlab.yml{,.production}
147sed -i -e '/secret_file:/d' config/gitlab.yml
575e60f5 148sed -i -e 's#/home/git/repositories/#./#' config/gitlab.yml
a5202e18 149bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 150mv -f config/gitlab.yml{.production,}
a3c02bfc 151
a92c651e
ER
152# avoid bogus ruby dep
153chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
154
a3c02bfc
ER
155# remove secrets, log and cache that assets compile initialized
156rm .gitlab_shell_secret
157rm .secret
158rm config/secrets.yml
159rm log/production.log
160rm -r tmp/cache/*
161
dc27d1e6
ER
162%if %{with gem_cache}
163install -d "$cachedir"
164cp -aul vendor/bundle/* "$cachedir"
165%endif
166
edff9e13
ER
167%install
168rm -rf $RPM_BUILD_ROOT
169install -d \
6eb5e245
ER
170 $RPM_BUILD_ROOT%{homedir}/www \
171 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
172 $RPM_BUILD_ROOT%{homedir}/satellites \
1a7bab8e 173 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
edff9e13 174 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
6eb5e245 175 $RPM_BUILD_ROOT%{_docdir}/gitlab \
bab42173 176 $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
edff9e13 177
b262a96c
ER
178# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
179if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
180 l=l
181 rm -f $RPM_BUILD_ROOT/VERSION
182fi
183
184cp -a$l . $RPM_BUILD_ROOT%{homedir}
edff9e13 185
f802be87
ER
186# cleanup unneccessary cruft (gem build files, etc)
187sh -x %{SOURCE12} $RPM_BUILD_ROOT%{homedir}
188
c5b62b37
ER
189# replace the contents, yet leave it believe it has proper version installed (for gem dependencies)
190v=0.25.0b6
191ov=0.24.0
192rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-$ov
193mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-{$v,$ov}
194rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-$ov
195mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-{$v,$ov}
196
fb518a6f
ER
197# rpm cruft from repackaging
198rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
199
321d2ad5
ER
200# nuke tests
201chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
202rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
203
edff9e13 204# Creating links
bab42173
ER
205rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
206ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
207ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
208ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
edff9e13 209
fb518a6f
ER
210move_config() {
211 local source=$1 target=$2
212 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
213 ln -s $target $RPM_BUILD_ROOT$source
214}
215
edff9e13
ER
216# Install config files
217for f in gitlab.yml unicorn.rb database.yml; do
fb518a6f 218 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13 219done
c4379f31 220touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 221
6ba051e8 222install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 223 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 224
c7ba61b6 225cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
226install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
227cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
228install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
229
230cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
231cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
232cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
233cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
e29cce1b 234cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
6ba051e8 235install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
e62d7f31 236install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
edff9e13
ER
237
238%clean
9a13c814 239rm -rf $RPM_BUILD_ROOT
edff9e13 240
a6fcdc58 241%pre
d5651fee 242if [ "$1" = "2" ]; then
a6fcdc58
ER
243 # Looks like an RPM upgrade
244 gitlab-ctl preinst
245fi
246
edff9e13 247%post
e17ca829
ER
248/sbin/chkconfig --add gitlab-sidekiq
249/sbin/chkconfig --add gitlab-unicorn
250%service gitlab-sidekiq restart
251%service gitlab-unicorn restart
252
edff9e13
ER
253if [ $1 -ge 1 ]; then
254 systemctl -q daemon-reload
255 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
256 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
257fi
258if [ $1 -eq 1 ]; then
259 systemctl -q enable gitlab-unicorn
260 systemctl -q enable gitlab-sidekiq
261 systemctl -q enable gitlab.target
262 systemctl -q start gitlab-unicorn
263 systemctl -q start gitlab-sidekiq
264 systemctl -q start gitlab.target
c4379f31 265 echo "Create and configure database in %{_sysconfdir}/gitlab/database.yml"
edff9e13
ER
266 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
267 echo
268else
037664ba
ER
269 systemctl -q try-restart gitlab-unicorn || :
270 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
271fi
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
286
edff9e13
ER
287%postun
288if [ $1 -eq 0 ]; then
289 %userremove gitlab
290 %groupremove gitlab
291fi
292
293%files
294%defattr(644,root,root,755)
295%doc LICENSE
c4379f31
ER
296%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/database.yml
297%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab.yml
298%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/unicorn.rb
299%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
300%ghost %{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 301/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
302%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
303%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 304%attr(755,root,root) %{_sbindir}/gitlab-rake
e62d7f31 305%attr(755,root,root) %{_sbindir}/gitlab-ctl
edff9e13
ER
306%{systemdunitdir}/gitlab-sidekiq.service
307%{systemdunitdir}/gitlab-unicorn.service
308%{systemdunitdir}/gitlab.target
309%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1 310%dir %attr(755,%{uname},%{gname}) %{homedir}
e29cce1b 311%dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
e2b24ef1
G
312%dir %attr(755,%{uname},%{gname}) %{homedir}/app
313%attr(-,%{uname},%{gname}) %{homedir}/app/*
54f50e6d
ER
314%dir %{homedir}/bin
315%attr(-,root,root) %{homedir}/bin/*
e2b24ef1
G
316%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
317%dir %attr(755,%{uname},%{gname}) %{homedir}/config
318%attr(-,%{uname},%{gname}) %{homedir}/config/*
c76cceba 319%{homedir}/fixtures
e2d7a1f0 320%{homedir}/generator_templates
54f50e6d 321%{homedir}/lib
e2d7a1f0 322
77cff545
ER
323%dir %{homedir}/db
324%attr(-,%{uname},%{gname}) %{homedir}/db/schema.rb
325%{homedir}/db/seeds.rb
326%{homedir}/db/fixtures
327%{homedir}/db/migrate
328
4c1de6fa 329%dir %{homedir}/public
a14207d0 330%{homedir}/public/ci
4c1de6fa
ER
331%{homedir}/public/*.*
332%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
333%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1 334%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
bab42173 335
e2b24ef1 336%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
bab42173
ER
337%attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
338%attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
339%attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
340%attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
341%attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
342
e2b24ef1 343%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 344
cd662819
ER
345%dir %attr(750,%{uname},%{gname}) %{homedir}/shared
346%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
347%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
348%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
349%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
350%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
a329122f 351%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
cd662819 352
e2b24ef1
G
353%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
354%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
e2b24ef1 355%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
e2b24ef1
G
356%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
357%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
358%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
359%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
360%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
361%attr(-,%{uname},%{gname}) %{homedir}/*.md
e2b24ef1
G
362%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
363%attr(-,%{uname},%{gname}) %{homedir}/VERSION
364%attr(-,%{uname},%{gname}) %{homedir}/config.ru
580f84c4 365
e4edb538 366%{homedir}/log
bab42173
ER
367%dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
368%dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
e4edb538 369
580f84c4
ER
370%defattr(-,root,root,-)
371%dir %{homedir}/vendor
372%{homedir}/vendor/*
54f50e6d
ER
373
374%files doc
375%defattr(644,root,root,755)
376%{homedir}/doc
This page took 0.126647 seconds and 4 git commands to generate.