[get_source.sh]hg version verifying requires LANGUAGE=en

bitter_fox bitterfoxc at gmail.com
Thu Aug 21 09:44:09 UTC 2014

Currently get_source.sh verifies hg version but it does not work well
except  English environment.

For example, my language environment is Japanese and get_source.sh prints
error message:
ERROR: Could not determine Mercurial version of /usr/bin/hg

The cause of this issue is following in get_source.sh.
hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed
SCM (version \([^+]*\).*)\$@\1 at p'`"

The sed command is depending on English description, but "hg --version"
prints message in the language of the parent environment.
In this case, "hg --version" prints the version message in Japansese such
as following and the sed command cannot pick up version numbers.
Mercurial - 分散構成管理ツール(バージョン 2.8.2)

You should specify the printing language as English:
diff -r 2bfa8c391bdc get_source.sh
--- a/get_source.sh     Wed Aug 20 14:11:35 2014 +0200
+++ b/get_source.sh     Wed Aug 20 23:51:29 2014 +0900
@@ -67,7 +67,7 @@
   error "Could not locate Mercurial command"

-hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial
Distributed SCM (version \([^+]*\).*)\$@\1 at p'`"
+hgversion="`LANGUAGE=en hg --version 2> /dev/null | sed -n -e 's@^Mercurial
Distributed SCM (version \([^+]*\).*)\$@\1 at p'`"
 if [ "x${hgversion}" = "x" ] ; then
   error "Could not determine Mercurial version of $hgwhere"

Shinya Yoshida

More information about the build-dev mailing list