4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
32 #include "nativeinstaller.h"
33 #include "native_installer_util.h"
35 static int __pkgmgr_txt_parser_fill_pkginfo(pkginfo *info, char *line);
37 char evt_notification[64] = { 0, };
39 static int __pkgmgr_txt_parser_fill_pkginfo(pkginfo *info, char *line)
46 ret = regcomp(&re, "[Pp]ackage[\\ ]*:[\\ ]*([.A-Z0-9a-z_\\-]+)",
49 d_msg_backend(DEBUG_ERR, "[fillPkgInfo]regcomp failed(%d)",
53 ret = regexec(&re, line, 5, mached, 0);
57 retstr = _substring(line, mached[1].rm_so,
58 mached[1].rm_eo - mached[1].rm_so);
59 d_msg_backend(DEBUG_ERR, "[fillPkgInfo]PackageName=%s\n",
61 strncpy(info->package_name, retstr,
62 sizeof(info->package_name) - 1);
69 "Version[\\ ]*:[\\ ]*([0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3})",
72 d_msg_backend(DEBUG_ERR, "[fillPkgInfo]regcomp failed(%d)",
76 ret = regexec(&re, line, 5, mached, 0);
80 retstr = _substring(line, mached[1].rm_so,
81 mached[1].rm_eo - mached[1].rm_so);
82 d_msg_backend(DEBUG_INFO, "[fillPkgInfo]Version=%s\n", retstr);
83 strncpy(info->version, retstr, sizeof(info->version) - 1);
90 "[Aa]pp[Ss]etting[Nn]otification[\\ ]*:[\\ ]*([.A-Z0-9a-z_\\-]+)",
93 d_msg_backend(DEBUG_ERR, "[fillPkgInfo]regcomp failed(%d)",
97 ret = regexec(&re, line, 5, mached, 0);
101 retstr = _substring(line, mached[1].rm_so,
102 mached[1].rm_eo - mached[1].rm_so);
103 d_msg_backend(DEBUG_ERR,
104 "[fillPkgInfo]AppSettingNotification=%s\n",
106 strncpy(evt_notification, retstr, strlen(retstr));
114 pkginfo *_pkgmgr_txt_parser_read_manifest(char *manifestfile)
119 pkginfo *info = malloc(sizeof(pkginfo));
122 memset(info, 0, sizeof(pkginfo));
124 fp1 = fopen(manifestfile, "r");
126 d_msg_backend(DEBUG_ERR, "failed to open file(%s)\n",
136 c = fgets(line, 512, fp1);
138 __pkgmgr_txt_parser_fill_pkginfo(info, line);