File gitolite.spec of Package gitolite

#
# spec file for package gitolite
#
# Copyright (c) 2012 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/
#


Name:           gitolite
Summary:        Highly flexible server for git directory version tracker
Version:        2.3.1
Release:        0
License:        GPL-2.0+
Group:          Development/Tools/Version Control
URL:            http://github.com/sitaramc/gitolite
Source0:        %{name}-%{version}.tar.bz2
Source10:       %{name}.permissions
Source11:       README.SuSE
Patch0:         %{name}-gitweb.patch
Patch1:         %{name}-rpm-system.patch
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  git
Requires:       git-daemon >= 1.6.6
%if 0%{?suse_version} > 1110
%{perl_requires}
%else
Requires:       perl = %{perl_version}
%endif
Requires:       %{name}-skel = %{version}
Conflicts:      gitosis

%description
Gitolite is an access control layer on top of git, which allows access control
down to the branch level, including specifying who can and cannot rewind a given
branch.

%package skel
Summary:        gitolite home dir skeleton files
Group:          Development/Tools/Version Control

%description skel
This package holds the files needed for git user homedir.

%prep
%setup -q
%__cp -a %{S:10} %{S:11} .
%patch -P0
%patch -P1
mv doc/{CHANGELOG,COPYING} .

%build

%install
# Directory structure
%{__install} -m 0755 -d %{buildroot}%{perl_vendorlib}
%{__install} -m 0755 -d %{buildroot}%{_datadir}/%{name}
%{__install} -m 0750 -d %{buildroot}%{_sysconfdir}/skelgit/projects

#__install -m 0644 -D %%{S:10} %%{buildroot}%%{_sysconfdir}/permissions.d/%%{name}

pushd src
# install binaries
%{__install} -D -m0755 sshkeys-lint %{buildroot}%{_bindir}/sshkeys-lint
for i in $(ls -1 gl*); do
  %{__install} -m0755 $i %{buildroot}%{_bindir}/$i
done
popd

# install perl modules
%{__install} -m 0644 src/*.pm %{buildroot}%{perl_vendorlib}
%{__cp} -a conf hooks %{buildroot}%{_datadir}/%{name}

# install .gitolite.rc
%{__install} -D -m0644 conf/example.gitolite.rc %{buildroot}%{_sysconfdir}/skelgit/.gitolite.rc

%pre
# Create user and group on the system if necessary
# default group: git
%{_sbindir}/groupadd -r git 2> /dev/null || :
# default user: git
%{_sbindir}/useradd -c "git version ctrl" -d /srv/git -G git -g git \
  -m -k %{_sysconfdir}/skelgit -r -s /bin/bash git -p $(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 10 | xargs) 2> /dev/null || :
# if apache user is not in git group, add it
%{_sbindir}/groupmod -A wwwrun git 2>/dev/null || :
# fix permission on /srv/git
%{_bindir}/chmod 750 /srv/git || :
# fix owner on /srv/git
%{_bindir}/chown git:git /srv/git || :

%post
#{run_permissions}

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc CHANGELOG COPYING README*
%doc doc
%doc %{name}.permissions
#config %%{_sysconfdir}/permissions.d/%%{name}
%{_bindir}/gl-*
%{_bindir}/sshkeys-lint
%{perl_vendorlib}/*.pm
%{_datadir}/%{name}

%files skel
%defattr(-,root,root)
%dir %{_sysconfdir}/skelgit
%dir %attr(750,root,root) %{_sysconfdir}/skelgit/projects
%config %{_sysconfdir}/skelgit/.%{name}.rc

%changelog

openSUSE Build Service is sponsored by