summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-02-05 06:55:34 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-02-05 06:55:34 (GMT)
commit69bbc929ae7a56fbd3e1fd19d2a3b9ccc03e8f76 (patch)
tree740491f7c3e5a513be3958c50646ba0e79b691d7
parentfc2ae99eefeaacc062a66127e3d6e4878a8e4fa6 (diff)
downloaddata-provider-master-69bbc929ae7a56fbd3e1fd19d2a3b9ccc03e8f76.zip
data-provider-master-69bbc929ae7a56fbd3e1fd19d2a3b9ccc03e8f76.tar.gz
data-provider-master-69bbc929ae7a56fbd3e1fd19d2a3b9ccc03e8f76.tar.bz2
Update the data provider master
Fix the liveinfo bug (Command line parser is updated) Manifest file is updated for rule of daemon type package. Change-Id: I61ce630765c936d6a11dc6094ec3598b5da47d83
-rw-r--r--org.tizen.data-provider-master.manifest3
-rw-r--r--packaging/org.tizen.data-provider-master.spec2
-rw-r--r--pkgmgr_livebox/src/service_register.c2
-rw-r--r--util_liveinfo/src/liveinfo.c275
4 files changed, 176 insertions, 106 deletions
diff --git a/org.tizen.data-provider-master.manifest b/org.tizen.data-provider-master.manifest
index 57bc637..4bdb04c 100644
--- a/org.tizen.data-provider-master.manifest
+++ b/org.tizen.data-provider-master.manifest
@@ -8,6 +8,9 @@
<label name="data-provider-master::data" />
<label name="data-provider-master::share" />
</provide>
+ <request>
+ <smack request="sys-assert::core" type="rwxat" />
+ </request>
</define>
<request>
<domain name="_" />
diff --git a/packaging/org.tizen.data-provider-master.spec b/packaging/org.tizen.data-provider-master.spec
index 8ab615b..07b6aff 100644
--- a/packaging/org.tizen.data-provider-master.spec
+++ b/packaging/org.tizen.data-provider-master.spec
@@ -1,6 +1,6 @@
Name: org.tizen.data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.15.7
+Version: 0.15.12
Release: 1
Group: framework/livebox
License: Flora License
diff --git a/pkgmgr_livebox/src/service_register.c b/pkgmgr_livebox/src/service_register.c
index 786e9ba..1b15470 100644
--- a/pkgmgr_livebox/src/service_register.c
+++ b/pkgmgr_livebox/src/service_register.c
@@ -2125,7 +2125,7 @@ static inline int db_insert_livebox(struct livebox *livebox, const char *appid)
if (livebox->size_list & LB_SIZE_TYPE_EASY_3x3) {
ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x3, (char *)livebox->preview[9]);
- if (ret < 9)
+ if (ret < 0)
goto errout;
}
diff --git a/util_liveinfo/src/liveinfo.c b/util_liveinfo/src/liveinfo.c
index 3a72f91..7506620 100644
--- a/util_liveinfo/src/liveinfo.c
+++ b/util_liveinfo/src/liveinfo.c
@@ -492,139 +492,206 @@ static inline void fini_directory(void)
{
}
-static inline void do_command(const char *cmd)
+static inline struct node *update_target_dir(const char *cmd)
{
- char command[256];
- char argument[4096] = { '\0', };
+ struct node *node;
- if (!strlen(cmd) || *cmd == '#') {
- prompt(NULL);
- return;
+ node = (*cmd == '/') ? s_info.rootdir : s_info.curdir;
+ node = node_find(s_info.targetdir, cmd);
+
+ return node;
+}
+
+static int get_token(const char *src, char *out)
+{
+ int len = 0;
+ while (*src && *src == ' ') src++;
+
+ if (!*src)
+ return 0;
+
+ while (*src && *src != ' ') {
+ *out++ = *src++;
+ len++;
}
- if (sscanf(cmd, "%255[^ ] %s", command, argument) == 2)
- cmd = command;
+ *out = '\0';
+ return len;
+}
- if (!strcasecmp(cmd, "exit") || !strcasecmp(cmd, "quit")) {
- ecore_main_loop_quit();
- } else if (!strcasecmp(cmd, "set")) {
- char variable[4096] = { '0', };
- char value[4096] = { '0', };
+static inline int do_set(const char *cmd)
+{
+ int i;
+ char variable[4096] = { '0', };
- if (sscanf(argument, "%4095[^ ] %s", variable, value) != 2) {
- printf("Invalid argument(%s): set [VAR] [VAL]\n", argument);
- goto out;
- }
+ cmd += 4;
+ i = get_token(cmd, variable);
- send_command(cmd, variable, value);
- } else if (!strcasecmp(cmd, "get")) {
- send_command(cmd, argument, "");
- } else if (!strcasecmp(cmd, "ls")) {
- const char *name;
- struct node *parent;
+ cmd += i;
+ while (*cmd && *cmd == ' ') cmd++;
- if (*argument) {
- s_info.targetdir = (*argument == '/') ? s_info.rootdir : s_info.curdir;
- s_info.targetdir = node_find(s_info.targetdir, argument);
- } else {
- s_info.targetdir = s_info.curdir;
- }
+ if (!i || !*cmd) {
+ printf("Invalid argument(%s): set [VAR] [VAL]\n", cmd);
+ return -EINVAL;
+ }
- if (!s_info.targetdir) {
- printf("%s is not exists\n", argument);
- goto out;
- }
+ send_command("set", variable, cmd);
+ return 0;
+}
- name = node_name(s_info.targetdir);
- if (name) {
- if (!strcmp(name, "package")) {
- if (s_info.cmd == NOP) {
- send_pkg_list();
- return;
- }
+static inline int do_get(const char *cmd)
+{
+ cmd += 4;
- printf("Waiting the server response\n");
- goto out;
- } else if (!strcmp(name, "provider")) {
- if (s_info.cmd == NOP) {
- send_slave_list();
- return;
- }
+ while (*cmd && *cmd == ' ') cmd++;
+ if (!*cmd) {
+ printf("Invalid argument(%s): get [VAR]\n", cmd);
+ return -EINVAL;
+ }
- printf("Waiting the server response\n");
- goto out;
- }
- }
+ send_command("get", cmd, "");
+ return 0;
+}
- parent = node_parent(s_info.targetdir);
- if (parent && node_name(parent)) {
- if (!strcmp(node_name(parent), "package")) {
- if (s_info.cmd != NOP) {
- printf("Waiting the server response\n");
- goto out;
- }
- send_inst_list(name);
- return;
+static inline int do_ls(const char *cmd)
+{
+ const char *name;
+ struct node *parent;
+
+ cmd += 2;
+
+ while (*cmd && *cmd == ' ')
+ cmd++;
+
+ s_info.targetdir = *cmd ? update_target_dir(cmd) : s_info.curdir;
+ if (!s_info.targetdir) {
+ printf("%s is not exists\n", cmd);
+ return -ENOENT;
+ }
+
+ name = node_name(s_info.targetdir);
+ if (name) {
+ if (!strcmp(name, "package")) {
+ if (s_info.cmd == NOP) {
+ send_pkg_list();
+ return 0;
}
- }
- ls();
- } else if (!strcasecmp(cmd, "cd")) {
- if (!*argument)
- goto out;
+ printf("Waiting the server response\n");
+ return -EBUSY;
+ } else if (!strcmp(name, "provider")) {
+ if (s_info.cmd == NOP) {
+ send_slave_list();
+ return 0;
+ }
- if (s_info.cmd != NOP) {
printf("Waiting the server response\n");
- goto out;
+ return -EBUSY;
}
+ }
- s_info.targetdir = (*argument == '/') ? s_info.rootdir : s_info.curdir;
- s_info.targetdir = node_find(s_info.targetdir, argument);
- if (!s_info.targetdir) {
- printf("%s is not exists\n", argument);
- goto out;
- }
+ parent = node_parent(s_info.targetdir);
+ if (parent && node_name(parent)) {
+ if (!strcmp(node_name(parent), "package")) {
+ if (s_info.cmd != NOP) {
+ printf("Waiting the server response\n");
+ return -EBUSY;
+ }
- if (node_type(s_info.targetdir) != NODE_DIR) {
- printf("Unable change directory to %s\n", argument);
- goto out;
+ send_inst_list(name);
+ return 0;
}
+ }
- if (!(node_mode(s_info.targetdir) & NODE_EXEC)) {
- printf("Access denied %s\n", argument);
- goto out;
- }
+ ls();
+ return -1;
+}
- s_info.curdir = s_info.targetdir;
- } else if (!strcasecmp(cmd, "rm")) {
- if (!*argument)
- goto out;
+static inline int do_cd(const char *cmd)
+{
+ cmd += 2;
- if (s_info.cmd != NOP) {
- printf("Waiting the server response\n");
- goto out;
- }
+ while (*cmd && *cmd == ' ')
+ cmd++;
- s_info.targetdir = (*argument == '/') ? s_info.rootdir : s_info.curdir;
- s_info.targetdir = node_find(s_info.targetdir, argument);
- if (!s_info.targetdir) {
- printf("%s is not exists\n", argument);
- goto out;
- }
+ if (!*cmd)
+ return -1;
- if (!(node_mode(s_info.targetdir) & NODE_WRITE)) {
- printf("Access denied %s\n", argument);
- goto out;
- }
+ if (s_info.cmd != NOP) {
+ printf("Waiting the server response\n");
+ return -EBUSY;
+ }
- send_inst_delete();
- } else if (!strcasecmp(cmd, "help")) {
- help();
- } else {
- printf("Unknown command - \"help\"\n");
+ s_info.targetdir = update_target_dir(cmd);
+ if (!s_info.targetdir) {
+ printf("%s is not exists\n", cmd);
+ return -ENOENT;
+ }
+
+ if (node_type(s_info.targetdir) != NODE_DIR) {
+ printf("Unable change directory to %s\n", cmd);
+ return -EINVAL;
+ }
+
+ if (!(node_mode(s_info.targetdir) & NODE_EXEC)) {
+ printf("Access denied %s\n", cmd);
+ return -EACCES;
+ }
+
+ s_info.curdir = s_info.targetdir;
+ return -1;
+}
+
+static inline int do_rm(const char *cmd)
+{
+ cmd += 2;
+ while (*cmd && *cmd == ' ') cmd++;
+ if (!*cmd)
+ return -1;
+
+ if (s_info.cmd != NOP) {
+ printf("Waiting the server response\n");
+ return -EBUSY;
+ }
+
+ s_info.targetdir = update_target_dir(cmd);
+ if (!s_info.targetdir) {
+ printf("%s is not exists\n", cmd);
+ return -ENOENT;
+ }
+
+ if (!(node_mode(s_info.targetdir) & NODE_WRITE)) {
+ printf("Access denied %s\n", cmd);
+ return -EACCES;
+ }
+
+ send_inst_delete();
+ return 0;
+}
+
+static inline void do_command(const char *cmd)
+{
+ /* Skip the first spaces */
+ while (*cmd && *cmd == ' ') cmd++;
+
+ if (strlen(cmd) && *cmd != '#') {
+ if (!strncasecmp(cmd, "exit", 4) || !strncasecmp(cmd, "quit", 4)) {
+ ecore_main_loop_quit();
+ } else if (!strncasecmp(cmd, "set ", 4) && do_set(cmd) == 0) {
+ return;
+ } else if (!strncasecmp(cmd, "get ", 4) && do_get(cmd) == 0) {
+ return;
+ } else if (!strncasecmp(cmd, "ls", 2) && do_ls(cmd) == 0) {
+ return;
+ } else if (!strncasecmp(cmd, "cd", 2) && do_cd(cmd) == 0) {
+ return;
+ } else if (!strncasecmp(cmd, "rm", 2) && do_rm(cmd) == 0) {
+ return;
+ } else {
+ help();
+ }
}
-out:
prompt(NULL);
return;
}