]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
remove unneeded test, etc files
[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
dc27d1e6 15%bcond_without gem_cache # use local 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
76dc7c17 19Version: 8.7.5
d6fb12dc 20Release: 0.25
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
79bdc113 25Patch0: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3774.patch
c06de8c3 26Patch1: pld.patch
edff9e13
ER
27Source1: gitlab.target
28Source2: gitlab-sidekiq.service
7db376f0
ER
29Source3: gitlab-sidekiq.init
30Source4: gitlab-unicorn.service
31Source5: gitlab-unicorn.init
32Source6: gitlab.logrotate
33Source7: gitlab.tmpfiles.d
34Source8: gitlab-apache-conf
6ba051e8 35Source9: gitlab-rake.sh
e29cce1b 36Source10: gitconfig
c06de8c3 37URL: https://www.gitlab.com/gitlab-ce/
99acef11 38BuildRequires: cmake
b70ed759 39BuildRequires: gmp-devel
8b1af143 40BuildRequires: libgit2-devel
99acef11
ER
41BuildRequires: libicu-devel
42BuildRequires: libstdc++-devel
43BuildRequires: libxml2-devel
99acef11
ER
44BuildRequires: mysql-devel
45BuildRequires: postgresql-devel
8b1af143 46BuildRequires: rpm-rubyprov
edff9e13 47BuildRequires: ruby-bundler
b70ed759 48BuildRequires: ruby-devel >= 1:2.1.0
99acef11 49BuildRequires: zlib-devel
edff9e13 50Requires: apache-base
6f80237a 51Requires: git-core >= 2.7.4
63c66c76 52Requires: gitlab-shell >= 2.7.2
0f5b396e 53Requires: nodejs
edff9e13 54Requires: ruby-bundler
1bfc7ca0
ER
55Suggests: mysql
56Suggests: redis-server
63c66c76 57Obsoletes: gitlab <= 8.1.4
edff9e13
ER
58BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59
a92c651e
ER
60%define _noautoreqfiles redcloth_scan.jar primitives.jar
61
e2b24ef1
G
62%define uname git
63%define gname git
64%define homedir %{_localstatedir}/lib/gitlab
edff9e13
ER
65
66%description
67GitLab Community Edition (CE) is open source software to collaborate
68on code. Create projects and repositories, manage access and do code
69reviews. GitLab CE is on-premises software that you can install and
70use on your server(s).
71
72%prep
1bfc7ca0 73%setup -qn gitlabhq-%{version}
c06de8c3
ER
74mv config/gitlab.yml.example config/gitlab.yml
75mv config/unicorn.rb.example config/unicorn.rb
79bdc113 76%patch0 -p1
c06de8c3 77%patch1 -p1
b262a96c 78
e3e185ca
ER
79# use mysql for now
80mv config/database.yml.mysql config/database.yml
81
d6fb12dc
ER
82find -name .gitkeep | xargs rm
83rm -r docker
84rm -r features
85rm -r fixtures
86rm -r lib/support/{deploy,init.d}
87rm -r scripts
88rm -r spec
6f80237a 89rm .csscomb.json
d6fb12dc
ER
90rm .flayignore
91rm .foreman
cd662819 92rm .gitattributes
d6fb12dc
ER
93rm .gitignore
94rm .gitlab-ci.yml
95rm .hound.yml
96rm .pkgr.yml
97rm .rspec
98rm .rubocop.yml
99rm .scss-lint.yml
100rm .simplecov
101rm .teatro.yml
102rm Procfile
103rm bin/pkgr_before_precompile.sh
298ba786 104rm docker-compose.yml
99acef11 105
edff9e13 106%build
dc27d1e6
ER
107%if %{with gem_cache}
108cachedir="%{_specdir}/cache/%{version}.%{_arch}"
109install -d vendor/bundle
110test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
111%endif
112
edff9e13 113bundle install %{_smp_mflags} \
7470b5a8 114 --verbose \
dc27d1e6
ER
115 --deployment \
116 --without development test aws %{!?with_krb5:kerberos}
edff9e13 117
ea8d688f
ER
118cp -p config/gitlab.yml{,.production}
119sed -i -e '/secret_file:/d' config/gitlab.yml
a5202e18 120bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 121mv -f config/gitlab.yml{.production,}
a3c02bfc 122
a92c651e
ER
123# avoid bogus ruby dep
124chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
125
a3c02bfc
ER
126# remove secrets, log and cache that assets compile initialized
127rm .gitlab_shell_secret
128rm .secret
129rm config/secrets.yml
130rm log/production.log
131rm -r tmp/cache/*
132
dc27d1e6
ER
133%if %{with gem_cache}
134install -d "$cachedir"
135cp -aul vendor/bundle/* "$cachedir"
136%endif
137
edff9e13
ER
138%install
139rm -rf $RPM_BUILD_ROOT
140install -d \
6eb5e245
ER
141 $RPM_BUILD_ROOT%{homedir}/www \
142 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
143 $RPM_BUILD_ROOT%{homedir}/satellites \
144 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions} \
edff9e13 145 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
6eb5e245 146 $RPM_BUILD_ROOT%{_docdir}/gitlab \
edff9e13 147
b262a96c
ER
148# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
149if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
150 l=l
151 rm -f $RPM_BUILD_ROOT/VERSION
152fi
153
154cp -a$l . $RPM_BUILD_ROOT%{homedir}
edff9e13 155
fb518a6f
ER
156# rpm cruft from repackaging
157rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
158
321d2ad5
ER
159# nuke tests
160chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
161rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
162
edff9e13
ER
163# Creating links
164ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/pids
165ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/sockets
e4edb538 166rmdir $RPM_BUILD_ROOT%{homedir}/log
edff9e13 167ln -fs %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
1bfc7ca0 168install -d $RPM_BUILD_ROOT%{_localstatedir}/log/gitlab
edff9e13 169
fb518a6f
ER
170move_config() {
171 local source=$1 target=$2
172 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
173 ln -s $target $RPM_BUILD_ROOT$source
174}
175
edff9e13
ER
176# Install config files
177for f in gitlab.yml unicorn.rb database.yml; do
fb518a6f 178 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13
ER
179done
180
6ba051e8 181install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 182 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 183
c7ba61b6 184cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
185install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
186cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
187install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
188
189cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
190cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
191cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
192cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
e29cce1b 193cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
6ba051e8 194install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
edff9e13
ER
195
196%clean
197rm -rf "$RPM_BUILD_ROOT"
198
edff9e13
ER
199%post
200if [ $1 -ge 1 ]; then
201 systemctl -q daemon-reload
202 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
203 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
204fi
205if [ $1 -eq 1 ]; then
206 systemctl -q enable gitlab-unicorn
207 systemctl -q enable gitlab-sidekiq
208 systemctl -q enable gitlab.target
209 systemctl -q start gitlab-unicorn
210 systemctl -q start gitlab-sidekiq
211 systemctl -q start gitlab.target
edff9e13
ER
212 echo "Create and configure database in /etc/gitlab/database.yml"
213 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
214 echo
215else
037664ba
ER
216 systemctl -q try-restart gitlab-unicorn || :
217 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
218fi
219
220%postun
221if [ $1 -eq 0 ]; then
222 %userremove gitlab
223 %groupremove gitlab
224fi
225
226%files
227%defattr(644,root,root,755)
228%doc LICENSE
edff9e13
ER
229%config(noreplace) %{_sysconfdir}/gitlab/database.yml
230%config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
231%config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
c7ba61b6 232%config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
edff9e13 233/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
234%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
235%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 236%attr(755,root,root) %{_sbindir}/gitlab-rake
edff9e13
ER
237%{systemdunitdir}/gitlab-sidekiq.service
238%{systemdunitdir}/gitlab-unicorn.service
239%{systemdunitdir}/gitlab.target
240%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1 241%dir %attr(755,%{uname},%{gname}) %{homedir}
e29cce1b 242%dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
e2b24ef1
G
243%dir %attr(755,%{uname},%{gname}) %{homedir}/app
244%attr(-,%{uname},%{gname}) %{homedir}/app/*
245%dir %attr(755,%{uname},%{gname}) %{homedir}/bin
246%attr(-,%{uname},%{gname}) %{homedir}/bin/*
247%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
248%dir %attr(755,%{uname},%{gname}) %{homedir}/config
249%attr(-,%{uname},%{gname}) %{homedir}/config/*
250%dir %attr(755,%{uname},%{gname}) %{homedir}/db
251%attr(-,%{uname},%{gname}) %{homedir}/db/*
252%dir %attr(755,%{uname},%{gname}) %{homedir}/doc
253%attr(-,%{uname},%{gname}) %{homedir}/doc/*
e2b24ef1
G
254%dir %attr(755,%{uname},%{gname}) %{homedir}/lib
255%attr(-,%{uname},%{gname}) %{homedir}/lib/*
256%dir %attr(755,%{uname},%{gname}) %{homedir}/pids
4c1de6fa 257%dir %{homedir}/public
a14207d0 258%{homedir}/public/ci
4c1de6fa
ER
259%{homedir}/public/*.*
260%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
261%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1 262%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
e2b24ef1 263%dir %attr(755,%{uname},%{gname}) %{homedir}/sockets
e2b24ef1
G
264%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
265%attr(-,%{uname},%{gname}) %{homedir}/tmp/*
266%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 267
cd662819
ER
268%dir %attr(750,%{uname},%{gname}) %{homedir}/shared
269%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
270%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
271%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
272%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
273%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
274
e2b24ef1
G
275%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
276%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
e2b24ef1 277%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
e2b24ef1
G
278%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
279%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
280%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
281%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
282%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
283%attr(-,%{uname},%{gname}) %{homedir}/*.md
e2b24ef1
G
284%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
285%attr(-,%{uname},%{gname}) %{homedir}/VERSION
286%attr(-,%{uname},%{gname}) %{homedir}/config.ru
580f84c4 287
e4edb538 288%{homedir}/log
e2b24ef1 289%dir %attr(771,root,%{gname}) /var/log/gitlab
e4edb538 290
580f84c4
ER
291%defattr(-,root,root,-)
292%dir %{homedir}/vendor
293%{homedir}/vendor/*
This page took 0.110313 seconds and 4 git commands to generate.