summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Leukkunen <lle@rahina.org>2007-07-29 13:40:25 +0300
committerLauri Leukkunen <lle@rahina.org>2007-07-29 13:40:25 +0300
commitc603070602d6e30e2cdaa56ad88efc43265be28f (patch)
tree8b0825ca4d9986bb76b6bf627bba6a64fcc54cf6
parent692d96e3ab0d1b02b96d90f7a99b76d874616cdf (diff)
Unify env vars to use SBOX_ prefix, rename sb2 verbose option to debug1.99.0.12
sb2 -v shows version number sb2 -d produces debug output to $HOME/sb2_mapping.log Also pump the version Signed-off-by: Lauri Leukkunen <lle@rahina.org>
-rw-r--r--Makefile6
-rw-r--r--docs/sb2.15
-rw-r--r--mapping/mapping.c2
-rw-r--r--redir_scripts/main.lua4
-rwxr-xr-xutils/sb218
5 files changed, 25 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index f18ca2e..69c474d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,10 @@
+# Copyright (C) 2007 Lauri Leukkunen <lle@rahina.org>
+# Licensed under LGPL 2.1
+
CC = gcc
CXX = g++
LD = ld
-PACKAGE_VERSION = "1.99.0.11"
+PACKAGE_VERSION = "1.99.0.12"
PACKAGE = "SB2"
LIBSB2_SONAME = "libsb2.so.1"
CFLAGS = -O2 -g -Wall -W -I./include -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1
@@ -49,6 +52,7 @@ install: $(targets)
install -d -m 755 $(prefix)/share/scratchbox2/redir_scripts/preload/emulate
install -d -m 755 $(prefix)/share/scratchbox2/scripts
install -d -m 755 $(prefix)/share/man/man1
+ echo "$(PACKAGE_VERSION)" > $(prefix)/share/scratchbox2/version
install -c -m 755 preload/libsb2.so $(prefix)/lib/libsb2/libsb2.so.$(PACKAGE_VERSION)
install -c -m 755 utils/sb2 $(prefix)/bin/sb2
install -c -m 755 utils/sb2-init $(prefix)/bin/sb2-init
diff --git a/docs/sb2.1 b/docs/sb2.1
index da74c82..738da7e 100644
--- a/docs/sb2.1
+++ b/docs/sb2.1
@@ -3,7 +3,7 @@
sb2 \- crosscompiling environment
.SH SYNOPSIS
.B sb2
-[ \-v ] [ \-h ] [ \-t DIRECTORY ] [ \-e ] [ -m DIRECTORY] [command] [arguments] [...]
+[ \-v ] [ \-d ] [ \-h ] [ \-t DIRECTORY ] [ \-e ] [ -m DIRECTORY] [command] [arguments] [...]
.SH DESCRIPTION
.B sb2
Runs command in scratchbox2. If no command is given, a bash shell
@@ -11,6 +11,9 @@ in scratchbox2 environment is started.
.SH OPTIONS
.TP
\-v
+Display version number.
+.TP
+\-d
Output all path mappings to $HOME/sb2_mapping.log.
.TP
\-h
diff --git a/mapping/mapping.c b/mapping/mapping.c
index 36fd8fc..d045e6e 100644
--- a/mapping/mapping.c
+++ b/mapping/mapping.c
@@ -617,7 +617,7 @@ char *scratchbox_path2(const char *binary_name,
char *tmp = NULL, *decolon_path = NULL, *mapping_mode = NULL;
char pidlink[17]; /* /proc/2^8/exe */
- if (!(mapping_mode = getenv("SBOX2_MAPMODE"))) {
+ if (!(mapping_mode = getenv("SBOX_MAPMODE"))) {
mapping_mode = "default";
}
diff --git a/redir_scripts/main.lua b/redir_scripts/main.lua
index 3689896..2eeeeb7 100644
--- a/redir_scripts/main.lua
+++ b/redir_scripts/main.lua
@@ -17,7 +17,7 @@ if (not compiler_root) then
compiler_root = "/usr"
end
-verbose = os.getenv("SBOX_MAPPING_VERBOSE")
+debug = os.getenv("SBOX_MAPPING_DEBUG")
-- SBOX_REDIR_SCRIPTS environment variable controls where
@@ -301,7 +301,7 @@ function map_using_chain(chain, binary_name, func_name, work_dir, path)
ret = rule.custom_map_func(binary_name, func_name, work_dir, rp, path, rules[n])
else
ret = sbox_map_to(binary_name, func_name, work_dir, rp, path, rule)
- if (verbose) then
+ if (debug) then
sb_debug(string.format("[%s][%s|%s]:\n %s(%s) -> (%s)", basename(rule.lua_script), rule.binary_name, binary_name, func_name, path, ret))
end
end
diff --git a/utils/sb2 b/utils/sb2
index e44a493..cd33c4b 100755
--- a/utils/sb2
+++ b/utils/sb2
@@ -2,6 +2,12 @@
# Copyright (C) 2006,2007 Lauri Leukkunen <lle@rahina.org>
# Licensed under GPL version 2
+function version()
+{
+ cat $SBOX_DIR/share/scratchbox2/version
+ exit 0
+}
+
function usage()
{
cat <<EOF
@@ -12,7 +18,8 @@ Usage:
If no COMMAND is given, a bash shell in scratchbox2 environment is started.
Options:
- -v verbose mode: log all redirections
+ -v display version
+ -d debug mode: log all redirections
-h print this help
-t DIRECTORY target directory, else search up in directory
structure for a .sb2rc
@@ -121,7 +128,7 @@ function sboxify_environment()
export SBOX_HOST_GCC_PREFIX_LIST
export SBOX_UNAME_MACHINE=$SBOX_CPU
- if [ "$SBOX_MAPPING_VERBOSE" == "1" ]; then
+ if [ "$SBOX_MAPPING_DEBUG" == "1" ]; then
export SBOX_DISABLE_MAPPING_CACHE=1 # disable the cache to force use of lua engine
export SBOX_MAPPING_LOGFILE=$HOME/sb2_mapping.log
echo "Running scratchbox with these settings:"
@@ -136,13 +143,14 @@ function sboxify_environment()
export SBOX_DIR=$(readlink -f $(dirname $0)/..)
-while getopts vht:em: foo
+while getopts vdht:em: foo
do
case $foo in
- (v) export SBOX_MAPPING_VERBOSE=1 ;;
+ (v) version ;;
+ (d) export SBOX_MAPPING_DEBUG=1 ;;
(h) usage ;;
(t) export SBOX_TARGET_ROOT=$OPTARG ;;
- (e) export SBOX2_MAPMODE=emulate ;;
+ (e) export SBOX_MAPMODE=emulate ;;
(m) export SBOX_REDIR_SCRIPTS=$OPTARG;;
(*) usage ;;
esac