File mercurial.spec of Package mercurial

# spec file for package mercurial
# Copyright (c) 2021 SUSE LLC
# 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

%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()")}
Name:           mercurial
Version:        5.8
Release:        0
Summary:        Scalable Distributed SCM
License:        GPL-2.0-or-later
Group:          Development/Tools/Version Control
Source1:        cacerts.rc
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 -- locales are found in /usr/share/locale
Patch2:         mercurial-locale-path-fix.patch
BuildRequires:  fdupes
BuildRequires:  python3
BuildRequires:  python3-devel
BuildRequires:  python3-xml
Requires:       python3-curses
Requires:       python3-xml
Recommends:     %{name}-lang
Provides:       hg = %{version}
%if 0%{?suse_version} < 1210
BuildRequires:  docutils
BuildRequires:  python3-docutils
%if 0%{?sles_version}
Requires:       openssl-certs
Requires:       ca-certificates
%if 0%{?with_tests}
Source90:       tests.blacklist
BuildRequires:  bzr
BuildRequires:  git
BuildRequires:  gpg
BuildRequires:  ncurses-devel
BuildRequires:  python3-Pygments
BuildRequires:  subversion-python
BuildRequires:  unzip
#BuildRequires:  python-pyflakes

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


%setup -q
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%patch2 -p1

sed -i -e '1s@env @@' contrib/hgk

chmod 644 hgweb.cgi

make %{?_smp_mflags} all PYTHON=python3
make %{?_smp_mflags} -C contrib/chg all

make install PREFIX="%{_prefix}" DESTDIR=%{buildroot} PYTHON=python3
make -C contrib/chg install PREFIX="%{_prefix}" DESTDIR=%{buildroot}

# Move locales to proper location
mkdir -p %{buildroot}%{_datadir}/locale
mv %{buildroot}%{python3_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}%{_datadir}/bash-completion/completions/hg
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}
make %{?_smp_mflags} tests TESTFLAGS="-v --blacklist=%{SOURCE90}" PYTHON=python3

%files lang -f hg.lang

%license COPYING
%doc README.rst CONTRIBUTORS hgweb.cgi
%dir %{_sysconfdir}/mercurial
%dir %{_sysconfdir}/mercurial/hgrc.d
%config %{_sysconfdir}/mercurial/hgrc.d/*

openSUSE Build Service is sponsored by