git/git.spec

478 lines
15 KiB
RPMSpec

#
# spec file for package git
#
# Copyright (c) 2016 SUSE LINUX 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 gitexecdir %_libexecdir/git
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
%if 0%{?suse_version} >= 1210
%bcond_without git_gnome_keyring
%else
%bcond_with git_gnome_keyring
%endif
Name: git
Version: 2.9.2
Release: 0
Summary: Fast, scalable, distributed revision control system
License: GPL-2.0
Group: Development/Tools/Version Control
Url: http://git-scm.com
Source0: https://www.kernel.org/pub/software/scm/git/%{name}-%{version}.tar.xz
Source7: https://www.kernel.org/pub/software/scm/git/%{name}-%{version}.tar.sign
Source1: apache2-gitweb.conf
Source2: sysconfig.git-daemon
Source3: git-daemon.init
Source4: git.xinetd
Source5: usr.share.git-web.gitweb.cgi
Source6: susefirewall-git-daemon
Source8: %name.keyring
Source9: %{name}-gui.desktop
Source10: %{name}-gui.png
Patch3: completion-wordbreaks.diff
# CVE-2011-2186, bnc#698456
Patch4: git-prevent_xss-default.diff
# fix broken bash copmletion with colored egrep (bnc#779536)
Patch5: git-bash-completion-egrep-color-fix.diff
# cook up tcsh completion to be installable (bnc#853183)
Patch6: git-tcsh-completion-fixes.diff
# adapt paths in zsh completion (bnc#853183)
Patch7: git-zsh-completion-fixes.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: apache2
BuildRequires: asciidoc
BuildRequires: curl
BuildRequires: fdupes
BuildRequires: gpg2
BuildRequires: libcurl-devel
BuildRequires: libexpat-devel
%if %{with git_gnome_keyring}
BuildRequires: libgnome-keyring-devel
%endif
BuildRequires: libopenssl-devel
BuildRequires: pcre-devel
BuildRequires: perl-Error
BuildRequires: python
BuildRequires: sgml-skel
BuildRequires: tcsh
BuildRequires: update-desktop-files
BuildRequires: xmlto
BuildRequires: xz
Requires: git-core = %{version}
Recommends: git-svn git-cvs git-email gitk git-gui
Suggests: git-daemon git-web
%description
Git is a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations and
full access to internals.
This package itself only provides the README of git but with the
packages it requires, it brings you a complete Git environment
including GTK and email interfaces and tools for importing source code
repositories from other revision control systems such as subversion,
CVS, and GNU arch.
%package core
Summary: Core git tools
Group: Development/Tools/Version Control
Requires: less
Requires: openssh
Requires: perl-Error
%if 0%{?suse_version} >= 1230
%perl_requires
%else
Requires: perl-base = %{perl_version}
%endif
Requires: rsync
Obsoletes: git-remote-helpers < %{version}
%description core
Git is a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations and
full access to internals.
These are the core tools with minimal dependencies.
%package doc
Summary: Documentation for the Git version control system
Group: Documentation/HTML
%if 0%{?suse_version} >= 1210
BuildArch: noarch
%endif
%description doc
Git is a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations and
full access to internals.
This subpackage contains Git's documentation in text/plain and
text/html formats. (The manpages are in the main package.)
%package svn
Summary: Git tools for importing Subversion repositories
Group: Development/Tools/Version Control
Requires: git-core = %{version}
%if 0%{suse_version} < 1140
Requires: perl-TermReadKey
%else
Requires: perl-Term-ReadKey
%endif
Requires: subversion
Requires: subversion-perl
%description svn
Tools for importing Subversion repositories to the Git version control
system.
%package cvs
Summary: Git tools for importing CVS repositories
Group: Development/Tools/Version Control
Requires: cvs
Requires: cvsps
Requires: git-core = %{version}
Requires: perl-DBD-SQLite
%description cvs
Tools for importing CVS repositories to the Git version control system.
%if %{with git_gnome_keyring}
%package credential-gnome-keyring
Summary: Git credential backend using the GNOME keyring as storage
Group: Development/Tools/Version Control
Requires: git-core = %{version}
Requires: gnome-keyring
%description credential-gnome-keyring
A Git credential backend which uses the GNOME keyring as storage.
%endif
%package arch
Summary: Git tools for importing Arch repositories
Group: Development/Tools/Version Control
Requires: git-core = %{version}
# Requires: tla
%description arch
Tools for importing GNU Arch repositories to the GIT version control
system.
%package email
Summary: Git tools for sending email
Group: Development/Tools/Version Control
Requires: git-core = %{version}
# For sending mails over secure SMTP:
Recommends: perl-Net-SMTP-SSL, perl-Authen-SASL
%description email
Email interface for the GIT version control system.
%package daemon
Summary: Simple Server for Git Repositories
Group: Development/Tools/Version Control
Requires: git-core = %{version}
PreReq: /usr/sbin/useradd %fillup_prereq %insserv_prereq
%description daemon
A really simple TCP git daemon. In the default configuration it allows
read only access to repositories in /srv/git/ that contain the
'git-daemon-export-ok' file.
%package -n gitk
Summary: Git revision tree visualiser
Group: Development/Tools/Version Control
Requires: git-core = %{version}
Requires: tk >= 8.4
Supplements: packageand(git-core:tk)
%description -n gitk
Grapical tool for visualization of revision trees of projects
maintained in the Git version control system. It name gitk indicates
that it's written using the Tk Widget set.
A simple Tk based graphical interface for common Git operations is
found in the package git-gui.
%package gui
Summary: Grapical tool for common git operations
Group: Development/Tools/Version Control
Requires: git-core = %{version}
Requires: tk >= 8.4
Supplements: packageand(git-core:tk)
%description gui
A Tcl/Tk based graphical user interface to Git. git-gui focuses on
allowing users to make changes to their repository by making new
commits, amending existing ones, creating branches, performing local
merges, and fetching/pushing to remote repositories.
Unlike gitk, git-gui focuses on commit generation and single file
annotation, and does not show project history. It does however supply
menu actions to start a gitk session from within git-gui.
%package web
Summary: Git Web Interface
Group: Development/Tools/Version Control
Requires: git-core = %{version}
Supplements: packageand(git-core:apache2)
%description web
CGI script that allows browsing git repositories via web interface.
The apache2 configuration contained in this package installs a virtual
directory /git/ that calls the cgi script.
%prep
%setup -q
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build
cat > .make <<'EOF'
#!/bin/bash
make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" \
GITWEB_CONFIG="/etc/gitweb.conf" \
GITWEB_PROJECTROOT="/srv/git" \
WITH_OWN_SUBPROCESS_PY=YesPlease \
DESTDIR=$RPM_BUILD_ROOT \
NO_CROSS_DIRECTORY_HARDLINKS=1 \
NO_INSTALL_HARDLINKS=1 \
USE_LIBPCRE=1 \
V=1 \
prefix=%{_prefix} mandir=%{_mandir} \
gitexecdir=%{gitexecdir} \
htmldir=%{_docdir}/git-core \
"$@"
EOF
#
chmod 755 .make
./.make all %{?_smp_mflags}
%{!?_without_docs: ./.make doc}
%if %{with git_gnome_keyring}
./.make -C contrib/credential/gnome-keyring
%endif
./.make -C contrib/subtree/
%install
./.make install %{!?_without_docs: install-doc}
### git-web
cp gitweb/INSTALL INSTALL.gitweb
cp gitweb/README README.gitweb
install -d %{buildroot}/usr/share/git-web
install -d %{buildroot}/etc/apache2/conf.d
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/apache2/conf.d/gitweb.conf
### git-daemon
install -d -m 755 $RPM_BUILD_ROOT/etc/init.d
install -m 755 %{SOURCE3} $RPM_BUILD_ROOT/etc/init.d/git-daemon
install -d -m 755 $RPM_BUILD_ROOT%{_sbindir}
ln -s ../../etc/init.d/git-daemon $RPM_BUILD_ROOT%{_sbindir}/rcgit-daemon
install -d -m 755 $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.git-daemon
install -d -m 755 $RPM_BUILD_ROOT/srv/git
install -d -m 755 $RPM_BUILD_ROOT/etc/xinetd.d
install -m 644 %{S:4} $RPM_BUILD_ROOT/etc/xinetd.d/git
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 %{S:6} $RPM_BUILD_ROOT/%{_fwdefdir}/git-daemon
###
./.make -C contrib/subtree install
%{!?_without_docs: ./.make -C contrib/subtree install-doc}
(find $RPM_BUILD_ROOT%{_bindir} -type f -o -type l | grep -vE "archimport|svn|cvs|email|gitk|git-daemon|gui" | sed -e s@^$RPM_BUILD_ROOT@@) > bin-man-doc-files
(find $RPM_BUILD_ROOT%{gitexecdir} ! -type d | grep -vE "archimport|svn|cvs|email|gitk|git-daemon|gui" | sed -e s@^$RPM_BUILD_ROOT@@) >> bin-man-doc-files
(find $RPM_BUILD_ROOT%{_mandir} $RPM_BUILD_ROOT/Documentation -type f | grep -vE "archimport|svn|git-cvs|email|gitk|git-daemon|gui" | sed -e s@^$RPM_BUILD_ROOT@@ -e 's/$/*/' ) >> bin-man-doc-files
( pushd perl
perl Makefile.PL
make -f perl.mak DESTDIR=%{buildroot} install_vendor
)
rm -rf %{buildroot}/usr/lib/perl5/site_perl
%perl_process_packlist
find $RPM_BUILD_ROOT/%_mandir -type f -print0 | xargs -0 chmod 644
install -m 644 -D contrib/completion/git-completion.bash $RPM_BUILD_ROOT/etc/bash_completion.d/git.sh
install -m 644 -D contrib/completion/git-prompt.sh $RPM_BUILD_ROOT/etc/bash_completion.d/git-prompt.sh
# contrib/credential
%if %{with git_gnome_keyring}
install -m 755 -D contrib/credential/gnome-keyring/git-credential-gnome-keyring $RPM_BUILD_ROOT/%{gitexecdir}/git-credential-gnome-keyring
%endif
# contrib/workdir
install -m 755 -D contrib/workdir/git-new-workdir %{buildroot}/%{_bindir}
# process tcsh completion
(cd contrib/completion
mkdir -p $RPM_BUILD_ROOT/usr/share/tcsh
tcsh ./git-completion.tcsh
install -m 644 -D git.csh $RPM_BUILD_ROOT/etc/profile.d/git.csh
)
# zsh completion
install -m 644 -D contrib/completion/git-completion.zsh $RPM_BUILD_ROOT/etc/zsh_completion.d/_git
#
# apparmor profile for git-web
#
install -d -m 755 $RPM_BUILD_ROOT/etc/apparmor.d
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/etc/apparmor.d
#
# create predictable symlinks to make apparmor profile work
for i in git git-upload-archive git-receive-pack; do
rm $RPM_BUILD_ROOT%{_bindir}/$i
ln -s %{gitexecdir}/git $RPM_BUILD_ROOT%{_bindir}/$i
done
if ! test -f $RPM_BUILD_ROOT%{gitexecdir}/git-add; then
echo "git-add is not a regular file, apparmor profile won't work!" >&2
exit 1
fi
mkdir -p "%buildroot/%_docdir/git"
cp -a README.md COPYING Documentation/*.txt "%buildroot/%_docdir/git/"
%{!?_without_docs: cp -a Documentation/*.html "%buildroot/%_docdir/git/"}
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/applications
install -m 644 %{SOURCE9} $RPM_BUILD_ROOT%{_datadir}/applications
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_datadir}/pixmaps
%suse_update_desktop_file $RPM_BUILD_ROOT%{_datadir}/applications/%{name}-gui.desktop
%find_lang %{name}
cat %{name}.lang >>bin-man-doc-files
# use symlinks instead of hardlinks in sub-commands
%fdupes -s $RPM_BUILD_ROOT
%check
./.make %{?_smp_mflags} test
%pre daemon
if ! /usr/bin/getent passwd git-daemon >/dev/null; then
/usr/sbin/useradd -r -d /var/lib/empty -s /bin/false -c "git daemon" -g nogroup git-daemon || :
fi
%post daemon
%{fillup_and_insserv -n git-daemon}
%postun daemon
%{restart_on_update git-daemon}
%{insserv_cleanup}
%preun daemon
%{stop_on_removal git-daemon}
%files
%defattr(-,root,root)
%dir %_docdir/%name
%_docdir/%name/README.md
%files doc
%defattr(-,root,root)
%_docdir/%name/
%exclude %_docdir/%name/README.md
%files svn
%defattr(-,root,root)
%{gitexecdir}/*svn*
%doc Documentation/*svn*.txt
%{!?_without_docs: %{_mandir}/man1/*svn*.1*}
%{!?_without_docs: %doc Documentation/*svn*.html }
%files cvs
%defattr(-,root,root)
%doc Documentation/*git-cvs*.txt
%{_bindir}/git-cvs*
%{gitexecdir}/*cvs*
%{!?_without_docs: %{_mandir}/man1/*cvs*.1*}
%{!?_without_docs: %doc Documentation/*git-cvs*.html }
%if %{with git_gnome_keyring}
%files credential-gnome-keyring
%defattr(-,root,root)
%{gitexecdir}/git-credential-gnome-keyring
%endif
%files arch
%defattr(-,root,root)
%doc Documentation/git-archimport.txt
%{gitexecdir}/git-archimport
%{!?_without_docs: %{_mandir}/man1/git-archimport.1*}
%{!?_without_docs: %doc Documentation/git-archimport.html }
%files email
%defattr(-,root,root)
%doc Documentation/*email*.txt
%{gitexecdir}/*email*
%{!?_without_docs: %{_mandir}/man1/*email*.1*}
%{!?_without_docs: %doc Documentation/*email*.html }
%files daemon
%defattr(-,root,root)
%doc Documentation/git-daemon.txt
%{gitexecdir}/git-daemon
/etc/init.d/git-daemon
%{_sbindir}/rcgit-daemon
%dir /srv/git
/var/adm/fillup-templates/sysconfig.git-daemon
%{!?_without_docs: %{_mandir}/man1/git-daemon.1*}
%{!?_without_docs: %doc Documentation/git-daemon.html }
%config(noreplace) /etc/xinetd.d/git
%config %{_fwdefdir}/*
%files -n gitk
%defattr(-,root,root)
%doc Documentation/*gitk*.txt
%{_bindir}/gitk
/usr/share/gitk
%{!?_without_docs: %{_mandir}/man1/*gitk*.1*}
%{!?_without_docs: %doc Documentation/*gitk*.html }
%files gui
%defattr(-,root,root)
%doc Documentation/*gui*.txt
%{gitexecdir}/git-gui*
/usr/share/git-gui
%{!?_without_docs: %{_mandir}/man1/*gui*.1*}
%{!?_without_docs: %doc Documentation/*gui*.html }
%{_datadir}/applications/%{name}-gui.desktop
%{_datadir}/pixmaps/%{name}-gui.png
%files web
%defattr(-,root,root)
%doc README.gitweb INSTALL.gitweb
%config(noreplace) /etc/apache2/conf.d/gitweb.conf
/usr/share/gitweb
/etc/apparmor.d
%files core -f bin-man-doc-files
%defattr(-,root,root)
%{_datadir}/git-core/
%dir %{gitexecdir}
%dir %{gitexecdir}/mergetools
%{_bindir}/git-new-workdir
%if 0%{?suse_version} < 1140
/var/adm/perl-modules/%{name}
%endif
%{perl_vendorlib}/Git.pm
%{perl_vendorlib}/Git/
%{perl_vendorarch}/auto/Git/
/etc/bash_completion.d/*.sh
/usr/share/tcsh
/etc/profile.d/*.csh
/etc/zsh_completion.d
%doc README.md COPYING Documentation/*.txt
%{!?_without_docs: %doc Documentation/*.html Documentation/howto}
%{!?_without_docs: %doc Documentation/technical}
%changelog