# -*- coding: ascii; tab-width: 4; x-counterpart: mercurial.info -*-
Info2: <<
Package: mercurial-py%type_pkg[python]
Version: 5.8
Revision: 1
Distribution: <<
	(%type_pkg[python] = 36 ) 10.9,
	(%type_pkg[python] = 36 ) 10.10,
	(%type_pkg[python] = 36 ) 10.11,
	(%type_pkg[python] = 36 ) 10.12,
	(%type_pkg[python] = 36 ) 10.13,
	(%type_pkg[python] = 36 ) 10.14,
	(%type_pkg[python] = 36 ) 10.14.5,
	(%type_pkg[python] = 36 ) 10.15
<<
Type: python (2.7 3.6 3.7 3.8)
Depends: <<
	ca-bundle,
	python%type_pkg[python],
	(%type_pkg[python] = 2.7) python27 (>= 2.7.9-1)
<<
BuildDepends: <<
	flag-sort,
	docutils-py%type_pkg[python] (>= 0.7-1),
	gettext-tools
<<
Conflicts: chg (<< 0.3-1)
Replaces: chg (<< 0.3-1)
# These are only needed when converting from the appropriate VCS.
# pygments-py%type_pkg[python] is only needed for the highlight extension.
# pyopenssl-py%type_pkg[python] is needed by hgweb for ssl support.
Suggests: bzr-py%type_pkg[python], darcs, git, arch-tla, monotone, svn-swig-py%type_pkg[python], svn19, pygments-py%type_pkg[python], pyopenssl-py%type_pkg[python]
Source: http://www.mercurial-scm.org/release/mercurial-%v.tar.gz
Source-Checksum: SHA256(fc5d6a8f6478d88ef83cdd0ab6d86ad68ee722bbdf4964e6a0b47c3c6ba5309f)

PatchScript: <<
	%{default_script}
	perl -pi -e 's|/etc/|%p/etc/|g' doc/hg.1* doc/hgrc.5*
	# Change to work with our svn19.
	perl -pi -e "s|b'svn'|b'svn19'|; s|b'svnadmin'|b'svnadmin19'|" hgext/convert/subversion.py
	# Bug in check-translation.py
	perl -pi -e 's/import re/import re\nimport os/' i18n/check-translation.py
<<
SetCC: flag-sort gcc
CompileScript: <<
%p/bin/python%type_raw[python] setup.py build
cd doc; make PREFIX=%p PYTHON=%p/bin/python%type_raw[python]
<<
InstallScript: <<
# Bin
%p/bin/python%type_raw[python] setup.py install --root %d
/usr/bin/find contrib -name '*.pyc' -delete
cp contrib/hgk %i/bin/
cd %i/bin; for filename in *; do mv -v $filename $filename-py%type_pkg[python]; done;

# Docs
cd doc; make PREFIX=%p PYTHON=%p/bin/python%type_raw[python] DESTDIR=%d install
cd %i/share/man; for i in 1 5 8; do cd "man$i"; for filename in *; \
  do cutname=`echo "$filename" | cut -d "." -f 1 -`; \
  mv -v $filename $cutname-py%type_pkg[python].$i; done; cd ..; done;

mkdir -p %i/etc/mercurial
# Need to point to CA certs now.
echo '[web]\ncacerts = %p/etc/ssl/certs/ca-bundle.crt' >> %i/etc/mercurial/hgrc-py%type_pkg[python]

# Extras
mkdir -p %i/etc/bash_completion.d
mv contrib/bash_completion %i/etc/bash_completion.d/hg-py%type_pkg[python]

mkdir -p %i/share/emacs/site-lisp
mv contrib/mercurial.el %i/share/emacs/site-lisp/mercurial-py%type_pkg[python].el
mv contrib/mq.el %i/share/emacs/site-lisp/mq-py%type_pkg[python].el

rm -Rf contrib/win32 contrib/macosx contrib/buildrpm
mkdir -p %i/share/doc/%n/contrib
cp -r contrib/* %i/share/doc/%n/contrib/
<<

# Mercurial can fail if LC_LANG isn't set correctly.
# Set HGENCODING to a known good value. User can always override.
# HG needs to be set for hgk to work.
RuntimeVars: <<
	HGENCODING: UTF-8
	HG: %p/bin/hg
<<

PostInstScript: <<
# Bin
# Default to using py27 for now since 3x is beta-quality.
pyversion=%type_pkg[python]
if [ $pyversion == 27 ]; then
  pyversion=999
fi
for name in hg hgk; do update-alternatives --install %p/bin/$name $name %p/bin/$name-py%type_pkg[python] $pyversion; done;

update-alternatives --install %p/etc/bash_completion.d/hg hg_completion %p/etc/bash_completion.d/hg-py%type_pkg[python] $pyversion
update-alternatives --install %p/etc/mercurial/hgrc hgrc %p/etc/mercurial/hgrc-py%type_pkg[python] $pyversion

update-alternatives --install %p/share/emacs/site-lisp/mercurial.el mercurial.el %p/share/emacs/site-lisp/mercurial-py%type_pkg[python].el $pyversion
update-alternatives --install %p/share/emacs/site-lisp/mq.el mq.el %p/share/emacs/site-lisp/mq-py%type_pkg[python].el $pyversion

for filename in hg.1 hgignore.5 hgrc.5 hg-ssh.8; do name=`echo $filename | cut -d "." -f 1 -`; i=`echo $filename | cut -d "." -f 2 -`; \
  update-alternatives --install %p/share/man/man$i/$name.$i $name.$i %p/share/man/man$i/$name-py%type_pkg[python].$i $pyversion; done;
<<

PreRmScript: <<
if [ $1 != "upgrade" ]; then

  for name in hg hgk; do update-alternatives --remove $name %p/bin/$name-py%type_pkg[python]; done;

  update-alternatives --remove hg_completion %p/etc/bash_completion.d/hg-py%type_pkg[python]
  update-alternatives --remove hgrc %p/etc/mercurial/hgrc-py%type_pkg[python]

  update-alternatives --remove mercurial.el %p/share/emacs/site-lisp/mercurial-py%type_pkg[python].el
  update-alternatives --remove mq.el %p/share/emacs/site-lisp/mq-py%type_pkg[python].el

  for filename in hg.1 hgignore.5 hgrc.5 hg-ssh.8; do name=`echo $filename | cut -d "." -f 1 -`; i=`echo $filename | cut -d "." -f 2 -`; \
    update-alternatives --remove $name.$i %p/share/man/man$i/$name-py%type_pkg[python].$i; done;
fi
<<

UseMaxBuildJobs: true
InfoTest: <<
	TestDepends: <<
		svn-swig-py%type_pkg[python] (>= 1.9.0-1),
		svn19
	<<
	TestScript: <<
		#!/bin/bash -ev
		# Make svn links to svn19.
		ln -s %p/bin/svn19 svn
		ln -s %p/bin/svnadmin19 svnadmin
		ln -s %p/bin/svnsync19 svnsync
		ln -s %p/bin/svnversion19 svnversion
		#ln -s %p/bin/pyflakes-py%type_pkg[python] pyflakes
		export PATH="%b:$PATH"
		cd tests
		# test-check-pyflakes.t fails due to expecting to be run from an hg working dir.
		# http://bz.selenic.com/show_bug.cgi?id=4087
		rm test-check-pyflakes.t
		# Don't run gpg tests.
		rm test-gpg.t
		# Skip test-convert-cvs-synthetic.t since it currently has unpredictable output order. This is only a test issue.
		# http://bz.selenic.com/show_bug.cgi?id=3782
		#rm test-convert-cvs-synthetic.t
		# test-patchbomb.t started failing with 3.0.2.
		# Seems to be broken glob matching.
		#rm test-patchbomb.t
		# Output order doesn't match expected results. Seems harmless.
		#rm test-bundle2-pushback.t
		perl -pi -e 's/localhost /\* /' test-bad-pull.t
		perl -pi -e 's/handshake failure/handshake failure\|Protocol wrong type for socket/' test-https.t
		rm test-lfs-serve-access.t
		%p/bin/python%type_raw[python] run-tests.py $MAKEFLAGS || exit 1
	<<
	TestSuiteSize: large
<<

DocFiles: README.rst COPYING CONTRIBUTORS doc/*.html
ConfFiles: %p/etc/mercurial/hgrc-py%type_pkg[python]
Description: Lightweight distributed SCM 
DescDetail: <<
Mercurial is a fast, lightweight source control management 
system designed for efficient handling of very large 
distributed projects. Features include:

 * O(1) delta-compressed file storage and retrieval scheme
 * Complete cross-indexing of file and changesets for 
   efficient exploration of project history
 * Robust SHA1-based integrity checking and append-only 
   storage model
 * Decentralized development model with arbitrary merging 
   between trees
 * High-speed HTTP-based network merge protocol
 * Easy-to-use command-line interface
 * Integrated stand-alone web interface
 * Small Python codebase
 * GPL license
<<
DescUsage: <<
The Bookmarks extension is now always enabled. If you previously
had it enabled with 'hgext.bookmarks =' in your hgrc file, please
remove that line.

Python-using packages that need this must Depend on
'mercurial-py%type_pkg[python]' to ensure that the python versions
match. Packages that just need the 'hg' command line tool can Depend
on just 'mercurial' if they don't care about python version.
<<
DescPackaging: <<
	Formerly maintained by Pepe Barbe <pepe.barbe@gmail.com>

	Using included libzstd and associated python bindings, per
	upstream advice.
<<
License: GPL2+
Homepage: https://www.mercurial-scm.org
Maintainer: Daniel Johnson <daniel@daniel-johnson.org>
<<