summaryrefslogtreecommitdiff
blob: 026f98167fdac59a4c1b08b547efd3488c96e952 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Dan Armak <danarmak@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/eclass/debug.eclass,v 1.10 2002/03/03 05:17:20 danarmak Exp $
# This provides functions for verbose output for debugging

# redirect output, unset to disable. use e.g. /dev/stdout to write into a file/device.
# use special setting "on" to echo the output - unlike above, doesn't violate sandbox.
# the test here is to enable people to export DEBUG_OUTPUT before running ebuild/emerge
# so that they won't have to edit debug.eclass anymore
#[ -n "$ECLASS_DEBUG_OUTPUT" ] || ECLASS_DEBUG_OUTPUT="on"

# used internally for output
# redirects output wherever's needed
# in the future might use e* from /etc/init.d/functions.sh if i feel like it
debug-print() {

	while [ "$1" ]; do
	
		# extra user-configurable targets
		if [ "$ECLASS_DEBUG_OUTPUT" == "on" ]; then
			echo "debug: $1"
		elif [ -n "$ECLASS_DEBUG_OUTPUT" ]; then
	    	        echo "debug: $1" >> $ECLASS_DEBUG_OUTPUT
		fi
		
		# default target
		[ -d "$BUILD_PREFIX/$P/temp" ] && echo $1 >> ${T}/eclass-debug.log
		
		shift
	done

}

# std message functions

debug-print-function() {
	
	str="$1: entering function" 
	shift
	debug-print "$str, parameters: $*"

}

debug-print-section() {
	
	debug-print "now in section $*"

}