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