]> git.pld-linux.org Git - packages/gitlab-ce.git/blob - gitlab-ce.spec
docs subpackage
[packages/gitlab-ce.git] / gitlab-ce.spec
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.
6 #
7 # install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.6/doc/install/installation.md
8 #
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
15 %bcond_without  gem_cache       # use local cache to speedup gem installation
16
17 Summary:        A Web interface to create projects and repositories, manage access and do code reviews
18 Name:           gitlab-ce
19 Version:        8.10.6
20 Release:        0.50
21 License:        MIT
22 Group:          Applications/WWW
23 # md5 deliberately omitted until this package is useful
24 Source0:        https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz
25 Source1:        gitlab.target
26 Source2:        gitlab-sidekiq.service
27 Source3:        gitlab-sidekiq.init
28 Source4:        gitlab-unicorn.service
29 Source5:        gitlab-unicorn.init
30 Source6:        gitlab.logrotate
31 Source7:        gitlab.tmpfiles.d
32 Source8:        gitlab-apache-conf
33 Source9:        gitlab-rake.sh
34 Source10:       gitconfig
35 Source11:       gitlab-ctl.sh
36 Source12:       clean-vendor.sh
37 Patch0:         3774.patch
38 Patch1:         pld.patch
39 URL:            https://www.gitlab.com/gitlab-ce/
40 BuildRequires:  cmake
41 BuildRequires:  gmp-devel
42 BuildRequires:  libgit2-devel
43 BuildRequires:  libicu-devel
44 BuildRequires:  libstdc++-devel
45 BuildRequires:  libxml2-devel
46 BuildRequires:  mysql-devel
47 BuildRequires:  postgresql-devel
48 BuildRequires:  rpm-rubyprov
49 BuildRequires:  rpmbuild(macros) >= 1.228
50 BuildRequires:  ruby-bundler
51 BuildRequires:  ruby-devel >= 1:2.1.0
52 BuildRequires:  zlib-devel
53 Requires(post,preun):   /sbin/chkconfig
54 Requires:       apache-base
55 Requires:       git-core >= 2.7.4
56 Requires:       gitlab-shell >= 3.2.1
57 Requires:       nodejs
58 Requires:       rc-scripts
59 Requires:       ruby-bundler
60 Suggests:       mysql
61 Suggests:       redis-server
62 Obsoletes:      gitlab <= 8.1.4
63 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
64
65 %define _noautoreqfiles redcloth_scan.jar primitives.jar
66
67 %define uname git
68 %define gname git
69 %define homedir %{_localstatedir}/lib/gitlab
70
71 %description
72 GitLab Community Edition (CE) is open source software to collaborate
73 on code. Create projects and repositories, manage access and do code
74 reviews. GitLab CE is on-premises software that you can install and
75 use on your server(s).
76
77 %package doc
78 Summary:        Manual for GitLab
79 Summary(fr.UTF-8):      Documentation pour GitLab
80 Summary(it.UTF-8):      Documentazione di GitLab
81 Summary(pl.UTF-8):      PodrÄ™cznik dla GitLab
82 Group:          Documentation
83 # noarch subpackages only when building with rpm5
84 %if "%{_rpmversion}" >= "5"
85 BuildArch:      noarch
86 %endif
87
88 %description doc
89 Documentation for GitLab.
90
91 %prep
92 %setup -qn gitlabhq-%{version}
93 mv config/gitlab.yml.example config/gitlab.yml
94 mv config/unicorn.rb.example config/unicorn.rb
95 #%patch0 -p1
96 %patch1 -p1
97
98 # use mysql for now
99 mv config/database.yml.mysql config/database.yml
100
101 find -name .gitkeep | xargs rm
102 rm -r .github
103 rm -r docker
104 rm -r features
105 rm -r lib/support/{deploy,init.d}
106 rm -r rubocop
107 rm -r scripts
108 rm -r spec
109 rm .csscomb.json
110 rm .flayignore
111 rm .foreman
112 rm .gitattributes
113 rm .gitignore
114 rm .gitlab-ci.yml
115 rm .pkgr.yml
116 rm .rspec
117 rm .rubocop.yml
118 rm .rubocop_todo.yml
119 rm .scss-lint.yml
120 rm .simplecov
121 rm .vagrant_enabled
122 rm Procfile
123 rm bin/pkgr_before_precompile.sh
124 rm docker-compose.yml
125
126 %build
127 %if %{with gem_cache}
128 cachedir="%{_specdir}/cache/%{version}.%{_arch}"
129 install -d vendor/bundle
130 test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
131 %endif
132
133 bundle install %{_smp_mflags} \
134         --verbose \
135         --deployment \
136         --without development test aws %{!?with_krb5:kerberos}
137
138 # install newer rugged to fix diff view showing garbage
139 # https://gitlab.com/gitlab-org/gitlab-ce/issues/14972
140 v=0.25.0b6
141 bundle exec gem install -v $v rugged --no-rdoc --no-ri --verbose
142
143 # precompile assets
144 # use modified config so it doesn't croak
145 cp -p config/gitlab.yml{,.production}
146 sed -i -e '/secret_file:/d' config/gitlab.yml
147 sed -i -e 's#/home/git/repositories/#./#' config/gitlab.yml
148 bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
149 mv -f config/gitlab.yml{.production,}
150
151 # avoid bogus ruby dep
152 chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
153
154 # remove secrets, log and cache that assets compile initialized
155 rm .gitlab_shell_secret
156 rm .secret
157 rm config/secrets.yml
158 rm log/production.log
159 rm -r tmp/cache/*
160
161 %if %{with gem_cache}
162 install -d "$cachedir"
163 cp -aul vendor/bundle/* "$cachedir"
164 %endif
165
166 %install
167 rm -rf $RPM_BUILD_ROOT
168 install -d \
169         $RPM_BUILD_ROOT%{homedir}/www \
170         $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
171         $RPM_BUILD_ROOT%{homedir}/satellites \
172         $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
173         $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
174         $RPM_BUILD_ROOT%{_docdir}/gitlab \
175         $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
176
177 # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
178 if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
179         l=l
180         rm -f $RPM_BUILD_ROOT/VERSION
181 fi
182
183 cp -a$l . $RPM_BUILD_ROOT%{homedir}
184
185 # cleanup unneccessary cruft (gem build files, etc)
186 sh -x %{SOURCE12} $RPM_BUILD_ROOT%{homedir}
187
188 # replace the contents, yet leave it believe it has proper version installed (for gem dependencies)
189 v=0.25.0b6
190 ov=0.24.0
191 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-$ov
192 mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-{$v,$ov}
193 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-$ov
194 mv $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/rugged-{$v,$ov}
195
196 # rpm cruft from repackaging
197 rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
198
199 # nuke tests
200 chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
201 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
202
203 # Creating links
204 rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
205 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
206 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
207 ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
208
209 move_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
215 # Install config files
216 for f in gitlab.yml unicorn.rb database.yml; do
217         move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
218 done
219 touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/skip-auto-migrations
220
221 install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
222         $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
223
224 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
225 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
226 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
227 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
228
229 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
230 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
231 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
232 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
233 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
234 install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
235 install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
236
237 %clean
238 rm -rf $RPM_BUILD_ROOT
239
240 %pre
241 if [ "$1" = "2" ]; then
242         # Looks like an RPM upgrade
243         gitlab-ctl preinst
244 fi
245
246 %post
247 /sbin/chkconfig --add gitlab-sidekiq
248 /sbin/chkconfig --add gitlab-unicorn
249 %service gitlab-sidekiq restart
250 %service gitlab-unicorn restart
251
252 if [ $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 || :
256 fi
257 if [ $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
264         echo "Create and configure database in %{_sysconfdir}/gitlab/database.yml"
265         echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
266         echo
267 else
268         systemctl -q try-restart gitlab-unicorn || :
269         systemctl -q try-start gitlab-sidekiq || :
270 fi
271
272 %posttrans
273 if [ "$1" = "0" ]; then
274         # Looks like an RPM upgrade
275         gitlab-ctl posttrans
276 fi
277
278 %preun
279 if [ "$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
284 fi
285
286 %postun
287 if [ $1 -eq 0 ]; then
288         %userremove gitlab
289         %groupremove gitlab
290 fi
291
292 %files
293 %defattr(644,root,root,755)
294 %doc LICENSE
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
300 /etc/logrotate.d/gitlab.logrotate
301 %attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
302 %attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
303 %attr(755,root,root) %{_sbindir}/gitlab-rake
304 %attr(755,root,root) %{_sbindir}/gitlab-ctl
305 %{systemdunitdir}/gitlab-sidekiq.service
306 %{systemdunitdir}/gitlab-unicorn.service
307 %{systemdunitdir}/gitlab.target
308 %{systemdtmpfilesdir}/gitlab.conf
309 %dir %attr(755,%{uname},%{gname}) %{homedir}
310 %dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
311 %dir %attr(755,%{uname},%{gname}) %{homedir}/app
312 %attr(-,%{uname},%{gname}) %{homedir}/app/*
313 %dir %{homedir}/bin
314 %attr(-,root,root) %{homedir}/bin/*
315 %dir %attr(755,%{uname},%{gname}) %{homedir}/builds
316 %dir %attr(755,%{uname},%{gname}) %{homedir}/config
317 %attr(-,%{uname},%{gname}) %{homedir}/config/*
318 %{homedir}/db
319 %{homedir}/fixtures
320 %{homedir}/generator_templates
321 %{homedir}/lib
322
323 %dir %{homedir}/public
324 %{homedir}/public/ci
325 %{homedir}/public/*.*
326 %attr(-,%{uname},%{gname}) %{homedir}/public/uploads
327 %attr(-,%{uname},%{gname}) %{homedir}/public/assets
328 %dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
329
330 %dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
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
337 %dir %attr(755,%{uname},%{gname}) %{homedir}/www
338
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
345 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
346
347 %dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
348 %attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
349 %attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
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
356 %attr(-,%{uname},%{gname}) %{homedir}/Rakefile
357 %attr(-,%{uname},%{gname}) %{homedir}/VERSION
358 %attr(-,%{uname},%{gname}) %{homedir}/config.ru
359
360 %{homedir}/log
361 %dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
362 %dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
363
364 %defattr(-,root,root,-)
365 %dir %{homedir}/vendor
366 %{homedir}/vendor/*
367
368 %files doc
369 %defattr(644,root,root,755)
370 %{homedir}/doc
This page took 0.114381 seconds and 4 git commands to generate.