Upload tizen_2.2 source
authorkh5325.kim <kh5325.kim@samsung.com>
Mon, 24 Jun 2013 10:16:56 +0000 (19:16 +0900)
committerkh5325.kim <kh5325.kim@samsung.com>
Mon, 24 Jun 2013 10:16:56 +0000 (19:16 +0900)
Change-Id: I0efd811f0463e926faccca2e74b75311df0735a9

package/changelog
package/pkginfo.manifest
src/command_function.c
src/file_sync_client.c
src/sdb.h
src/sdb_client.c
src/sdb_client.h

index 6b8d344ed5175965d6c4e82e434cbbe263430157..8070460080dad3ac7202c8b344b39ec5c4923919 100644 (file)
@@ -1,3 +1,15 @@
+* 2.2.5
+- modify debug launchpad applied sdbd version
+== ho.namkoong <ho.namkoong@samsung.com> 2013-06-24
+* 2.2.4
+- change sdb version in help page
+== ho.namkoong <ho.namkoong@samsung.com> 2013-06-23
+* 2.2.3
+- remove printf in lauchapp
+== ho.namkoong <ho.namkoong@samsung.com> 2013-06-23
+* 2.2.2
+- apply debug launch pad
+== ho.namkoong <ho.namkoong@samsung.com> 2013-06-23
 * 2.2.1
 - fixed crash on Windows
 == yoonki.park <yoonki.park@samsung.com> 2013-06-21
index 9bfdc18aed64c1eeb14dfeee1285ebc3d0a066a2..b58c753afb6a801fb49722acaeaac358e6900335 100644 (file)
@@ -1,4 +1,4 @@
-Version:2.2.1
+Version:2.2.5
 Source:sdb
 Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park<yoonki.park@samsung.com>, Hyunsik Noh<hyunsik.noh@samsung.com>, Gun Kim<gune.kim@samsung.com>, Ho Namkoong<ho.namkoong@samsung.com>, Taeyoung Son<taeyoung2.son@samsung.com>
 
index 50a7bad5bdb22e2d9f0c9c10ba16ce0c35739078..518dcbe5bf5e04c2add8b2a1330689f14e0c812b 100644 (file)
@@ -90,9 +90,21 @@ int launch(int argc, char ** argv, void** extargv) {
     char flag = 0;
 
     if (argc < 7 || argc > 15 ) {
-        fprintf(stderr,"usage: sdb launch -p <pkgid> -e <executable> -m <run|debug> [-P <port>] [-attach <pid>] [-t <gtest,gcov>]  [<args...>]\n");
+        fprintf(stderr,"usage: sdb launch -p <pkgid> -e <executable> -m <run|debug|da|oprofile> [-P <port>] [-attach <pid>] [-t <gtest,gcov>]  [<args...>]\n");
         return -1;
     }
+
+    if(SDB_HIGHER_THAN_2_2_3(extargv)) {
+        int full_len = PATH_MAX - 1;
+        strncat(fullcommand, WHITE_SPACE, full_len);
+        strncat(fullcommand, SDB_LAUNCH_SCRIPT, full_len);
+        for(i = 1; i < argc; i ++) {
+            strncat(fullcommand, WHITE_SPACE, full_len);
+            strncat(fullcommand, argv[i], full_len);
+        }
+
+        return __sdb_command(fullcommand, extargv);
+    }
     for (i = 1; i < argc; i++) {
         if (!strcmp(argv[i], "-p")) {
             flag = 'p';
@@ -134,7 +146,11 @@ int launch(int argc, char ** argv, void** extargv) {
                 mode = 0;
             } else if (!strcmp(argv[i], "debug")) {
                 mode = 1;
-            } else {
+            } else if (!strcmp(argv[i], "da") || !strcmp(argv[i], "oprofile")) {
+                fprintf(stderr,"The -m option for da and oprofile is supported in sdbd higher than 2.2.0\n");
+                return -1;
+            }
+            else {
                 fprintf(stderr,"The -m option accepts arguments only run or debug options\n");
                 return -1;
             }
index b5c3e5435e2978ce450541b49e89046525f0e673..085083258651db6a6bc12d4e6c26ec9af61d1d0f 100644 (file)
@@ -257,8 +257,13 @@ int do_sync_copy(char* srcp, char* dstp, FILE_FUNC* srcF, FILE_FUNC* dstF, int i
         }
     }
 
-    fprintf(stderr,"%d file(s) pushed. %d file(s) skipped.\n",
-            pushed, skiped);
+    char command[6] = {'p', 'u', 's', 'h', 'e', 'd'};
+    if(srcF == &REMOTE_FILE_FUNC) {
+        strncpy(command, "pulled", sizeof command);
+    }
+
+    fprintf(stderr,"%d file(s) %s. %d file(s) skipped.\n",
+            pushed, command, skiped);
 
     long long end_time = NOW() - start_time;
 
index b45134a4b53e948ea7647b3cae2d0cd94a0b199d..98b5063e3f57d244fe097b0663af64bfb241fd96 100755 (executable)
--- a/src/sdb.h
+++ b/src/sdb.h
@@ -36,7 +36,7 @@
 #define SDB_VERSION_MAJOR 2       // Used for help/version information
 #define SDB_VERSION_MINOR 2         // Used for help/version information
 
-#define SDB_SERVER_VERSION    0    // Increment this when we want to force users to start a new sdb server
+#define SDB_SERVER_VERSION    4    // Increment this when we want to force users to start a new sdb server
 
 typedef struct amessage amessage;
 typedef struct apacket apacket;
index dd26d29ba7abebc5f8ad2846beefc3769d76fc42..ab54aee2b3d73f3f7534401fb5cd1932a2f8ff70 100644 (file)
@@ -34,7 +34,7 @@ static int send_service_with_length(int fd, const char* service);
 static int sdb_status(int fd);
 
 static int send_service_with_length(int fd, const char* service) {
-    char tmp[5];
+
     int len;
     len = strlen(service);
 
@@ -89,6 +89,79 @@ static int switch_socket_transport(int fd, void** extra_args)
     return 0;
 }
 
+int sdb_higher_ver(int first, int middle, int last, void* extargv) {
+
+    const char* VERSION_QUERY = "shell:rpm -q sdbd";
+    D("query the sdbd version\n");
+    int fd = sdb_connect(VERSION_QUERY, extargv);
+
+    if(fd < 0) {
+        D("fail to query the sdbd version\n");
+        return fd;
+    }
+
+    char ver[PATH_MAX];
+    int len;
+
+    D("read sdb version\n");
+    while(fd >= 0) {
+        len = sdb_read(fd, ver, PATH_MAX);
+        if(len == 0) {
+            break;
+        }
+
+        if(len < 0) {
+            if(errno == EINTR) continue;
+            break;
+        }
+        fflush(stdout);
+    }
+
+    int version;
+    char* ver_num = NULL;
+
+    ver_num = strchr(ver, '-') + 1;
+
+    char* null = NULL;
+    null = strchr(ver_num, '-');
+
+    if(null == NULL) {
+        fprintf(stderr, "error: cannot parse sdbd version\n");
+        return -1;
+    }
+    *null = '\0';
+
+    D("sdbd version: %s\n", ver_num);
+
+    null = strchr(ver_num, '.');
+    *null = '\0';
+    version = atoi(ver_num);
+    if(version > first) {
+        return 1;
+    }
+    if(version < first) {
+        return 0;
+    }
+    ver_num = ++null;
+
+    null = strchr(ver_num, '.');
+    version = atoi(ver_num);
+    *null = '\0';
+    if(version > middle) {
+        return 1;
+    }
+    if(version < middle) {
+        return 0;
+    }
+    ver_num = ++null;
+
+    version = atoi(ver_num);
+    if(version > last) {
+        return 1;
+    }
+    return 0;
+}
+
 static int sdb_status(int fd)
 {
     unsigned char buf[5];
index f20b672e677c2cc71e0df7c97e2b045834742950..7f8706c39f632bcd8f984b4739f84095b6f49b48 100644 (file)
@@ -20,6 +20,9 @@
 #include "sdb.h"
 #include "sdb_constants.h"
 
+// debug launch pad is applied after sdbd 2.2.3
+#define SDB_HIGHER_THAN_2_2_3(extargv) sdb_higher_ver(2, 2, 3, extargv)
+
 /* connect to sdb, connect to the named service, and return
 ** a valid fd for interacting with that service upon success
 ** or a negative number on failure
@@ -42,6 +45,13 @@ char *sdb_query(const char *service, void** ext_args);
 /* return verbose error string from last operation */
 const char *sdb_error(void);
 
+/**
+ * check sdbd version in the target.
+ * returns true, if target version is higher then {first}.{middle}.{last}.
+ * else, returns false.
+ */
+int sdb_higher_ver(int first, int middle, int last, void* extargv);
+
 /* read a standard sdb status response (OKAY|FAIL) and
 ** return 0 in the event of OKAY, -1 in the event of FAIL
 ** or protocol error