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