Blame SOURCES/bltk-1.0.9-bltk_paths.patch

16f2df
--- orig-1.0.9/tools/analyzer/bltk_plot.sh	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ curr-1.0.9-1/tools/analyzer/bltk_plot.sh	2009-07-17 11:03:54.822883564 +0200
16f2df
@@ -41,23 +41,41 @@
16f2df
 
16f2df
 unalias -a
16f2df
 
16f2df
-set_bltk_root()
16f2df
+set_bltk_paths()
16f2df
 {
16f2df
-	PROG=`basename $0`
16f2df
+  WHICH_BLTK=`which bltk`
16f2df
+  RETCODE=$?
16f2df
 
16f2df
-	BLTK_ROOT=`dirname $0`
16f2df
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-	then
16f2df
-		BLTK_ROOT=`dirname $BLTK_ROOT`
16f2df
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-		then
16f2df
-			echo "Cannot determine bltk root, bltk tree corrupted."
16f2df
-			exit 2
16f2df
-		fi
16f2df
-	fi
16f2df
-	export BLTK_ROOT
16f2df
-	export BLTK_BIN=$BLTK_ROOT/bin
16f2df
-	export BLTK_TMP=$BLTK_ROOT/tmp
16f2df
+  if [[ $RETCODE = 0 ]]
16f2df
+  then
16f2df
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
16f2df
+    TMPCODE=$?
16f2df
+    if [[ $TMPCODE = 0 ]]
16f2df
+    then
16f2df
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
16f2df
+    else
16f2df
+      BLTK_MAIN=$WHICH_BLTK
16f2df
+    fi
16f2df
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
16f2df
+
16f2df
+    root_len=`echo $BLTK_ROOT | wc -c`
16f2df
+    main_len=`echo $BLTK_MAIN | wc -c`
16f2df
+    
16f2df
+    if [[ $root_len = $main_len ]]
16f2df
+    then
16f2df
+      RETCODE=2
16f2df
+    else
16f2df
+      [ -f "$BLTK_CONF" ] && . "$BLTK_CONF"
16f2df
+
16f2df
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
16f2df
+
16f2df
+      export BLTK_ROOT
16f2df
+      export BLTK_BIN=$BLTK_ROOT/bin
16f2df
+      export BLTK_TMP=$BLTK_HOME/tmp
16f2df
+    fi
16f2df
+  fi
16f2df
+
16f2df
+  return $RETCODE
16f2df
 }
16f2df
 
16f2df
 set_bltk_root
16f2df
--- orig-1.0.9/tools/analyzer/bltk_report_check.sh	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ curr-1.0.9-1/tools/analyzer/bltk_report_check.sh	2009-07-17 11:03:54.824880651 +0200
16f2df
@@ -41,26 +41,44 @@
16f2df
 
16f2df
 unalias -a
16f2df
 
16f2df
-set_bltk_root()
16f2df
+set_bltk_paths()
16f2df
 {
16f2df
-	PROG=`basename $0`
16f2df
+  WHICH_BLTK=`which bltk`
16f2df
+  RETCODE=$?
16f2df
 
16f2df
-	BLTK_ROOT=`dirname $0`
16f2df
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-	then
16f2df
-		BLTK_ROOT=`dirname $BLTK_ROOT`
16f2df
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-		then
16f2df
-			echo "Cannot determine bltk root, bltk tree corrupted."
16f2df
-			exit 2
16f2df
-		fi
16f2df
-	fi
16f2df
-	export BLTK_ROOT
16f2df
-	export BLTK_BIN=$BLTK_ROOT/bin
16f2df
-	export BLTK_TMP=$BLTK_ROOT/tmp
16f2df
+  if [[ $RETCODE = 0 ]]
16f2df
+  then
16f2df
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
16f2df
+    TMPCODE=$?
16f2df
+    if [[ $TMPCODE = 0 ]]
16f2df
+    then
16f2df
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
16f2df
+    else
16f2df
+      BLTK_MAIN=$WHICH_BLTK
16f2df
+    fi
16f2df
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
16f2df
+
16f2df
+    root_len=`echo $BLTK_ROOT | wc -c`
16f2df
+    main_len=`echo $BLTK_MAIN | wc -c`
16f2df
+    
16f2df
+    if [[ $root_len = $main_len ]]
16f2df
+    then
16f2df
+      RETCODE=2
16f2df
+    else
16f2df
+      [ -f "$BLTK_CONF" ] && . "$BLTK_CONF"
16f2df
+
16f2df
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
16f2df
+
16f2df
+      export BLTK_ROOT
16f2df
+      export BLTK_BIN=$BLTK_ROOT/bin
16f2df
+      export BLTK_TMP=$BLTK_HOME/tmp
16f2df
+    fi
16f2df
+  fi
16f2df
+
16f2df
+  return $RETCODE
16f2df
 }
16f2df
 
16f2df
-set_bltk_root
16f2df
+set_bltk_paths
16f2df
 
16f2df
 Failed="Failed !!!"
16f2df
 
16f2df
--- orig-1.0.9/tools/analyzer/bltk_report_compress.sh	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ curr-1.0.9-1/tools/analyzer/bltk_report_compress.sh	2009-07-17 11:03:54.818881008 +0200
16f2df
@@ -41,27 +41,44 @@
16f2df
 
16f2df
 unalias -a
16f2df
 
16f2df
-set_bltk_root()
16f2df
+set_bltk_paths()
16f2df
 {
16f2df
-	PROG=`basename $0`
16f2df
+  WHICH_BLTK=`which bltk`
16f2df
+  RETCODE=$?
16f2df
 
16f2df
-	BLTK_ROOT=`dirname $0`
16f2df
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-	then
16f2df
-		BLTK_ROOT=`dirname $BLTK_ROOT`
16f2df
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-		then
16f2df
-			echo "Cannot determine bltk root, bltk tree corrupted."
16f2df
-			exit 2
16f2df
-		fi
16f2df
-	fi
16f2df
-	export BLTK_ROOT
16f2df
-	export BLTK_BIN=$BLTK_ROOT/bin
16f2df
-	export BLTK_TMP=$BLTK_ROOT/tmp
16f2df
-	export BLTK_GET_REALPATH=$BLTK_BIN/bltk_get_realpath
16f2df
+  if [[ $RETCODE = 0 ]]
16f2df
+  then
16f2df
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
16f2df
+    TMPCODE=$?
16f2df
+    if [[ $TMPCODE = 0 ]]
16f2df
+    then
16f2df
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
16f2df
+    else
16f2df
+      BLTK_MAIN=$WHICH_BLTK
16f2df
+    fi
16f2df
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
16f2df
+
16f2df
+    root_len=`echo $BLTK_ROOT | wc -c`
16f2df
+    main_len=`echo $BLTK_MAIN | wc -c`
16f2df
+    
16f2df
+    if [[ $root_len = $main_len ]]
16f2df
+    then
16f2df
+      RETCODE=2
16f2df
+    else
16f2df
+      [ -f "$BLTK_CONF" ] && . "$BLTK_CONF"
16f2df
+
16f2df
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
16f2df
+
16f2df
+      export BLTK_ROOT
16f2df
+      export BLTK_BIN=$BLTK_ROOT/bin
16f2df
+      export BLTK_TMP=$BLTK_HOME/tmp
16f2df
+    fi
16f2df
+  fi
16f2df
+
16f2df
+  return $RETCODE
16f2df
 }
16f2df
 
16f2df
-set_bltk_root
16f2df
+set_bltk_paths
16f2df
 
16f2df
 CWD=$PWD
16f2df
 
16f2df
--- orig-1.0.9/tools/analyzer/bltk_report.sh	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ curr-1.0.9-1/tools/analyzer/bltk_report.sh	2009-07-17 11:03:54.820880959 +0200
16f2df
@@ -38,29 +38,51 @@
16f2df
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16f2df
 #
16f2df
 
16f2df
-
16f2df
 unalias -a
16f2df
 
16f2df
-set_bltk_root()
16f2df
+set_bltk_paths()
16f2df
 {
16f2df
-	PROG=`basename $0`
16f2df
-
16f2df
-	BLTK_ROOT=`dirname $0`
16f2df
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-	then
16f2df
-		BLTK_ROOT=`dirname $BLTK_ROOT`
16f2df
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-		then
16f2df
-			echo "Cannot determine bltk root, bltk tree corrupted."
16f2df
-			exit 2
16f2df
-		fi
16f2df
-	fi
16f2df
-	export BLTK_ROOT
16f2df
-	export BLTK_BIN=$BLTK_ROOT/bin
16f2df
-	export BLTK_TMP=$BLTK_ROOT/tmp
16f2df
-}
16f2df
+  WHICH_BLTK=`which bltk`
16f2df
+  RETCODE=$?
16f2df
 
16f2df
-set_bltk_root
16f2df
+  if [[ $RETCODE = 0 ]]
16f2df
+  then
16f2df
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
16f2df
+    TMPCODE=$?
16f2df
+    if [[ $TMPCODE = 0 ]]
16f2df
+    then
16f2df
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
16f2df
+    else
16f2df
+      BLTK_MAIN=$WHICH_BLTK
16f2df
+    fi
16f2df
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
16f2df
+
16f2df
+    root_len=`echo $BLTK_ROOT | wc -c`
16f2df
+    main_len=`echo $BLTK_MAIN | wc -c`
16f2df
+    
16f2df
+    if [[ $root_len = $main_len ]]
16f2df
+    then
16f2df
+      RETCODE=2
16f2df
+    else
16f2df
+      [ -f "$BLTK_CONF" ] && . "$BLTK_CONF"
16f2df
+
16f2df
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
16f2df
+
16f2df
+      export BLTK_ROOT
16f2df
+      export BLTK_BIN=$BLTK_ROOT/bin
16f2df
+      export BLTK_TMP=$BLTK_HOME/tmp
16f2df
+    fi
16f2df
+  fi
16f2df
+
16f2df
+  return $RETCODE
16f2df
+}
16f2df
+
16f2df
+set_bltk_paths
16f2df
+
16f2df
+if [ ! $? = 0 ]; then
16f2df
+  echo "ERROR in setting environmental paths" >&2
16f2df
+  exit 1
16f2df
+fi
16f2df
 
16f2df
 BLTK_GET_STAT_CMD="$BLTK_BIN/bltk_get_stat $stat_ign_lines_arg"
16f2df
 BLTK_CALC_CMD=$BLTK_BIN/bltk_calc
16f2df
--- orig-1.0.9/tools/analyzer/bltk_report_table.sh	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ curr-1.0.9-1/tools/analyzer/bltk_report_table.sh	2009-07-17 11:03:54.823880990 +0200
16f2df
@@ -41,26 +41,44 @@
16f2df
 
16f2df
 unalias -a
16f2df
 
16f2df
-set_bltk_root()
16f2df
+set_bltk_paths()
16f2df
 {
16f2df
-	PROG=`basename $0`
16f2df
+  WHICH_BLTK=`which bltk`
16f2df
+  RETCODE=$?
16f2df
 
16f2df
-	BLTK_ROOT=`dirname $0`
16f2df
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-	then
16f2df
-		BLTK_ROOT=`dirname $BLTK_ROOT`
16f2df
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-		then
16f2df
-			echo "Cannot determine bltk root, bltk tree corrupted."
16f2df
-			exit 2
16f2df
-		fi
16f2df
-	fi
16f2df
-	export BLTK_ROOT
16f2df
-	export BLTK_BIN=$BLTK_ROOT/bin
16f2df
-	export BLTK_TMP=$BLTK_ROOT/tmp
16f2df
+  if [[ $RETCODE = 0 ]]
16f2df
+  then
16f2df
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
16f2df
+    TMPCODE=$?
16f2df
+    if [[ $TMPCODE = 0 ]]
16f2df
+    then
16f2df
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
16f2df
+    else
16f2df
+      BLTK_MAIN=$WHICH_BLTK
16f2df
+    fi
16f2df
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
16f2df
+
16f2df
+    root_len=`echo $BLTK_ROOT | wc -c`
16f2df
+    main_len=`echo $BLTK_MAIN | wc -c`
16f2df
+    
16f2df
+    if [[ $root_len = $main_len ]]
16f2df
+    then
16f2df
+      RETCODE=2
16f2df
+    else
16f2df
+      [ -f "$BLTK_CONF" ] && . "$BLTK_CONF"
16f2df
+
16f2df
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
16f2df
+
16f2df
+      export BLTK_ROOT
16f2df
+      export BLTK_BIN=$BLTK_ROOT/bin
16f2df
+      export BLTK_TMP=$BLTK_HOME/tmp
16f2df
+    fi
16f2df
+  fi
16f2df
+
16f2df
+  return $RETCODE
16f2df
 }
16f2df
 
16f2df
-set_bltk_root
16f2df
+set_bltk_paths
16f2df
 
16f2df
 BLTK_REPORT=$BLTK_BIN/bltk_report
16f2df
 
16f2df
--- orig-1.0.9/tools/analyzer/bltk_report_uncompress.sh	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ curr-1.0.9-1/tools/analyzer/bltk_report_uncompress.sh	2009-07-17 11:03:54.837880784 +0200
16f2df
@@ -41,27 +41,44 @@
16f2df
 
16f2df
 unalias -a
16f2df
 
16f2df
-set_bltk_root()
16f2df
+set_bltk_paths()
16f2df
 {
16f2df
-	PROG=`basename $0`
16f2df
+  WHICH_BLTK=`which bltk`
16f2df
+  RETCODE=$?
16f2df
 
16f2df
-	BLTK_ROOT=`dirname $0`
16f2df
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-	then
16f2df
-		BLTK_ROOT=`dirname $BLTK_ROOT`
16f2df
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
16f2df
-		then
16f2df
-			echo "Cannot determine bltk root, bltk tree corrupted."
16f2df
-			exit 2
16f2df
-		fi
16f2df
-	fi
16f2df
-	export BLTK_ROOT
16f2df
-	export BLTK_BIN=$BLTK_ROOT/bin
16f2df
-	export BLTK_TMP=$BLTK_ROOT/tmp
16f2df
-	export BLTK_GET_REALPATH=$BLTK_BIN/bltk_get_realpath
16f2df
+  if [[ $RETCODE = 0 ]]
16f2df
+  then
16f2df
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
16f2df
+    TMPCODE=$?
16f2df
+    if [[ $TMPCODE = 0 ]]
16f2df
+    then
16f2df
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
16f2df
+    else
16f2df
+      BLTK_MAIN=$WHICH_BLTK
16f2df
+    fi
16f2df
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
16f2df
+
16f2df
+    root_len=`echo $BLTK_ROOT | wc -c`
16f2df
+    main_len=`echo $BLTK_MAIN | wc -c`
16f2df
+    
16f2df
+    if [[ $root_len = $main_len ]]
16f2df
+    then
16f2df
+      RETCODE=2
16f2df
+    else
16f2df
+      [ -f "$BLTK_CONF" ] && . "$BLTK_CONF"
16f2df
+
16f2df
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
16f2df
+
16f2df
+      export BLTK_ROOT
16f2df
+      export BLTK_BIN=$BLTK_ROOT/bin
16f2df
+      export BLTK_TMP=$BLTK_HOME/tmp
16f2df
+    fi
16f2df
+  fi
16f2df
+
16f2df
+  return $RETCODE
16f2df
 }
16f2df
 
16f2df
-set_bltk_root
16f2df
+set_bltk_paths
16f2df
 
16f2df
 CWD=$PWD
16f2df
 
16f2df
--- orig-1.0.9/tools/analyzer/bltk_func.sh	1970-01-01 01:00:00.000000000 +0100
16f2df
+++ curr-1.0.9-1/tools/analyzer/bltk_func.sh	2009-07-17 11:03:54.824880651 +0200
16f2df
@@ -0,0 +1,77 @@
16f2df
+#!/bin/bash
16f2df
+#
16f2df
+# Copyright (c) 2009 Red Hat Inc.
16f2df
+# Copyright (c) 2009 Jiri Skala <jskala@redhat.com>
16f2df
+# All rights reserved.
16f2df
+#
16f2df
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16f2df
+#
16f2df
+# Redistribution and use in source and binary forms, with or without
16f2df
+# modification, are permitted provided that the following conditions
16f2df
+# are met:
16f2df
+#
16f2df
+#   Redistributions of source code must retain the above copyright notice,
16f2df
+#   this list of conditions and the following disclaimer.
16f2df
+#
16f2df
+#   Redistributions in binary form must reproduce the above copyright
16f2df
+#   notice, this list of conditions and the following disclaimer in the
16f2df
+#   documentation and/or other materials provided with the distribution.
16f2df
+#
16f2df
+#   Neither the name of Intel Corporation nor the names of its contributors
16f2df
+#   may be used to endorse or promote products derived from this software
16f2df
+#   without specific prior written permission.
16f2df
+#
16f2df
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16f2df
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16f2df
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16f2df
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16f2df
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16f2df
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
16f2df
+#
16f2df
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
16f2df
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
16f2df
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
16f2df
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
16f2df
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
16f2df
+# DAMAGE.
16f2df
+#
16f2df
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16f2df
+#
16f2df
+
16f2df
+set_bltk_paths()
16f2df
+{
16f2df
+  WHICH_BLTK=`which bltk`
16f2df
+  RETCODE=$?
16f2df
+
16f2df
+  if [[ $RETCODE = 0 ]]
16f2df
+  then
16f2df
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
16f2df
+    TMPCODE=$?
16f2df
+    if [[ $TMPCODE = 0 ]]
16f2df
+    then
16f2df
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
16f2df
+    else
16f2df
+      BLTK_MAIN=$WHICH_BLTK
16f2df
+    fi
16f2df
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
16f2df
+
16f2df
+    root_len=`echo $BLTK_ROOT | wc -c`
16f2df
+    main_len=`echo $BLTK_MAIN | wc -c`
16f2df
+    
16f2df
+    if [[ $root_len = $main_len ]]
16f2df
+    then
16f2df
+      RETCODE=2
16f2df
+    else
16f2df
+      [ -f "$BLTK_CONF" ] && . "$BLTK_CONF"
16f2df
+
16f2df
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
16f2df
+
16f2df
+      export BLTK_ROOT
16f2df
+      export BLTK_BIN=$BLTK_ROOT/bin
16f2df
+      export BLTK_TMP=$BLTK_HOME/tmp
16f2df
+    fi
16f2df
+  fi
16f2df
+
16f2df
+  return $RETCODE
16f2df
+}
16f2df
+
16f2df
--- orig-1.0.9/tools/analyzer/Makefile	2009-04-10 09:14:20.000000000 +0200
16f2df
+++ curr-1.0.9-1/tools/analyzer/Makefile	2009-07-17 11:03:54.826913428 +0200
16f2df
@@ -15,7 +15,7 @@
16f2df
 
16f2df
 SHFILES		= bltk_get_stat bltk_report bltk_report_table bltk_report_check \
16f2df
 			bltk_plot bltk_get_hd_rpm \
16f2df
-			bltk_report_compress bltk_report_uncompress
16f2df
+			bltk_report_compress bltk_report_uncompress bltk_func
16f2df
 SHFILES_SH	= ${SHFILES:=.sh}
16f2df
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
16f2df