File mercurial.spec of Package mercurial.7756

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


%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
Name:           mercurial
Version:        4.2.3
Release:        0
Summary:        Scalable Distributed SCM
License:        GPL-2.0-or-later
Group:          Development/Tools/Version Control
Url:            https://www.mercurial-scm.org/
Source:         https://www.mercurial-scm.org/release/mercurial-%{version}.tar.gz
Source1:        cacerts.rc
Source2:        https://www.mercurial-scm.org/release/mercurial-%{version}.tar.gz.asc
Source3:        mercurial.keyring
Source99:       mercurial-rpmlintrc
Patch0:         mercurial-hgk-path-fix.diff
# PATCH-FIX-OPENSUSE mercurial-docutils-compat.diff -- Fix for new docutils options not available on 11.1 and older
Patch1:         mercurial-docutils-compat.diff
# PATCH-FIX-OPENSUSE mercurial-locale-path-fix.patch saschpe@suse.de -- locales are found in /usr/share/locale
Patch2:         mercurial-locale-path-fix.patch
Patch301:       hg-subrepo-bsc1071715-fix01.patch
Patch302:       hg-subrepo-bsc1071715-fix02.patch
Patch303:       hg-subrepo-bsc1071715-fix03.patch
Patch304:       hg-subrepo-bsc1071715-fix04.patch
Patch305:       hg-subrepo-bsc1071715-fix05.patch
Patch306:       hg-subrepo-bsc1071715-fix06.patch
Patch307:       hg-subrepo-bsc1071715-fix07.patch
Patch401:       hg-r36753.patch
Patch402:       hg-r36754.patch
Patch403:       hg-r36755.patch
Patch404:       hg-CVE-2018-1000132.patch
BuildRequires:  fdupes
BuildRequires:  python-devel
BuildRequires:  python-xml
Requires:       python
Requires:       python-curses
Requires:       python-xml
Recommends:     %{name}-lang
Provides:       hg = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} < 1210
BuildRequires:  docutils
%else
BuildRequires:  python-docutils
%endif
%if 0%{?sles_version}
Requires:       openssl-certs
%else
Requires:       ca-certificates
%endif
%if 0%{?with_tests}
Source90:       tests.blacklist
BuildRequires:  bzr
BuildRequires:  git
BuildRequires:  gpg
BuildRequires:  ncurses-devel
BuildRequires:  python-Pygments
BuildRequires:  python-openssl
BuildRequires:  subversion-python
BuildRequires:  unzip
#BuildRequires:  python-pyflakes
%endif

%description
Mercurial is a fast, lightweight source control management system
designed for efficient handling of very large distributed projects.

%lang_package

%prep
%setup -q
%patch0
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%patch1
%endif
%patch2 -p1
%patch301 -p1
%patch302 -p1
%patch303 -p1
%patch304 -p1
%patch305 -p1
%patch306 -p1
%patch307 -p1
%patch401 -p1
%patch402 -p1
%patch403 -p1
%patch404 -p1
chmod 644 hgweb.cgi

%build
make %{?_smp_mflags} 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 -Dm0644 contrib/bash_completion %{buildroot}%{_sysconfdir}/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 %{SOURCE1} %{buildroot}%{_sysconfdir}/mercurial/hgrc.d/cacerts.rc
%fdupes -s %{buildroot}%{_prefix}

%if 0%{?with_tests}
%check
make %{?_smp_mflags} tests TESTFLAGS="-v --blacklist=%{SOURCE90}"
%endif

%files lang -f hg.lang
%defattr(-,root,root)

%files
%defattr(-, root, root)
%doc README CONTRIBUTORS COPYING hgweb.cgi
%{_bindir}/*
%{_sysconfdir}/bash_completion.d/*
%{_datadir}/zsh/
%dir %{_sysconfdir}/mercurial
%dir %{_sysconfdir}/mercurial/hgrc.d
%config %{_sysconfdir}/mercurial/hgrc.d/*
%{_datadir}/emacs
%{_datadir}/xemacs
%{_mandir}/man1/hg.1*
%{_mandir}/man5/hgignore.5*
%{_mandir}/man5/hgrc.5*
%{_mandir}/man8/hg-ssh.8*
%{python_sitearch}/*

%changelog
openSUSE Build Service is sponsored by