These codes are out-dated.
Change-Id: I65b798eecca2eac4db8606d1efeea34ff1693b30
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
+++ /dev/null
-add_subdirectory(sample)
+++ /dev/null
-include(FindPkgConfig)
-pkg_check_modules(parser_pkgs REQUIRED dlog libxml-2.0)
-
-foreach(flag ${parser_pkgs_CFLAGS})
- set(parser_pkgs_CFLAGS_str "${parser_pkgs_CFLAGS_str} ${flag}")
-endforeach()
-
-add_executable(pkgmgr_backend_sample
- sample_backend.c)
-target_link_libraries(pkgmgr_backend_sample pkgmgr_installer)
-
-add_library(pkgmgr_backend_lib_sample SHARED
- sample_backendlib.c)
-
-add_library(pkgmgr_parser_lib_sample SHARED
- sample_parserlib.c)
-set_target_properties(pkgmgr_parser_lib_sample PROPERTIES COMPILE_FLAGS "${parser_pkgs_CFLAGS_str}")
-target_link_libraries(pkgmgr_parser_lib_sample ${parser_pkgs_LDFLAGS})
-
-install(TARGETS pkgmgr_backend_sample
- DESTINATION bin
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
-
-install(TARGETS pkgmgr_backend_lib_sample
- DESTINATION ${LIB_INSTALL_DIR}
- COMPONENT RuntimeLibraries
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
-
-install(TARGETS pkgmgr_parser_lib_sample
- DESTINATION ${LIB_INSTALL_DIR}
- COMPONENT RuntimeLibraries
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
+++ /dev/null
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-
-
-
-/* sample_backend.c
- * test package
- */
-
-
-/* Pkgmgr installer headers */
-#include "pkgmgr_installer.h"
-
-/* GUI headers */
-
-/* glibc headers */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-static int __confirm_ui(void *data, char *msg);
-static int __install_package(const char *pkg_file_path);
-static int __uninstall_package(const char *pkgid);
-static int __recover_package_system(void);
-
-static pkgmgr_installer *_pi;
-
-static int __confirm_ui(void *data, char *msg)
-{
- /* Show confirm ui */
-
- return 1;
-}
-
-static int __install_package(const char *pkg_file_path)
-{
- if (__confirm_ui(NULL, "Install?")) {
- /* Install package, and send signal */
-
- }
-
- int ret = 0;
- ret = pkgmgr_installer_send_signal(_pi, "sample", "abc", "end", "ok");
- if (ret == 0) {
- system("touch /opt/etc/install_complete");
- }
-
- return 0;
-}
-
-static int __uninstall_package(const char *pkgid)
-{
- return 0;
-}
-
-static int __clear_package(const char *pkgid)
-{
- return 0;
-}
-
-static int __recover_package_system(void)
-{
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- int ret = 0;
- pkgmgr_installer *pi = pkgmgr_installer_new();
-
- _pi = pi;
-
- pkgmgr_installer_receive_request(pi, argc, argv);
-
- int req_type = pkgmgr_installer_get_request_type(pi);
- if (PKGMGR_REQ_INVALID >= req_type)
- return EINVAL;
-
- const char *pkg_info = pkgmgr_installer_get_request_info(pi);
-
- switch (req_type) {
- case PKGMGR_REQ_INSTALL:
- ret = __install_package(pkg_info);
- break;
- case PKGMGR_REQ_UNINSTALL:
- ret = __uninstall_package(pkg_info);
- break;
- case PKGMGR_REQ_CLEAR:
- ret = __clear_package(pkg_info);
- break;
- case PKGMGR_REQ_RECOVER:
- ret = __recover_package_system();
- break;
- default:
- ret = EINVAL;
- }
-
- return ret;
-}
-
+++ /dev/null
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-
-
-
-/* sample_backendlib.c
- * test package
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "package-manager-plugin.h"
-
-static void pkg_native_plugin_on_unload(void);
-static int pkg_plugin_app_is_installed(const char *pkgid);
-static int pkg_plugin_get_installed_apps_list(const char *category,
- const char *option,
- package_manager_pkg_info_t **
- list, int *count);
-static int pkg_plugin_get_app_detail_info(const char *pkgid,
- package_manager_pkg_detail_info_t *
- pkg_detail_info);
-static int pkg_plugin_get_app_detail_info_from_package(const char *pkg_path,
- package_manager_pkg_detail_info_t
- *pkg_detail_info);
-
-static void pkg_native_plugin_on_unload(void)
-{
- printf("pkg_native_plugin_unload() is called\n");
-}
-
-static int pkg_plugin_app_is_installed(const char *pkgid)
-{
- printf("pkg_plugin_app_is_installed() is called\n");
-
- return 0;
-}
-
-static int pkg_plugin_get_installed_apps_list(const char *category,
- const char *option,
- package_manager_pkg_info_t **
- list, int *count)
-{
- printf("pkg_plugin_get_installed_apps_list() is called\n");
-
- return 0;
-}
-
-static int pkg_plugin_get_app_detail_info(const char *pkgid,
- package_manager_pkg_detail_info_t *
- pkg_detail_info)
-{
- printf("pkg_plugin_get_app_detail_info() is called\n");
-
- return 0;
-}
-
-static int pkg_plugin_get_app_detail_info_from_package(const char *pkg_path,
- package_manager_pkg_detail_info_t
- *pkg_detail_info)
-{
- printf("pkg_plugin_get_app_detail_info_from_package() is called\n");
-
- return 0;
-}
-
-__attribute__ ((visibility("default")))
-int pkg_plugin_on_load(pkg_plugin_set *set)
-{
- if (set == NULL) {
- return -1;
- }
-
- memset(set, 0x00, sizeof(pkg_plugin_set));
-
- set->plugin_on_unload = pkg_native_plugin_on_unload;
- set->pkg_is_installed = pkg_plugin_app_is_installed;
- set->get_installed_pkg_list = pkg_plugin_get_installed_apps_list;
- set->get_pkg_detail_info = pkg_plugin_get_app_detail_info;
- set->get_pkg_detail_info_from_package =
- pkg_plugin_get_app_detail_info_from_package;
-
- return 0;
-}
-
+++ /dev/null
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-
-
-
-/* sample_parserlib.c
- * test package
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <libxml/xmlreader.h>
-
-/* debug output */
-#include <dlog.h>
-#undef LOG_TAG
-#define LOG_TAG "PKGMGR_PARSER"
-
-#define DBGE(fmt, arg...) LOGE("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
-#define DBGI(fmt, arg...) LOGD("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
-
-
-static void
-print_element_names(xmlNode * a_node)
-{
- xmlNode *cur_node = NULL;
-
- for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
- if (cur_node->type == XML_ELEMENT_NODE) {
- DBGI("node type: Element, name: %s\n", cur_node->name);
- }
-
- print_element_names(cur_node->children);
- }
-}
-
-
-__attribute__ ((visibility("default")))
-int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr)
-{
- xmlNode *root_element = NULL;
-
- xmlTextReaderPtr reader = xmlReaderWalker(docPtr);
- if(reader != NULL) {
- int ret = xmlTextReaderRead(reader);
- while(ret == 1) {
- const xmlChar *name;
- name = xmlTextReaderConstName(reader);
- DBGI("name %s", name?(const char *)name:"NULL");
- ret = xmlTextReaderRead(reader);
- }
- xmlFreeTextReader(reader);
-
- if(ret != 0) {
- DBGE("failed to parse");
- }
- }
-
- /*Get the root element node */
- root_element = xmlFirstElementChild(xmlDocGetRootElement(docPtr));
-
- print_element_names(root_element);
-
- return 0;
-}
-