File mercurial.spec of Package mercurial.5472

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


Name:           mercurial
Version:        2.8.2
Release:        0
Summary:        Scalable Distributed SCM
License:        GPL-2.0+
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
# PATCH-FIX-OPENSUSE mercurial-2.6.3-ssl.diff lnussel@suse.de -- fallback to system default ca path
Patch4:         mercurial-2.8-ssl.diff
# PATCH-FIX-UPSTREAM mercurial-CVE-2014-9462.patch tiwai@suse.de - CVE-2014-9462, bnc#923070
Patch5:         mercurial-CVE-2014-9462.patch
# PATCH-FIX-UPSTREAM CVE-2016-3630, bsc#973175
Patch101:       hg-CVE-2016-3630-parsers_detect_short_records.patch
Patch102:       hg-CVE-2016-3630-parsers_fix_list_sizing_rounding_error.patch
# PATCH-FIX-UPSTREAM CVE-2016-3068, bsc#973177
Patch103:       hg-CVE-2016-3068-subrepo_set_GIT_ALLOW_PROTOCOL.patch
# PATCH-FIX-UPSTREAM Preliminary change for CVE-2016-3069, bsc#973176
Patch104:       hg-convert_allow_customizing_git_remote_prefix.patch
Patch105:       hg-convert_fix_git_convert_using_servers_branches.name 
# PATCH-FIX-UPSTREAM CVE-2016-3069, bsc#973176
Patch106:       hg-CVE-2016-3069-01-convert_add_new_non_clowny_interface.patch
Patch107:       hg-CVE-2016-3069-02-convert_rewrite_calls_to_Git.patch
Patch108:       hg-CVE-2016-3069-03-convert_dead_code_removal.patch
Patch110:       hg-CVE-2016-3069-05-convert_test_for_shell_injection.patch
# PATCH-FIX-UPSTREAM CVE-2016-3105, bsc#978391
Patch111:       hg-CVE-2016-3105.patch
# PATCH-FIX-UPSTREAM bsc#1043063 CVE-2017-9462
Patch120:       mercurial-CVE-2017-9462.patch
# PATCH-FIX-UPSTREAM CVE-2017-1000116 CVE-2017-1000115 bsc#1052696 bsc#1053344
Patch201:       CVE-2017-1000116-0001.patch
Patch202:       CVE-2017-1000116-0002.patch
Patch203:       CVE-2017-1000116-0003.patch
Patch204:       CVE-2017-1000116-0004.patch
Patch209:       CVE-2017-1000116-0009.patch
Patch210:       CVE-2017-1000116-0010.patch
Patch211:       CVE-2017-1000116-0011.patch
Patch212:       CVE-2017-1000116-0012.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  python-devel
%if %suse_version < 1210
BuildRequires:  docutils
%else
BuildRequires:  python-docutils
%endif
BuildRequires:  python-xml
Requires:       python-xml
%if 0%{?sles_version}
Requires:       openssl-certs
%else
Requires:       ca-certificates
%endif
Recommends:     %{name}-lang
Provides:       hg = %{version}
%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

%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
%patch1 -p1
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%patch2 -p0
%endif
%patch3 -p1
%if 0%{?suse_version} > 1230
%patch4 -p1
%endif
%patch5 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch110 -p1
%patch111 -p1
%patch120 -p1
%patch201 -p1
%patch202 -p1
%patch203 -p1
%patch204 -p1
%patch209 -p1
%patch210 -p1
%patch211 -p1
%patch212 -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}
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 contrib/mergetools.hgrc %{buildroot}%{_sysconfdir}/mercurial/hgrc.d/mergetools.rc
%if 0%{?suse_version} >= 1130 && 0%{?suse_version} <= 1230
install -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/mercurial/hgrc.d/cacerts.rc
%endif
%fdupes -s %{buildroot}%{_prefix}

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

%files lang -f hg.lang

%files
%defattr(-, root, root)
%doc README CONTRIBUTORS COPYING hgweb.cgi contrib/sample.hgrc
%{_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*
%{python_sitearch}/*

%changelog