From: Gun Kim Date: Mon, 20 May 2013 09:34:44 +0000 (+0900) Subject: [Title] tizen_2.1's change is merged into develop. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7281e750e322a0e233a1a59826d1fdf9c491d83;p=sdk%2Ftools%2Fcli.git [Title] tizen_2.1's change is merged into develop. [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: Ifd119211012a9eb9da5d1f71f9fd0d83c6ac2e6d --- diff --git a/org.tizen.cli/doc/install/native_bin/native-debug b/org.tizen.cli/doc/install/native_bin/native-debug index a96050d..b989f4e 100755 --- a/org.tizen.cli/doc/install/native_bin/native-debug +++ b/org.tizen.cli/doc/install/native_bin/native-debug @@ -18,6 +18,7 @@ init() { DIR_BIN=`dirname $SCRIPT` TOOLS_HOME="$DIR_BIN/../.." SDB="$TOOLS_HOME/sdb" + GDB_SERVER="/home/developer/sdk_tools/gdbserver/gdbserver" } usage() { @@ -30,40 +31,7 @@ usage() { } getBinaryFile() { - SDB_GET_BINARY_COMMAND="$SDB_COMMAND shell ls /opt/usr/apps/$appid/bin/" - count=0 - extension=".exe" - extension_length=4 - result_list=`$SDB_GET_BINARY_COMMAND` - for i in ${result_list} - do - length=`expr match "$i" '.*[.]exe'` - start_pos=`expr $length - "$extension_length" + 1` - str=`expr substr "$i" "$start_pos" "$extension_length"` - if [ "$str" = "$extension" ] - then - BINARY=`expr substr "$i" "1" "$length"` - if [ -z "$binary_list" ] - then - binary_list=$i - else - binary_list="$binary_list, $i" - - fi - count=`expr "$count" + 1` - fi - done - - if [ "$count" -eq "0" ] - then - echo "error: not found executable file of \"$appid\"." - exit 2; - elif [ "$count" -gt "1" ] - then - echo "error: more then one executable file of \"$appid\"." - echo "executable files: $binary_list" - exit 2; - fi + BINARY=`$FIND_PKGID_COMMAND | awk '{gsub(/[\[\]]/, "", $6); print $6}'` } parse_param() { @@ -114,6 +82,7 @@ parse_param() { then SDB_COMMAND="$SDB -s $serial" fi + FIND_PKGID_COMMAND="$SDB_COMMAND shell pkgcmd -l | grep $appid" devices=`$SDB devices | wc -l` if [ "$devices" -lt 2 ] @@ -137,15 +106,51 @@ parse_param() { exit 1; fi + pkgid_count=`$FIND_PKGID_COMMAND | wc -l` + if [ $pkgid_count -ne 1 ] + then + echo "error: $appid: no such package" + exit 2; + fi + if [ -z "$BINARY" ] then getBinaryFile fi } +check_target_type() { + device="/dev/samsung_sdb" + sdb_cmd="$SDB_COMMAND shell \"ls $device 2> /dev/null | wc -l\"" + result=`eval $sdb_cmd` + if [ "$result" -eq "0" ] + then + TARGET_TYPE="emulator" + else + TARGET_TYPE="real" + fi +} + +ondemand_install() { + if [ $TARGET_TYPE = "real" ] + then + GDBSERVER_TAR="gdbserver_7.5.0_armel.tar" + ondemand_cmd="$SDB_COMMAND push $TOOLS_HOME/../platforms/tizen2.1/on-demand/gdbserver_7.5.0_armel.tar /home/developer/sdk_tools/gdbserver_7.5.0_armel.tar && cd /home/developer/sdk_tools/ && tar -xf gdbserver_7.5.0_armel.tar" + else + GDBSERVER_TAR="gdbserver_7.5.0_i386.tar" + ondemand_cmd="$SDB_COMMAND push $TOOLS_HOME/../platforms/tizen2.1/on-demand/gdbserver_7.5.0_i386.tar /home/developer/sdk_tools/gdbserver_7.5.0_i386.tar && cd /home/developer/sdk_tools/ && tar -xf gdbserver_7.5.0_i386.tar" + fi + + ondemand_cmd="$SDB_COMMAND push $TOOLS_HOME/../platforms/tizen2.1/on-demand/$GDBSERVER_TAR /home/developer/sdk_tools/$GDBSERVER_TAR" + $ondemand_cmd + ondemand_cmd="$SDB_COMMAND shell cd /home/developer/sdk_tools/ && tar -xf $GDBSERVER_TAR" + $ondemand_cmd + +} + launch_gdbserver() { - target_install_path="/opt/usr/apps/$appid/bin/$BINARY" - gdbserver_command="/home/developer/sdk_tools/gdbserver/gdbserver :26102 $target_install_path" + target_install_path="/opt/apps/$appid/bin/$BINARY" + gdbserver_command="$GDB_SERVER :26102 $target_install_path" sdb_gdbserver_command="$SDB_COMMAND shell $gdbserver_command 2> /dev/null" @@ -156,17 +161,11 @@ launch_gdbserver() { launch_gdb() { `$SDB_COMMAND forward tcp:7123 tcp:26102` - device="/dev/samsung_sdb" - sdb_cmd="$SDB_COMMAND shell ls $device > /dev/null 2> /dev/null ; echo \$?" - result=`$sdb_cmd` - if [ $result = $'0\r' ] - then - gdb="$TOOLS_HOME/arm-linux-gnueabi-gdb-7.2/bin/arm-linux-gnueabi-gdb" - elif [ $result = "0" ] + if [ $TARGET_TYPE = "real" ] then - gdb="$TOOLS_HOME/arm-linux-gnueabi-gdb-7.2/bin/arm-linux-gnueabi-gdb" + gdb="$TOOLS_HOME/arm-linux-gnueabi-gdb-7.5/bin/arm-linux-gnueabi-gdb" else - gdb="$TOOLS_HOME/i386-linux-gnueabi-gdb-7.2/bin/i386-linux-gnueabi-gdb" + gdb="$TOOLS_HOME/i386-linux-gnueabi-gdb-7.5/bin/i386-linux-gnueabi-gdb" fi $gdb $BINARY '--eval-command=target remote:7123' @@ -176,6 +175,8 @@ launch_gdb() { init parse_param $* +check_target_type +ondemand_install launch_gdbserver launch_gdb diff --git a/org.tizen.cli/doc/install/native_bin/native-debug.bat b/org.tizen.cli/doc/install/native_bin/native-debug.bat index 5a78bfa..7a34490 100755 --- a/org.tizen.cli/doc/install/native_bin/native-debug.bat +++ b/org.tizen.cli/doc/install/native_bin/native-debug.bat @@ -115,34 +115,26 @@ IF !%PACKAGE%==! ( call :usage exit /b 1 ) + SET COUNT=0 -SET IS_BINARY=0 -IF !%BINARY%==! ( - SET IS_BINARY=1 - FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "cd /opt/usr/apps/%PACKAGE%/bin/ 2> /dev/null && ls *.exe | tee | wc -l"`) DO ( - set COUNT=%%a - ) +SET FIND_PKGID_COMMAND=pkgcmd -l ^| grep %PACKAGE% +FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "%FIND_PKGID_COMMAND% | wc -l"`) DO ( + set COUNT=%%a +) +IF NOT %COUNT%==1 ( + echo error: %PACKAGE%: no such package + exit /b 2 ) -IF %IS_BINARY%==1 ( - IF 1==%COUNT% ( - FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "cd /opt/usr/apps/%PACKAGE%/bin/ && ls *.exe | tee"`) DO ( - set BINARY=%%a - ) - ) - IF 0==%COUNT% ( - echo error: not found executable file of "%PACKAGE%". - exit /B 2 +SET COUNT=0 +IF !%BINARY%==! ( + FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "%FIND_PKGID_COMMAND% | awk '{gsub(/[\[\]]/, "", $6); print $6}'"`) DO ( + set BINARY=%%a ) - IF 1 LSS %COUNT% ( - FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "cd /opt/usr/apps/%PACKAGE%/bin/ && ls *.exe"`) DO ( - echo error: more then one executable file of "%PACKAGE%". - echo executable files: %%a - exit /B 2 - ) - ) ) +call :check_target_type +call :ondemand_install call :launch_gdbserver call :launch_gdb @@ -156,8 +148,31 @@ exit /b %ERRORLEVEL% echo -b,--binary ^ debug the application given ^.^ exit /b +:ondemand_install + IF %TARGET_TYPE%==real ( + set GDBSERVER_TAR=gdbserver_7.5.0_armel.tar + ) ELSE ( + set GDBSERVER_TAR=gdbserver_7.5.0_i386.tar + ) + + call %SDB_COMMAND% push %TOOLS_HOME%/../platforms/tizen2.1/on-demand/%GDBSERVER_TAR% /home/developer/sdk_tools/%GDBSERVER_TAR% + call %SDB_COMMAND% shell "cd /home/developer/sdk_tools/ && tar -xf %GDBSERVER_TAR%" +exit /b + +:check_target_type + FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "ls /dev/samsung_sdb 2> /dev/null | wc -l"`) DO ( + set IS_EMULATOR=%%a + ) + + IF %IS_EMULATOR%==1 ( + set TARGET_TYPE=real + ) ELSE ( + set TARGET_TYPE=emulator + ) +exit /b + :launch_gdbserver - set TARGET_INSTALL_PATH=/opt/usr/apps/%PACKAGE%/bin/%BINARY% + set TARGET_INSTALL_PATH=/opt/apps/%PACKAGE%/bin/%BINARY% set GDBSERVER_COMMAND=/home/developer/sdk_tools/gdbserver/gdbserver :26102 %TARGET_INSTALL_PATH% set SDB_GDBSERVER_COMMAND=%SDB_COMMAND% shell %GDBSERVER_COMMAND% 2> NUL @@ -168,15 +183,13 @@ exit /b :launch_gdb call %SDB_COMMAND% forward tcp:7123 tcp:26102 - FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "ls /dev/samsung_sdb 2> /dev/null ; echo $?"`) DO ( + FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "ls /dev/samsung_sdb 2> /dev/null | wc -l"`) DO ( set IS_EMULATOR=%%a ) - IF %IS_EMULATOR%==0 ( - call %TOOLS_HOME%\arm-linux-gnueabi-gdb-7.2\bin\arm-linux-gnueabi-gdb --eval-command="target remote:7123" --exec=%BINARY% + IF %IS_EMULATOR%==1 ( + call %TOOLS_HOME%\arm-linux-gnueabi-gdb-7.5\bin\arm-linux-gnueabi-gdb --eval-command="target remote:7123" --exec=%BINARY% ) ELSE ( - call %TOOLS_HOME%\i386-linux-gnueabi-gdb-7.2\bin\i386-linux-gnueabi-gdb --eval-command="target remote:7123" --exec=%BINARY% + call %TOOLS_HOME%\i386-linux-gnueabi-gdb-7.5\bin\i386-linux-gnueabi-gdb --eval-command="target remote:7123" --exec=%BINARY% ) - - echo exit /b diff --git a/org.tizen.cli/doc/install/native_bin/native-install b/org.tizen.cli/doc/install/native_bin/native-install index b626108..ba04739 100755 --- a/org.tizen.cli/doc/install/native_bin/native-install +++ b/org.tizen.cli/doc/install/native_bin/native-install @@ -50,7 +50,7 @@ do usage exit 1; fi - package=$2 + package=\"$2\" shift 2; ;; *) @@ -66,8 +66,8 @@ then exit 1; fi -PACKAGE_EXIST=`ls $package > /dev/null 2> /dev/null || ?$` -if [ $PACKAGE_EXIT != 0 -a $package != "*$PACKAGE_EXTENSION" ] +PACKAGE_EXIST=`eval ls $package > /dev/null 2> /dev/null ; echo $?` +if [ $PACKAGE_EXIST != 0 -a $package != "*$PACKAGE_EXTENSION" ] then echo "error: incorrect package file" exit 1; @@ -96,7 +96,7 @@ then fi command="$command install $package" -$command +eval $command exit_code=`echo $?` if [ "$exit_code" = "0" ] then diff --git a/org.tizen.cli/doc/install/native_bin/native-make b/org.tizen.cli/doc/install/native_bin/native-make index 647862a..4387f89 100755 --- a/org.tizen.cli/doc/install/native_bin/native-make +++ b/org.tizen.cli/doc/install/native_bin/native-make @@ -16,32 +16,20 @@ done DIR_BIN=`dirname $SCRIPT` TOOLS_HOME="$DIR_BIN/../.." -command="$TOOLS_HOME/smart-build-interface/bin/sbi_make $@" +command="$TOOLS_HOME/smart-build-interface/bin/sbi_make" + usage() { echo "Usage: native-make [options]" - echo " -t,--target " + echo " -n,--name " + echo " -v,--version " + echo " -a,--arch " + echo " -t,--toolchain " + echo " -rp,--ref-project " + echo " -u,--unittest-target " echo " clean" } -for file in `ls` -do - if [ "$file" = "build_data" ] - then - BUILD_DATA=$file - elif [ "$file" = "makefile" ] - then - MAKEFILE=$file - fi -done - -if [ -z "$BUILD_DATA" -o -z "$MAKEFILE" ] -then - echo "error: cannot find build_data or makefile" - echo "error: build_data, makefile is normally located in {project}/CommandLineBuild" - exit 2 -fi - until [ -z "$1" ] do @@ -51,16 +39,63 @@ do usage; exit; ;; - -t|--target) - if [ "emulator" != "$2" -a "device" != $2] + -n|--name) + if [ -z "$2" ] + then + usage + exit; + fi + command="$command -n \"$2\"" + shift 2; + ;; + -v|--version) + if [ -z "$2" ] + then + usage + exit; + fi + command="$command -v \"$2\"" + shift 2; + ;; + -a|--arch) + if [ -z "$2" ] + then + usage + exit; + fi + command="$command -a \"$2\"" + shift 2; + ;; + -t|--toolchain) + if [ -z "$2" ] + then + usage + exit; + fi + command="$command -t \"$2\"" + shift 2; + ;; + -rp|--ref-project) + if [ -z "$2" ] then usage exit; fi + command="$command -r \"$2\"" + shift 2; + ;; + -u|--unittest-target) + if [ -z "$2" ] + then + usage + exit; + fi + command="$command -u \"$2\"" shift 2; ;; clean) shift; + command="$command clean" ;; *) usage @@ -69,8 +104,27 @@ do esac done +for file in `ls` +do + if [ "$file" = "build_data" ] + then + BUILD_DATA=$file + elif [ "$file" = "makefile" ] + then + MAKEFILE=$file + fi +done + +if [ -z "$BUILD_DATA" -o -z "$MAKEFILE" ] +then + echo "error: cannot find build_data or makefile" + echo "error: build_data, makefile is normally located in {project}/CommandLineBuild" + exit 2 +fi + + +eval $command -$command result=`echo $?` if [ "$result" = "0" ] then diff --git a/org.tizen.cli/doc/install/native_bin/native-make.bat b/org.tizen.cli/doc/install/native_bin/native-make.bat index ad31d59..87f9e78 100755 --- a/org.tizen.cli/doc/install/native_bin/native-make.bat +++ b/org.tizen.cli/doc/install/native_bin/native-make.bat @@ -18,7 +18,7 @@ FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizen set TOOLS_HOME=%SDK_PATH%\tools -set command=%TOOLS_HOME%\smart-build-interface\bin\sbi-make.bat %1 %2 +set command=%TOOLS_HOME%\smart-build-interface\bin\sbi-make.bat REM init environment variable set IS_CLEAN=0 @@ -32,11 +32,41 @@ IF !%1==! ( IF %1==--help ( GOTO help ) + IF %1==-n ( + GOTO name + ) + IF %1==--name ( + GOTO name + ) + IF %1==-v ( + GOTO version + ) + IF %1==--version ( + GOTO version + ) + IF %1==-a ( + GOTO arch + ) + IF %1==--arch ( + GOTO arch + ) IF %1==-t ( - GOTO target + GOTO toolchain + ) + IF %1==--toolchain ( + GOTO toolchain + ) + IF %1==-rp ( + GOTO referencing + ) + IF %1==--ref-project ( + GOTO referencing ) - IF %1==--target ( - GOTO target + IF %1==-u ( + GOTO unittest + ) + IF %1==--unittest-target ( + GOTO unittest ) IF %1==clean ( GOTO clean @@ -45,22 +75,65 @@ IF !%1==! ( :help call :usage exit /b - :target - IF emulator==%2 ( - shift - shift - GOTO getoptEnd + :name + IF !%2==! ( + CALL :usage + exit /b 1 ) - IF device==%2 ( - shift - shift - GOTO getoptEnd + set command=%command% -n %2 + shift + shift + GOTO getoptEnd + :version + IF !%2==! ( + CALL :usage + exit /b 1 ) - call :usage - exit /b + set command=%command% -v %2 + shift + shift + GOTO getoptEnd + :arch + IF !%2==! ( + CALL :usage + exit /b 1 + ) + set command=%command% -a %2 + shift + shift + GOTO getoptEnd + :toolchain + IF !%2==! ( + CALL :usage + exit /b 1 + ) + set command=%command% -t %2 + shift + shift + GOTO getoptEnd + :referencing + IF !%2==! ( + CALL :usage + exit /b 1 + ) + set command=%command% -r %2 + shift + shift + GOTO getoptEnd + :unittest + IF !%2==! ( + CALL :usage + exit /b 1 + ) + set command=%command% -u %2 + shift + shift + GOTO getoptEnd :clean shift + set command=%command% clean set IS_CLEAN=1 + shift GOTO getoptEnd :getoptEnd @@ -83,6 +156,11 @@ exit /b %ERRORLEVEL% :usage echo Usage: native-make [options] - echo -t,--target ^ + echo -n,--name ^ + echo -v,--version ^ + echo -a,--arch ^ + echo -t,--toolchain ^ + echo -rp,--ref-project ^ + echo -u,--unittest-target ^ echo clean exit /b diff --git a/org.tizen.cli/doc/install/native_bin/native-run b/org.tizen.cli/doc/install/native_bin/native-run index 52c576c..9dec05d 100755 --- a/org.tizen.cli/doc/install/native_bin/native-run +++ b/org.tizen.cli/doc/install/native_bin/native-run @@ -30,40 +30,7 @@ usage() } getBinaryFile() { - SDB_GET_BINARY_COMMAND="$SDB_COMMAND shell ls /opt/usr/apps/$appid/bin/" - count=0 - extension=".exe" - extension_length=4 - result_list=`$SDB_GET_BINARY_COMMAND` - for i in ${result_list} - do - length=`expr match "$i" '.*[.]exe'` - start_pos=`expr $length - "$extension_length" + 1` - str=`expr substr "$i" "$start_pos" "$extension_length"` - if [ "$str" != "$extension" ] - then - BINARY=$i - if [ -z "$binary_list" ] - then - binary_list=$i - else - binary_list="$binary_list, $i" - - fi - count=`expr "$count" + 1` - fi - done - - if [ "$count" -eq "0" ] - then - echo "error: not found executable file of \"$appid\"." - exit 2; - elif [ "$count" -gt "1" ] - then - echo "error: more then one executable file of \"$appid\"." - echo "executable files: $binary_list" - exit 2; - fi + BINARY=`$FIND_PKGID_COMMAND | awk '{gsub(/[\[\]]/, "", $6); print $6}'` } until [ -z "$1" ] @@ -112,6 +79,7 @@ if [ -n "$serial" ] then SDB_COMMAND="$SDB -s $serial" fi +FIND_PKGID_COMMAND="$SDB_COMMAND shell pkgcmd -l | grep $appid" devices=`$SDB devices | wc -l` if [ "$devices" -lt 2 ] @@ -133,6 +101,12 @@ then usage exit 1; fi +pkgid_count=`$FIND_PKGID_COMMAND | wc -l` +if [ $pkgid_count -ne 1 ] +then + echo "error: $appid: no such package" + exit 2; +fi if [ -z "$BINARY" ] then diff --git a/org.tizen.cli/doc/install/native_bin/native-run.bat b/org.tizen.cli/doc/install/native_bin/native-run.bat index 6feb28a..46810bf 100755 --- a/org.tizen.cli/doc/install/native_bin/native-run.bat +++ b/org.tizen.cli/doc/install/native_bin/native-run.bat @@ -118,30 +118,19 @@ IF !%PACKAGE%==! ( ) SET COUNT=0 -SET IS_BINARY=0 -IF !%BINARY%==! ( - SET IS_BINARY=1 - FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "cd /opt/usr/apps/%PACKAGE%/bin/ 2> /dev/null && ls --ignore=*.exe | tee | wc -l"`) DO ( - set COUNT=%%a - ) +SET FIND_PKGID_COMMAND=pkgcmd -l ^| grep %PACKAGE% +FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "%FIND_PKGID_COMMAND% | wc -l"`) DO ( + set COUNT=%%a ) +IF NOT %COUNT%==1 ( + echo error: %PACKAGE%: no such package + exit /b 2 +) +SET COUNT=0 -IF %IS_BINARY%==1 ( - IF 1==%COUNT% ( - FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "cd /opt/usr/apps/%PACKAGE%/bin/ && ls --ignore=*.exe | tee"`) DO ( - set BINARY=%%a - ) - ) - IF 0==%COUNT% ( - echo error: not found executable file of "%PACKAGE%". - exit /B 2 - ) - IF 1 LSS %COUNT% ( - FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "cd /opt/usr/apps/%PACKAGE%/bin/ && ls --ignore=*.exe"`) DO ( - echo error: more then one executable file of "%PACKAGE%". - echo executable files: %%a - exit /B 2 - ) +IF !%BINARY%==! ( + FOR /f "usebackq delims=" %%a IN (`%SDB_COMMAND% shell "%FIND_PKGID_COMMAND% | awk '{gsub(/[\[\]]/, "", $6); print $6}'"`) DO ( + set BINARY=%%a ) )