5ecaba
Summary: A fast, lightweight Source Control Management system
5ecaba
Name: mercurial
5ecaba
Version: 6.2
5ecaba
Release: 1%{?dist}
5ecaba
5ecaba
# Release: 1.rc1%%{?dist}
5ecaba
5ecaba
%define upstreamversion %{version}
5ecaba
5ecaba
License: GPLv2+
5ecaba
URL: https://mercurial-scm.org/
5ecaba
Source0: https://www.mercurial-scm.org/release/%{name}-%{upstreamversion}.tar.gz
5ecaba
Source1: mercurial-site-start.el
5ecaba
Source2: blacklist
5ecaba
# Patch to fix errors in the testsuite with Python 3.6
5ecaba
Patch0:  ssl_fix_python36_compat.patch
5ecaba
Patch1:  ssl_another_fix_python36_compat.patch
5ecaba
BuildRequires: make
5ecaba
BuildRequires: bash-completion
5ecaba
BuildRequires: emacs-el
5ecaba
BuildRequires: emacs-nox
5ecaba
BuildRequires: gcc
5ecaba
BuildRequires: gettext
5ecaba
BuildRequires: pkgconfig
5ecaba
BuildRequires: python3-devel
5ecaba
BuildRequires: python3-setuptools
5ecaba
BuildRequires: python3-docutils
5ecaba
5ecaba
Provides: hg = %{version}-%{release}
5ecaba
Requires: python3 <= 3.9
5ecaba
Requires: emacs-filesystem
5ecaba
Recommends: python3-fb-re2
5ecaba
5ecaba
%description
5ecaba
Mercurial is a fast, lightweight source control management system designed
5ecaba
for efficient handling of very large distributed projects.
5ecaba
5ecaba
Quick start: https://www.mercurial-scm.org/wiki/QuickStart
5ecaba
Tutorial: https://www.mercurial-scm.org/wiki/Tutorial
5ecaba
Extensions: https://www.mercurial-scm.org/wiki/UsingExtensions
5ecaba
5ecaba
5ecaba
%package hgk
5ecaba
Summary:    Hgk interface for mercurial
5ecaba
Requires:   hg = %{version}-%{release}
5ecaba
Requires:   tk
5ecaba
5ecaba
%description hgk
5ecaba
A Mercurial extension for displaying the change history graphically
5ecaba
using Tcl/Tk.  Displays branches and merges in an easily
5ecaba
understandable way and shows diffs for each revision.  Based on
5ecaba
gitk for the git SCM.
5ecaba
5ecaba
Adds the "hg view" command.  See
5ecaba
https://www.mercurial-scm.org/wiki/HgkExtension for more
5ecaba
documentation.
5ecaba
5ecaba
5ecaba
%package chg
5ecaba
Summary:    A fast Mercurial command without slow Python startup
5ecaba
Requires:   hg = %{version}-%{release}
5ecaba
5ecaba
%description chg
5ecaba
chg is a C wrapper for the hg command. Typically, when you type hg, a new
5ecaba
Python process is created, Mercurial is loaded, and your requested command runs
5ecaba
and the process exits.
5ecaba
5ecaba
With chg, a Mercurial command server background process is created that runs
5ecaba
Mercurial. When you type chg, a C program connects to that background process
5ecaba
and executes Mercurial commands.
5ecaba
5ecaba
%prep
5ecaba
%autosetup -p1 -n %{name}-%{upstreamversion}
5ecaba
5ecaba
# These are shipped as examples in /usr/share/docs and should not be executable
5ecaba
chmod -x hgweb.cgi contrib/hgweb.fcgi
5ecaba
5ecaba
%build
5ecaba
FORCE_SETUPTOOLS=1 PYTHON=%{python3} make all
5ecaba
5ecaba
# chg will invoke the 'hg' command - no direct Python dependency
5ecaba
pushd contrib/chg
5ecaba
make
5ecaba
popd
5ecaba
5ecaba
%install
5ecaba
%{python3} setup.py install -O1 --root %{buildroot} --prefix %{_prefix} --record=%{name}.files
5ecaba
make install-doc DESTDIR=%{buildroot} MANDIR=%{_mandir}
5ecaba
5ecaba
grep -v -e 'hgk.py*' \
5ecaba
        -e "%{python3_sitearch}/mercurial/" \
5ecaba
        -e "%{python3_sitearch}/hgext/" \
5ecaba
        -e "%{python3_sitearch}/hgext3rd/" \
5ecaba
        -e "%{python3_sitearch}/hgdemandimport/" \
5ecaba
        -e "%{_bindir}" \
5ecaba
        < %{name}.files > %{name}-base.files
5ecaba
grep 'hgk.py*' < %{name}.files > %{name}-hgk.files
5ecaba
5ecaba
install -D -m 755 contrib/hgk       %{buildroot}%{_libexecdir}/mercurial/hgk
5ecaba
install -m 755 contrib/hg-ssh       %{buildroot}%{_bindir}
5ecaba
5ecaba
bash_completion_dir=%{buildroot}$(pkg-config --variable=completionsdir bash-completion)
5ecaba
mkdir -p $bash_completion_dir
5ecaba
install -m 644 contrib/bash_completion $bash_completion_dir/hg
5ecaba
5ecaba
zsh_completion_dir=%{buildroot}%{_datadir}/zsh/site-functions
5ecaba
mkdir -p $zsh_completion_dir
5ecaba
install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial
5ecaba
5ecaba
mkdir -p %{buildroot}%{_emacs_sitelispdir}/mercurial
5ecaba
5ecaba
pushd contrib
5ecaba
for file in mercurial.el mq.el; do
5ecaba
  #emacs -batch -l mercurial.el --no-site-file -f batch-byte-compile $file
5ecaba
  %{_emacs_bytecompile} $file
5ecaba
  install -p -m 644 $file ${file}c %{buildroot}%{_emacs_sitelispdir}/mercurial
5ecaba
  rm ${file}c
5ecaba
done
5ecaba
popd
5ecaba
5ecaba
pushd contrib/chg
5ecaba
make install DESTDIR=%{buildroot} PREFIX=%{_usr} MANDIR=%{_mandir}/man1
5ecaba
popd
5ecaba
5ecaba
5ecaba
mkdir -p %{buildroot}%{_sysconfdir}/mercurial/hgrc.d
5ecaba
5ecaba
mkdir -p %{buildroot}%{_emacs_sitestartdir} && install -m644 %SOURCE1 %{buildroot}%{_emacs_sitestartdir}
5ecaba
5ecaba
cat >hgk.rc <
5ecaba
[extensions]
5ecaba
# enable hgk extension ('hg help' shows 'view' as a command)
5ecaba
hgk=
5ecaba
5ecaba
[hgk]
5ecaba
path=%{_libexecdir}/mercurial/hgk
5ecaba
EOF
5ecaba
install -m 644 hgk.rc %{buildroot}%{_sysconfdir}/mercurial/hgrc.d
5ecaba
5ecaba
cat > certs.rc <
5ecaba
# see: https://www.mercurial-scm.org/wiki/CACertificates
5ecaba
[web]
5ecaba
cacerts = /etc/pki/tls/certs/ca-bundle.crt
5ecaba
EOF
5ecaba
install -m 644 certs.rc %{buildroot}%{_sysconfdir}/mercurial/hgrc.d
5ecaba
5ecaba
mv %{buildroot}%{python3_sitearch}/mercurial/locale %{buildroot}%{_datadir}/locale
5ecaba
rm -rf %{buildroot}%{python3_sitearch}/mercurial/locale
5ecaba
5ecaba
%find_lang hg
5ecaba
5ecaba
pathfix.py -pni "%{python3}" %{buildroot}%{_bindir}/hg-ssh
5ecaba
5ecaba
%files -f %{name}-base.files -f hg.lang
5ecaba
%doc CONTRIBUTORS COPYING doc/README doc/hg*.html hgweb.cgi contrib/hgweb.fcgi contrib/hgweb.wsgi
5ecaba
%doc %attr(644,root,root) %{_mandir}/man?/hg*.gz
5ecaba
%doc %attr(644,root,root) contrib/*.svg
5ecaba
%dir %{_datadir}/zsh/
5ecaba
%dir %{_datadir}/zsh/site-functions/
5ecaba
%dir %{_sysconfdir}/mercurial
5ecaba
%dir %{_sysconfdir}/mercurial/hgrc.d
5ecaba
%{_datadir}/bash-completion/
5ecaba
%{_datadir}/zsh/site-functions/_mercurial
5ecaba
%{python3_sitearch}/mercurial/
5ecaba
%{python3_sitearch}/hgext/
5ecaba
%{python3_sitearch}/hgext3rd/
5ecaba
%{python3_sitearch}/hgdemandimport/
5ecaba
%{_emacs_sitelispdir}/mercurial
5ecaba
%{_emacs_sitestartdir}/*.el
5ecaba
%{_bindir}/hg
5ecaba
%{_bindir}/hg-ssh
5ecaba
5ecaba
%config(noreplace) %{_sysconfdir}/mercurial/hgrc.d/certs.rc
5ecaba
5ecaba
%files hgk -f %{name}-hgk.files
5ecaba
%{_libexecdir}/mercurial/
5ecaba
%config(noreplace) %{_sysconfdir}/mercurial/hgrc.d/hgk.rc
5ecaba
5ecaba
%files chg
5ecaba
%{_bindir}/chg
5ecaba
%doc %attr(644,root,root) %{_mandir}/man?/chg.*.gz
5ecaba
5ecaba
%check
5ecaba
cd tests && HGPYTHON3=1 %{python3} run-tests.py --blacklist %{SOURCE2}
5ecaba
5ecaba
%changelog
5ecaba
* Mon Aug 01 2022 Ondřej Pohořelský <opohorel@redhat.com> - 6.2-2
5ecaba
- Add forgotten mercurial-site-start.el
5ecaba
- Related: rhbz#2089849
5ecaba
5ecaba
* Fri Jul 29 2022 Ondřej Pohořelský <opohorel@redhat.com> - 6.2-1
5ecaba
- New release Mercurial 6.2
5ecaba
- Resolves: rhbz#2089849