Home > Linux > Mercurial-2.X – create RPM distribution for Red Hat EL 4

Mercurial-2.X – create RPM distribution for Red Hat EL 4

January 19th, 2013 Leave a comment Go to comments

I’ve summarized few articles which described how to create Mercurial 2.4.2 RPM distributions.

RHEL4 have outdated Python 2.3 in base. But, Mercurial not support it since 1.2.1.
Let’s build them all in redistributable RPM.

AT first, need to build Python. I’ve used this article but made several changes in python.spec file (Prefix changed to /opt/python27; Fixed symlinks to python-2.7 binary; Personalization etc). You can check it if needed – http://i.org.ua/profit/linux/python27.spec

Next, build Python docutils package. I’ve used old v0.8.1 version because new versions have build problem.

Finally, build Mercurial. Good article I’ve used. Using default mercurial.spec shipped with mercurial distribution but changed python prefix to python->python27, python-docutils->docutils. My mercurial.spec file. You will get Mercurial script in /usr/bin/hg after RPM installed.

# Prepare envitonment
mkdir /var/tmp/obj
cd /var/tmp/obj

# Build Python
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 -O /usr/src/redhat/SOURCE/Python-2.7.3.tar.bz2
rpmbuild -bb /var/tmp/obj/mercurial.rhel4/python27.spec
#RPM placed into /usr/src/redhat/RPMS/i386/ directory

#Install python
rpm -ivh /usr/src/redhat/RPMS/i386/python27-2.7.3-001_el4.i386.rpm
rpm -ivh /usr/src/redhat/RPMS/i386/python27-devel-2.7.3-genesys_el4.i386.rpm

export PATH=/opt/python27/bin:${PATH}

# Build Docutils
curl 'http://docutils.svn.sourceforge.net/viewvc/docutils/tags/docutils-0.8.1/?view=tar' | tar -xzvf -
cd docutils-0.8.1/
python2.7 setup.py bdist_rpm --packager="Alexander Ignatyev (alex@doma.in)" --release=001_el4 --vendor="Company "
mv docutils-0.8.1/dist/docutils-0.8.1-001_el4.noarch.rpm /usr/src/redhat/RPMS/i386/

# Install docutils RPM
rpm -ivh /usr/src/redhat/RPMS/i386/docutils-0.8.1-001_el4.noarch.rpm

# Mercurial
cd /var/tmp/obj
curl http://mercurial.selenic.com/release/mercurial-2.4.2.tar.gz | tar -xzvf -
cp /var/tmp/obj/mercurial-2.4.2.spec mercurial-2.4.2/contrib/
tar cvpf mercurial-2.4.2.tar.gz mercurial-2.4.2
rpmbuild -tb mercurial-2.4.2.tar.gz

# Cleanup
rpm -ev docutils python27-devel
rm -rf /var/tmp/obj/mercurial-2.4.2 /var/tmp/obj/mercurial-2.4.2.tar.gz /var/tmp/obj/docutils-0.8.1

PS: I’ve used three ways to create RPMs on Red Hat EL4.

Categories: Linux Tags: , , , ,
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.