Bug 678475 - Make mozconfig-find always return an absolute path. Patch adapted from code by Hiroyuki Ikezoe <hiikezoe@mozilla-japan.org>. r=ted COMM70_20110817_RELBRANCH THUNDERBIRD_7_0b1_BUILD1_1 THUNDERBIRD_7_0b1_RELEASE
authorSiddharth Agarwal <sid.bugzilla@gmail.com>
Sun, 14 Aug 2011 22:04:46 +0530
branchCOMM70_20110817_RELBRANCH
changeset 73044 322371615e79127cf6dae072396a3aab637d3c2d
parent 73035 00f56713eab670da1a4aca2425ea81c6830052ac
child 73045 b42dc15605216d30c29668a2864d09e0d082a31c
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersted
bugs678475
milestone7.0
Bug 678475 - Make mozconfig-find always return an absolute path. Patch adapted from code by Hiroyuki Ikezoe <hiikezoe@mozilla-japan.org>. r=ted
build/autoconf/mozconfig-find
--- a/build/autoconf/mozconfig-find
+++ b/build/autoconf/mozconfig-find
@@ -41,16 +41,37 @@
 #    command-line. The .mozconfig file is searched for in the 
 #    order:
 #       if $MOZCONFIG is set, use that.
 #       Otherwise, use $TOPSRCDIR/.mozconfig
 #       Otherwise, use $HOME/.mozconfig
 #
 topsrcdir=$1
 
+abspath() {
+  if uname -s | grep -q MINGW; then
+    # We have no way to figure out whether we're in gmake or pymake right
+    # now. gmake gives us Unix-style paths while pymake gives us Windows-style
+    # paths, so attempt to handle both.
+    regexes='^\([A-Za-z]:\|\\\\\|\/\) ^\/'
+  else
+    regexes='^\/'
+  fi
+
+  for regex in $regexes; do
+    if echo $1 | grep -q $regex; then
+      echo $1
+      exit 0
+    fi
+  done
+
+  # If we're at this point, we have a relative path
+  echo `pwd`/$1
+}
+
 for _config in "$MOZCONFIG" \
                "$MOZ_MYCONFIG"
 do
   if [ -n "$_config" ] && ! [ -f "$_config" ]; then
     echo "Specified MOZCONFIG \"$_config\" does not exist!"
     exit 1
   fi
 done
@@ -61,12 +82,12 @@ for _config in "$MOZCONFIG" \
                "$topsrcdir/mozconfig" \
                "$topsrcdir/mozconfig.sh" \
                "$topsrcdir/myconfig.sh" \
                "$HOME/.mozconfig" \
                "$HOME/.mozconfig.sh" \
                "$HOME/.mozmyconfig.sh"
 do
   if test -f "$_config"; then
-    echo "$_config";
+    echo `abspath $_config`
     exit 0
   fi
 done