File mercurial.spec of Package mercurial
#
# spec file for package mercurial
#
# Copyright (c) 2011 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: mercurial
Summary: Scalable Distributed SCM
Version: 1.9.3
Release: 4
License: GPLv2+
Group: Development/Tools/Version Control
Url: http://mercurial.selenic.com/
Source: http://mercurial.selenic.com/release/mercurial-%{version}.tar.gz
Source1: cacerts.rc
Source99: rpmlintrc
Patch0: mercurial-hgk-path-fix.diff
# PATCH-FIX_SLE mercurial-sle10-inotify-fixes.diff --
Patch1: mercurial-sle10-inotify-fixes.diff
# PATCH-FIX-OPENSUSE mercurial-docutils-compat.diff -- Fix for new docutils options not available on 11.1 and older
Patch2: mercurial-docutils-compat.diff
# PATCH-FIX-OPENSUSE mercurial-locale-path-fix.patch saschpe@suse.de -- locales are found in /usr/share/locale
Patch3: mercurial-locale-path-fix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
%if 0%{?fedora_version} || 0%{?suse_version} || 0%{?rhel_version}
BuildRequires: docutils
%else
BuildRequires: python-docutils
%endif
# require rcs for 3-way "merge" command.
Requires: rcs
%if 0%{?suse_version}
BuildRequires: python-xml
Requires: python-xml
%if 0%{?suse_version} > 1020
BuildRequires: fdupes
%endif
%if 0%{?suse_version} >= 1130
Requires: ca-certificates
%endif
%py_requires
Recommends: %{name}-lang
%endif
Provides: hg = {version}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%if 0%{?with_tests}
Source90: tests.blacklist
BuildRequires: gpg ncurses-devel unzip
BuildRequires: bzr git subversion-python
BuildRequires: python-Pygments python-openssl
#BuildRequires: python-pyflakes
%endif
%description
Mercurial is a fast, lightweight source control management system
designed for efficient handling of very large distributed projects.
%if 0%{?suse_version} > 1100
%lang_package
%endif
%prep
%setup -q
%patch0
%patch1 -p1
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%patch2 -p0
%endif
%patch3 -p1
chmod 644 hgweb.cgi
%build
make all
%install
make install PREFIX="%{_prefix}" DESTDIR=%{buildroot}
# Move locales to proper location
mkdir -p %{buildroot}%{_datadir}/locale
mv %{buildroot}%{python_sitearch}/mercurial/locale/* %{buildroot}%{_datadir}/locale
%find_lang hg
# Install stuff in contrib
install -m0755 contrib/hgk %{buildroot}%{_bindir}
install -m0755 contrib/convert-repo %{buildroot}%{_bindir}
sed -i "1i #!/usr/bin/python" contrib/shrink-revlog.py # Add a she-bang line to executable script
install -m0755 contrib/shrink-revlog.py %{buildroot}%{_bindir}
install -Dm0644 contrib/bash_completion %{buildroot}/etc/bash_completion.d/mercurial.sh
install -Dm0644 contrib/zsh_completion %{buildroot}%{_datadir}/zsh/site-functions/_mercurial
mkdir -p %{buildroot}%{_datadir}/{x,}emacs/site-lisp
install -m0644 contrib/*.el %{buildroot}%{_datadir}/emacs/site-lisp
install -m0644 contrib/*.el %{buildroot}%{_datadir}/xemacs/site-lisp
install -Dm0644 contrib/mergetools.hgrc %{buildroot}%{_sysconfdir}/mercurial/hgrc.d/mergetools.rc
%if 0%{?suse_version} >= 1130
install -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/mercurial/hgrc.d/cacerts.rc
%endif
%if 0%{?suse_version} > 1020
%fdupes -s %{buildroot}%{_prefix}
%endif
%if 0%{?with_tests}
%check
make tests TESTFLAGS="-v --blacklist=%{SOURCE90}"
%endif
%clean
rm -rf %{buildroot}
%if 0%{?suse_version} > 1100
%files lang -f hg.lang
%files
%else
%files -f hg.lang
%endif
%defattr(-, root, root)
%doc README CONTRIBUTORS COPYING hgweb.cgi contrib/sample.hgrc
%{_bindir}/*
/etc/bash_completion.d/*
%{_datadir}/zsh/
%dir /etc/mercurial
%dir /etc/mercurial/hgrc.d
%config /etc/mercurial/hgrc.d/*
%{_datadir}/emacs
%{_datadir}/xemacs
%{_mandir}/man1/hg.1*
%{_mandir}/man5/hgignore.5*
%{_mandir}/man5/hgrc.5*
%{python_sitearch}/*
%changelog