[PATCH] mercurial.spec: Update to version from Fedora 12

Mads Kiilerich mads at kiilerich.com
Sat Nov 7 20:38:27 CST 2009


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1257647894 -3600
# Node ID 53e10949e76c20c1111e4af8444ee0af4157006a
# Parent  819e6c7085fc12d2a9ed4b0f22ce7636e00a28e7
mercurial.spec: Update to version from Fedora 12

A response to mpms whish that rpm-based distros should use the spec in
Mercurial:

This patch updates mercurial.spec to the one currently used by Neal Becker in
Fedora 12.

The diff reflects different choices and trade-offs in the packaging. We can't
suggest that Fedora uses Mercurials spec; that would be too much regression for
Fedora.

The specs from Suse and Mandriva will show other differences - and other
platform-specific choices.

I suggest _not_ applying this patch but staying where we are, possibly with
some minor improvements.

diff --git a/contrib/mercurial-site-start.el b/contrib/mercurial-site-start.el
new file mode 100644
--- /dev/null
+++ b/contrib/mercurial-site-start.el
@@ -0,0 +1,7 @@
+(autoload 'hg-mode "mercurial" "HG mode." t)
+(autoload 'hg-help-overview "mercurial" "HG help." t)
+
+(autoload 'mq-mode "mq"
+  "MQ mode for Mercurial repositories with an MQ patch queue." t)
+(autoload 'mq-edit-mode "mq"
+  "MQ edit mode for editing patch descriptions." t)
diff --git a/contrib/mercurial.spec b/contrib/mercurial.spec
--- a/contrib/mercurial.spec
+++ b/contrib/mercurial.spec
@@ -1,32 +1,81 @@
-Summary: Mercurial -- a distributed SCM
+%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
+
+Summary: A fast, lightweight distributed source control management system 
 Name: mercurial
 Version: snapshot
-Release: 0
+Release: 1%{?dist}
 License: GPLv2
 Group: Development/Tools
-URL: http://mercurial.selenic.com/
-Source0: http://mercurial.selenic.com/release/%{name}-%{version}.tar.gz
+URL: http://www.selenic.com/mercurial/
+Source0: http://www.selenic.com/mercurial/release/%{name}-%{version}.tar.gz
+Source1: mercurial-site-start.el
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-# From the README:
-#
-#   Note: some distributions fails to include bits of distutils by
-#   default, you'll need python-dev to install. You'll also need a C
-#   compiler and a 3-way merge tool like merge, tkdiff, or kdiff3.
-#
-# python-devel provides an adequate python-dev.  The merge tool is a
-# run-time dependency.
-#
-BuildRequires: python >= 2.4, python-devel, make, gcc, docutils >= 0.5
+BuildRequires: python python-devel asciidoc xmlto
+BuildRequires: emacs emacs-el pkgconfig
+Requires: python
 Provides: hg = %{version}-%{release}
 
-%define pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))')
-%define emacs_lispdir %{_datadir}/emacs/site-lisp
-
 %description
 Mercurial is a fast, lightweight source control management system designed
 for efficient handling of very large distributed projects.
 
+Quick start: http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart
+Tutorial: http://www.selenic.com/mercurial/wiki/index.cgi/Tutorial
+Extensions: http://www.selenic.com/mercurial/wiki/index.cgi/CategoryExtension
+
+%define pkg mercurial
+#%define pkgname Foo
+
+# If the emacs-el package has installed a pkgconfig file, use that to determine
+# install locations and Emacs version at build time, otherwise set defaults.
+%if %($(pkg-config emacs) ; echo $?)
+%define emacs_version 22.1
+%define emacs_lispdir %{_datadir}/emacs/site-lisp
+%define emacs_startdir %{_datadir}/emacs/site-lisp/site-start.d
+%else
+%define emacs_version %{expand:%(pkg-config emacs --modversion)}
+%define emacs_lispdir %{expand:%(pkg-config emacs --variable sitepkglispdir)}
+%define emacs_startdir %{expand:%(pkg-config emacs --variable sitestartdir)}
+%endif
+
+%package -n emacs-%{pkg}
+Summary:	Mercurial version control system support for Emacs
+Group:		Applications/Editors
+Requires:	hg = %{version}-%{release}, emacs-common
+Requires:       emacs(bin) >= %{emacs_version}
+Obsoletes:	%{pkg}-emacs
+
+%description -n emacs-%{pkg}
+Contains byte compiled elisp packages for %{pkg}.
+To get started: start emacs, load hg-mode with M-x hg-mode, and show 
+help with C-c h h
+
+%package -n emacs-%{pkg}-el
+Summary:        Elisp source files for %{pkg} under GNU Emacs
+Group:          Applications/Editors
+Requires:       emacs-%{pkg} = %{version}-%{release}
+
+%description -n emacs-%{pkg}-el
+This package contains the elisp source files for %{pkg} under GNU Emacs. You
+do not need to install this package to run %{pkg}. Install the emacs-%{pkg}
+package to use %{pkg} with GNU Emacs.
+
+%package hgk
+Summary:	Hgk interface for mercurial
+Group:		Development/Tools
+Requires:	hg = %{version}-%{release}, tk
+
+
+%description hgk
+A Mercurial extension for displaying the change history graphically
+using Tcl/Tk.  Displays branches and merges in an easily
+understandable way and shows diffs for each revision.  Based on
+gitk for the git SCM.
+
+Adds the "hg view" command.  See 
+http://www.selenic.com/mercurial/wiki/index.cgi/UsingHgk for more
+documentation.
+
 %prep
 %setup -q
 
@@ -35,10 +84,13 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
-python setup.py install --root $RPM_BUILD_ROOT --prefix %{_prefix}
+python setup.py install -O1 --root $RPM_BUILD_ROOT --prefix %{_prefix} --record=%{name}.files
 make install-doc DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir}
 
-install contrib/hgk          $RPM_BUILD_ROOT%{_bindir}
+grep -v 'hgk.py*' < %{name}.files > %{name}-base.files
+grep 'hgk.py*' < %{name}.files > %{name}-hgk.files
+
+install -D contrib/hgk       $RPM_BUILD_ROOT%{_libexecdir}/mercurial/hgk
 install contrib/convert-repo $RPM_BUILD_ROOT%{_bindir}/mercurial-convert-repo
 install contrib/hg-ssh       $RPM_BUILD_ROOT%{_bindir}
 install contrib/git-viz/{hg-viz,git-rev-tree} $RPM_BUILD_ROOT%{_bindir}
@@ -52,35 +104,63 @@
 install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial
 
 mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
-install contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}
+
+pushd contrib
+for file in mercurial.el mq.el; do
+  emacs -batch -l mercurial.el --no-site-file -f batch-byte-compile $file
+  install -p -m 644 $file ${file}c $RPM_BUILD_ROOT%{emacs_lispdir}
+  rm ${file}c
+done
+popd
+
+
 
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d
+
+mkdir -p $RPM_BUILD_ROOT%{emacs_startdir} && install -m644 %SOURCE1 $RPM_BUILD_ROOT%{emacs_startdir}
+
+cat >hgk.rc <<EOF
+[extensions]
+# enable hgk extension ('hg help' shows 'view' as a command)
+hgk=
+
+[hgk]
+path=%{_libexecdir}/mercurial/hgk
+EOF
+install hgk.rc $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d
+
 install contrib/mergetools.hgrc $RPM_BUILD_ROOT%{_sysconfdir}/mercurial/hgrc.d/mergetools.rc
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%files
+%files -f %{name}-base.files
 %defattr(-,root,root,-)
 %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html doc/ja *.cgi contrib/*.fcgi
 %doc %attr(644,root,root) %{_mandir}/man?/hg*.gz
 %doc %attr(644,root,root) contrib/*.svg contrib/sample.hgrc
 %{_sysconfdir}/bash_completion.d/mercurial.sh
 %{_datadir}/zsh/site-functions/_mercurial
-%{_datadir}/emacs/site-lisp/mercurial.el
-%{_bindir}/hg
-%{_bindir}/hgk
 %{_bindir}/hg-ssh
 %{_bindir}/hg-viz
 %{_bindir}/git-rev-tree
 %{_bindir}/mercurial-convert-repo
-%dir %{_sysconfdir}/bash_completion.d/
-%dir %{_datadir}/zsh/site-functions/
 %dir %{_sysconfdir}/mercurial
 %dir %{_sysconfdir}/mercurial/hgrc.d
-%config(noreplace) %{_sysconfdir}/mercurial/hgrc.d/mergetools.rc
-%if "%{?pythonver}" != "2.4"
-%{_libdir}/python%{pythonver}/site-packages/%{name}-*-py%{pythonver}.egg-info
-%endif
-%{_libdir}/python%{pythonver}/site-packages/%{name}
-%{_libdir}/python%{pythonver}/site-packages/hgext
+%{_sysconfdir}/mercurial/hgrc.d/mergetools.rc
+%dir %{python_sitearch}/mercurial
+%dir %{python_sitearch}/hgext
+
+%files -n emacs-%{pkg}
+%{emacs_lispdir}/*.elc
+%{emacs_startdir}/*.el
+
+%files -n emacs-%{pkg}-el
+%{emacs_lispdir}/*.el
+
+%files hgk -f %{name}-hgk.files
+%{_libexecdir}/mercurial/
+%{_sysconfdir}/mercurial/hgrc.d/hgk.rc
+
+#%%check
+#cd tests && python run-tests.py


More information about the Mercurial-devel mailing list