]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
docs subpackage
[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
54f50e6d 20Release: 0.50
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
f1534eb2 141bundle exec gem install -v $v rugged --no-rdoc --no-ri --verbose
9a13c814 142
575e60f5
ER
143# precompile assets
144# use modified config so it doesn't croak
ea8d688f
ER
145cp -p config/gitlab.yml{,.production}
146sed -i -e '/secret_file:/d' config/gitlab.yml
575e60f5 147sed -i -e 's#/home/git/repositories/#./#' config/gitlab.yml
a5202e18 148bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 149mv -f config/gitlab.yml{.production,}
a3c02bfc 150
a92c651e
ER
151# avoid bogus ruby dep
152chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
153
a3c02bfc
ER
154# remove secrets, log and cache that assets compile initialized
155rm .gitlab_shell_secret
156rm .secret
157rm config/secrets.yml
158rm log/production.log
159rm -r tmp/cache/*
160
dc27d1e6
ER
161%if %{with gem_cache}
162install -d "$cachedir"
163cp -aul vendor/bundle/* "$cachedir"
164%endif
165
edff9e13
ER
166%install
167rm -rf $RPM_BUILD_ROOT
168install -d \
6eb5e245
ER
169 $RPM_BUILD_ROOT%{homedir}/www \
170 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
171 $RPM_BUILD_ROOT%{homedir}/satellites \
1a7bab8e 172 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
edff9e13 173 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
6eb5e245 174 $RPM_BUILD_ROOT%{_docdir}/gitlab \
bab42173 175 $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/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
183cp -a$l . $RPM_BUILD_ROOT%{homedir}
edff9e13 184
f802be87
ER
185# cleanup unneccessary cruft (gem build files, etc)
186sh -x %{SOURCE12} $RPM_BUILD_ROOT%{homedir}
187
c5b62b37
ER
188# replace the contents, yet leave it believe it has proper version installed (for gem dependencies)
189v=0.25.0b6
190ov=0.24.0
191rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-$ov
192mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-{$v,$ov}
193rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-$ov
194mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-{$v,$ov}
195
fb518a6f
ER
196# rpm cruft from repackaging
197rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
198
321d2ad5
ER
199# nuke tests
200chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
201rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
202
edff9e13 203# Creating links
bab42173
ER
204rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
205ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
206ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
207ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
edff9e13 208
fb518a6f
ER
209move_config() {
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
ER
215# Install config files
216for f in gitlab.yml unicorn.rb database.yml; do
fb518a6f 217 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13 218done
c4379f31 219touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 220
6ba051e8 221install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 222 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 223
c7ba61b6 224cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
225install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
226cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
227install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
228
229cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
230cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
231cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
232cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
e29cce1b 233cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
6ba051e8 234install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
e62d7f31 235install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
edff9e13
ER
236
237%clean
9a13c814 238rm -rf $RPM_BUILD_ROOT
edff9e13 239
a6fcdc58 240%pre
d5651fee 241if [ "$1" = "2" ]; then
a6fcdc58
ER
242 # Looks like an RPM upgrade
243 gitlab-ctl preinst
244fi
245
edff9e13 246%post
e17ca829
ER
247/sbin/chkconfig --add gitlab-sidekiq
248/sbin/chkconfig --add gitlab-unicorn
249%service gitlab-sidekiq restart
250%service gitlab-unicorn restart
251
edff9e13
ER
252if [ $1 -ge 1 ]; then
253 systemctl -q daemon-reload
254 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
255 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
256fi
257if [ $1 -eq 1 ]; then
258 systemctl -q enable gitlab-unicorn
259 systemctl -q enable gitlab-sidekiq
260 systemctl -q enable gitlab.target
261 systemctl -q start gitlab-unicorn
262 systemctl -q start gitlab-sidekiq
263 systemctl -q start gitlab.target
c4379f31 264 echo "Create and configure database in %{_sysconfdir}/gitlab/database.yml"
edff9e13
ER
265 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
266 echo
267else
037664ba
ER
268 systemctl -q try-restart gitlab-unicorn || :
269 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
270fi
271
a6fcdc58
ER
272%posttrans
273if [ "$1" = "0" ]; then
274 # Looks like an RPM upgrade
275 gitlab-ctl posttrans
276fi
277
e17ca829
ER
278%preun
279if [ "$1" = "0" ]; then
280 %service -q gitlab-sidekiq stop
281 %service -q gitlab-unicorn stop
282 /sbin/chkconfig --del gitlab-sidekiq
283 /sbin/chkconfig --del gitlab-unicorn
284fi
285
edff9e13
ER
286%postun
287if [ $1 -eq 0 ]; then
288 %userremove gitlab
289 %groupremove gitlab
290fi
291
292%files
293%defattr(644,root,root,755)
294%doc LICENSE
c4379f31
ER
295%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/database.yml
296%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab.yml
297%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/unicorn.rb
298%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
299%ghost %{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 300/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
301%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
302%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 303%attr(755,root,root) %{_sbindir}/gitlab-rake
e62d7f31 304%attr(755,root,root) %{_sbindir}/gitlab-ctl
edff9e13
ER
305%{systemdunitdir}/gitlab-sidekiq.service
306%{systemdunitdir}/gitlab-unicorn.service
307%{systemdunitdir}/gitlab.target
308%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1 309%dir %attr(755,%{uname},%{gname}) %{homedir}
e29cce1b 310%dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
e2b24ef1
G
311%dir %attr(755,%{uname},%{gname}) %{homedir}/app
312%attr(-,%{uname},%{gname}) %{homedir}/app/*
54f50e6d
ER
313%dir %{homedir}/bin
314%attr(-,root,root) %{homedir}/bin/*
e2b24ef1
G
315%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
316%dir %attr(755,%{uname},%{gname}) %{homedir}/config
317%attr(-,%{uname},%{gname}) %{homedir}/config/*
54f50e6d 318%{homedir}/db
c76cceba 319%{homedir}/fixtures
e2d7a1f0 320%{homedir}/generator_templates
54f50e6d 321%{homedir}/lib
e2d7a1f0 322
4c1de6fa 323%dir %{homedir}/public
a14207d0 324%{homedir}/public/ci
4c1de6fa
ER
325%{homedir}/public/*.*
326%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
327%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1 328%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
bab42173 329
e2b24ef1 330%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
bab42173
ER
331%attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
332%attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
333%attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
334%attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
335%attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
336
e2b24ef1 337%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 338
cd662819
ER
339%dir %attr(750,%{uname},%{gname}) %{homedir}/shared
340%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
341%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
342%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
343%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
344%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
a329122f 345%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
cd662819 346
e2b24ef1
G
347%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
348%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
e2b24ef1 349%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
e2b24ef1
G
350%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
351%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
352%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
353%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
354%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
355%attr(-,%{uname},%{gname}) %{homedir}/*.md
e2b24ef1
G
356%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
357%attr(-,%{uname},%{gname}) %{homedir}/VERSION
358%attr(-,%{uname},%{gname}) %{homedir}/config.ru
580f84c4 359
e4edb538 360%{homedir}/log
bab42173
ER
361%dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
362%dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
e4edb538 363
580f84c4
ER
364%defattr(-,root,root,-)
365%dir %{homedir}/vendor
366%{homedir}/vendor/*
54f50e6d
ER
367
368%files doc
369%defattr(644,root,root,755)
370%{homedir}/doc
This page took 0.102892 seconds and 4 git commands to generate.