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