How to Install Mercurial-1.4.1 on CentOS-5.4

NOTE: I wrote a new post to install Mercurial-1.5.4. Please refer to it!

As version numbers of both CentOS and Mercurial increase, my former post for Mercurial-1.1.1 and CentOS-5.2 seems to have been obsoleted already. Because somebody asked me, I tried installing the newest version of mercurial on CentOS-5.4. Here I make a memo of that.

This memo is useful for those who want to use RPM installation on CentOS. (As you may know, Mercurial can be installed by using Python setup module without RPM.)

And this memo is based on the former post. So if you don't have packages needed by Mercurial-1.4, please see the post, and install lacked packages using RPM.

cp mercurial-1.4.1.tar.gz mercurial-1.4.1.tar.gz.orig
tar zxvf mercurial-1.4.1.tar.gz
cd mercurial-1.4.1/
cp contrib/mercurial.spec contrib/mercurial.spec.orig
sed -i -e's/snapshot/1\.4\.1/' contrib/mercurial.spec
sed -i -e's/, docutils >= 0.5//' contrib/mercurial.spec
cd ../
tar cvf - mercurial-1.4.1 | gzip > mercurial-1.4.1.tar.gz
rpmbuild -tb mercurial-1.4.1.tar.gz
rpm -Uvh /usr/src/redhat/RPMS/i386/mercurial-1.4.1-0.i386.rpm
hg --version

Thank you for comments to the former post.

10 件のコメント:

Agustín さんのコメント...

The first post was very useful for me. Very good work!

Agustín さんのコメント...

I just try it with mercurial 1.4.2.
I replace everything in the commands with 1.4.2 (including -e's/snapshot/1\.4\.2/') but I still have to change it manually from mercurial.spec, I´m not sure why.
Except for that, it work great, as far as I can tell.

Piotrek G. さんのコメント...

That's great! Thanks!

What's more I didn't know a "-i" switch in sed. I always used some tmp output file.

One tip for you:
instead of

tar cvf - mercurial-1.4.1 | gzip > mercurial-1.4.1.tar.gz

you can use

tar zcvf mercurial-1.4.1.tar.gz mercurial-1.4.1

Less processes and more convenient.

Thanks once again.

moririn-japan さんのコメント...


Thank you for your comment and advice. It must be a smart way which reduces our task!

By the way, dividing a sequential flow into two processes sometimes increases the processing speed.

Actually single tar process costs more than 1 sec, while two process use less than 1 sec on my Macbook Pro [Core2Duo + SATA].

I guess the result comes from multi-core CPU and IO wait.

Anyway, I appreciate the smarter and more simple way!

I use it from now on. :)

Garen さんのコメント...

Need to have rpmbuild available too:

sudo yum install rpm-build

moririn-japan さんのコメント...


That's right! Thank you. :)

lativ さんのコメント...

I used this receipt to install mercurial -1.5.1 on OEL 5.4(RHEL 5 based) - it works, just change release numbers :)

moririn-japan さんのコメント...


Thank you so much for your report! I'll try the new version of Mercurial you wrote.

gadelkareem さんのコメント...

# rpmbuild -tb mercurial-1.6.3.tar.gz
got error
error: Failed build dependencies:
python-docutils >= 0.5 is needed by mercurial-1.6.3-0.i386

moririn-japan さんのコメント...


Thanks for the comment. Could you refer to the newest post?