LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gerrit.spec of Package gerrit (Project home:porscheinformatik:server:applications)

# spec file for package gerrit
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/

%define is_rc   0
%define gerrit_home /srv/gerrit
%define gerrit_site_home %{gerrit_home}/site/
%if 0%{?suse_version}
%define gl_sysconfdir %{_localstatedir}/adm/fillup-templates/sysconfig.
%define gl_sysconfdir %{_sysconfdir}/sysconfig/
%{!?_initddir: %{expand: %%global _initddir %{_initrddir}}}

Name:           gerrit
Version:        2.11.5
Release:        0
%define vertag  %{version}

Summary:        Gerrit is a web based code review system
License:        Apache License 2.0 
Group:          System Environment/Daemons

Url:            https://code.google.com/p/gerrit 
Source0:        https://gerrit-releases.storage.googleapis.com/gerrit-%{vertag}.war
Source1:        init.d-%{name}
Source2:        sysconfig-%{name}
Source4:        gerrit.logrotate
NoSource:       0
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Requires:       java >= 1.7.0
Requires:       jpackage-utils
Requires:       logrotate
Requires:       git
Requires:       mysql-connector-java >= 5.0

%if 0%{?suse_version}
Requires(pre):  shadow
Requires(post): chkconfig initscripts
Requires(pre):  chkconfig initscripts
Requires(pre):  shadow-utils

Gerrit is a web based code review system, facilitating online code reviews for projects using the Git version control system.

Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.

Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer. This functionality enables a more centralized usage of Git. 

#%setup -q 
cp %{S:0} %{name}.war

# sles is a bit nagging about version of bytecode so lets make it quiet :)

%{__mkdir} -p -m 755 %{buildroot}%{gerrit_site_home}/bin
(cd %{buildroot}%{gerrit_site_home} ; ln -s %{_sysconfdir}/gerrit etc)
%{__mkdir} -p -m 755 %{buildroot}%{gerrit_site_home}/cache
%{__mkdir} -p -m 755 %{buildroot}%{gerrit_site_home}/data
%{__mkdir} -p -m 755 %{buildroot}%{gerrit_site_home}/lib
(cd %{buildroot}%{gerrit_site_home} ; ln -s %{_localstatedir}/log/gerrit/ logs)
%{__mkdir} -p -m 755 %{buildroot}%{gerrit_site_home}/plugins
%{__mkdir} -p -m 755 %{buildroot}%{gerrit_site_home}/static
%{__mkdir} -p -m 755 %{buildroot}%{gerrit_site_home}/tmp
%{__mkdir} -p -m 755 %{buildroot}%{gerrit_home}/.gerritcodereview

%{__install} -p -m 755 %{name}.war %{buildroot}%{gerrit_site_home}/bin/
# config
%{__mkdir} -p %{buildroot}%{_sysconfdir}/gerrit
%{__mkdir} -p %{buildroot}%{_sysconfdir}/gerrit/mail

# logs
%{__mkdir} -p %{buildroot}%{_localstatedir}/log/gerrit/

# sysconfig and init
%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
%{__mkdir} -p %{buildroot}%{_sysconfdir}/init.d
%{__install} -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{name}
%{__install} -Dm 644 %{SOURCE2} %{buildroot}%{gl_sysconfdir}%{name}
%{__mkdir} -p %{buildroot}%_sbindir
%if 0%{?suse_version}
(cd %{buildroot}%_sbindir ; ln -s %{_sysconfdir}/init.d/%{name} rc%{name})
%{__install} -Dm 644 %{SOURCE4}  %{buildroot}%{_sysconfdir}/logrotate.d/%name

%{__mkdir} -p %{buildroot}/var/run/gerrit

# create gerrit group
if ! getent group gerrit >/dev/null; then
        groupadd -r gerrit

# create gerrit user
if ! getent passwd gerrit >/dev/null; then
        useradd -r -g gerrit -d %{gerrit_home} \
            -s /bin/bash -c "Gerrit Code Review" gerrit

%if 0%{?suse_version}
/sbin/chkconfig --add gerrit
if [ -L %{_javadir}/mysql-connector-java.jar ]; then 
  if [ ! -L %{gerrit_site_home}/lib/mysql-connector-java.jar ] && [ ! -f %{gerrit_site_home}/lib/mysql-connector-java.jar ]; then
    cd %{gerrit_site_home}/lib; ln -s %{_javadir}/mysql-connector-java.jar %{gerrit_site_home}/lib/mysql-connector-java.jar 

%if 0%{?suse_version}
if [ $1 -eq 0 ]; then
  /sbin/service gerrit stop >/dev/null 2>&1
  /sbin/chkconfig --del gerrit

%if 0%{?suse_version}

#%doc COPYING build_date README.markdown
%dir %attr(-,gerrit,gerrit) %{gerrit_home} 
%dir %attr(-,gerrit,gerrit) %{gerrit_home}/.gerritcodereview 
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/bin
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/data
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/etc
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/cache
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/data
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/lib
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/logs
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/plugins
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/static
%dir %attr(-,gerrit,gerrit) %{gerrit_site_home}/tmp
%dir %{_sysconfdir}/gerrit
%dir %attr(-,gerrit,gerrit) %{_sysconfdir}/gerrit/mail
%dir %attr(-,gerrit,gerrit) %{_localstatedir}/log/gerrit
%config(noreplace) %{gl_sysconfdir}gerrit
%config(noreplace) %{_sysconfdir}/logrotate.d/%name
#%doc README.markdown
%dir %attr(-,gerrit,gerrit) %{_localstatedir}/run/gerrit
%if 0%{?suse_version}