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