Clean up repository 23/98123/2 accepted/tizen/3.0/common/20161207.194236 accepted/tizen/3.0/ivi/20161207.010655 accepted/tizen/3.0/mobile/20161207.010615 accepted/tizen/3.0/tv/20161207.010626 accepted/tizen/3.0/wearable/20161207.010633 submit/tizen_3.0/20161206.012225
authorSangyoon Jang <s89.jang@samsung.com>
Wed, 16 Nov 2016 07:34:16 +0000 (16:34 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Wed, 16 Nov 2016 07:44:23 +0000 (16:44 +0900)
Fix CMakeLists.txt to make extendible.
Clean build dependency of each components.
Rename some files.

Change-Id: I5fe6ee6d7618ec6da82ec717fec9e50cab6681c1
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
17 files changed:
CMakeLists.txt
packaging/app2sd.spec
plugin/app2sd/CMakeLists.txt
plugin/app2sd/common/inc/app2sd_utils.h [moved from common/inc/app2ext_utils.h with 100% similarity]
plugin/app2sd/common/src/app2sd_utils.c [moved from common/src/app2ext_utils.c with 98% similarity]
plugin/app2sd/lib/app2sd_client_interface.c [moved from plugin/app2sd/src/app2sd_client_interface.c with 99% similarity]
plugin/app2sd/lib/app2sd_client_interface.h [moved from plugin/app2sd/inc/app2sd_client_interface.h with 100% similarity]
plugin/app2sd/server/app2sd_interface.c [moved from plugin/app2sd/src/app2sd_interface.c with 100% similarity]
plugin/app2sd/server/app2sd_interface.h [moved from plugin/app2sd/inc/app2sd_interface.h with 98% similarity]
plugin/app2sd/server/app2sd_internals.c [moved from plugin/app2sd/src/app2sd_internals.c with 100% similarity]
plugin/app2sd/server/app2sd_internals.h [moved from plugin/app2sd/inc/app2sd_internals.h with 100% similarity]
plugin/app2sd/server/app2sd_internals_registry.c [moved from plugin/app2sd/src/app2sd_internals_registry.c with 100% similarity]
plugin/app2sd/server/app2sd_internals_utils.c [moved from plugin/app2sd/src/app2sd_internals_utils.c with 100% similarity]
plugin/app2sd/server/app2sd_server.c [moved from plugin/app2sd/src/app2sd_server.c with 100% similarity]
src/app2ext_debug.h [new file with mode: 0644]
src/app2ext_interface.c
test/src/test_app2ext.c

index e6c7a4c..56cfec8 100644 (file)
@@ -27,17 +27,13 @@ SET(CMAKE_C_FLAGS "${EXTRA_CFLAGS} ${APP2EXT_CFLAGS}")
 ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
 
 # Local include directories
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
-       ${CMAKE_SOURCE_DIR}/common/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
 
 # build app2ext library
 SET(APP2EXT "app2ext")
-SET(app2ext_src_dir "${CMAKE_SOURCE_DIR}/src")
-SET(libapp2ext_SOURCES
-       ${app2ext_src_dir}/app2ext_interface.c
-       ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src APP2EXT_SRCS)
 
-ADD_LIBRARY(${APP2EXT} SHARED ${libapp2ext_SOURCES})
+ADD_LIBRARY(${APP2EXT} SHARED ${APP2EXT_SRCS})
 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES SOVERSION ${VERSION_MAJOR})
 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES VERSION ${VERSION})
 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIC")
@@ -48,7 +44,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.pc.in ${CMAKE_BINARY_DIR}/app2sd.pc @O
 
 INSTALL(TARGETS ${APP2EXT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/app2ext_interface.h DESTINATION include)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION include)
 
 IF(TIZEN_FEATURE_APP2SD_PLUGIN)
 ADD_SUBDIRECTORY(test)
index bb040c9..088e5c6 100644 (file)
@@ -90,7 +90,7 @@ cp LICENSE %{buildroot}/usr/share/license/%{name}
 
 %files devel
 %defattr(-,root,root,-)
-%{_includedir}/app2ext_interface.h
+%{_includedir}/*.h
 %{_libdir}/pkgconfig/app2sd.pc
 %if 0%{?tizen_feature_app2sd_plugin}
 %{_libdir}/libapp2sd.so
index 526a4b5..5d0138b 100644 (file)
@@ -12,18 +12,16 @@ ENDFOREACH(flag)
 SET(CMAKE_C_FLAGS "${EXTRA_CFLAGS} ${APP2SD_CFLAGS}")
 
 # Local include directories
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
-       ${CMAKE_SOURCE_DIR}/common/inc
-       ${CMAKE_SOURCE_DIR}/plugin/app2sd/inc)
+INCLUDE_DIRECTORIES(
+       ${CMAKE_SOURCE_DIR}/inc
+       ${CMAKE_SOURCE_DIR}/plugin/app2sd/common/inc)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/common/src APP2SD_COMMON_SRCS)
 
 # build app2sd library
 SET(APP2SD "app2sd")
-SET(app2sd_src_dir "${CMAKE_SOURCE_DIR}/plugin/app2sd/src")
-SET(libapp2sd_SOURCES
-       ${app2sd_src_dir}/app2sd_client_interface.c
-       ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
-
-ADD_LIBRARY(${APP2SD} SHARED ${libapp2sd_SOURCES})
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/lib APP2SD_LIB_SRCS)
+ADD_LIBRARY(${APP2SD} SHARED ${APP2SD_LIB_SRCS} ${APP2SD_COMMON_SRCS})
 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES SOVERSION ${VERSION_MAJOR})
 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES VERSION ${VERSION})
 SET_TARGET_PROPERTIES(${APP2SD} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIC")
@@ -33,14 +31,8 @@ INSTALL(TARGETS ${APP2SD} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibrar
 
 # build app2sd-server binary
 SET(APP2SD_SERVER "app2sd-server")
-SET(app2sd_server_SOURCES
-       ${app2sd_src_dir}/app2sd_internals.c
-       ${app2sd_src_dir}/app2sd_interface.c
-       ${app2sd_src_dir}/app2sd_internals_registry.c
-       ${app2sd_src_dir}/app2sd_internals_utils.c
-       ${app2sd_src_dir}/app2sd_server.c
-       ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
-ADD_EXECUTABLE(${APP2SD_SERVER} ${app2sd_server_SOURCES})
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/server APP2SD_SERVER_SRCS)
+ADD_EXECUTABLE(${APP2SD_SERVER} ${APP2SD_SERVER_SRCS} ${APP2SD_COMMON_SRCS})
 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIE ")
 SET_TARGET_PROPERTIES(${APP2SD_SERVER} PROPERTIES LINK_FLAGS "-pie")
 TARGET_LINK_LIBRARIES(${APP2SD_SERVER} app2sd ${app2sd_pkgs_LDFLAGS} "-lm")
similarity index 98%
rename from common/src/app2ext_utils.c
rename to plugin/app2sd/common/src/app2sd_utils.c
index 54d54dc..e2e1a8d 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "app2ext_utils.h"
+#include "app2sd_utils.h"
 
 int _is_global(uid_t uid)
 {
similarity index 99%
rename from plugin/app2sd/src/app2sd_client_interface.c
rename to plugin/app2sd/lib/app2sd_client_interface.c
index 0e34756..5c66bd5 100644 (file)
@@ -30,7 +30,7 @@
 #include <pkgmgr-info.h>
 
 #include "app2sd_client_interface.h"
-#include "app2ext_utils.h"
+#include "app2sd_utils.h"
 
 #define CONNECTION_RETRY_MAX 5
 #define CONNECTION_WAIT_USEC (1000000 / 2) /* 0.5 sec */
similarity index 98%
rename from plugin/app2sd/inc/app2sd_interface.h
rename to plugin/app2sd/server/app2sd_interface.h
index 99c1565..0e2d11a 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 
 #include "app2ext_interface.h"
-#include "app2ext_utils.h"
+#include "app2sd_utils.h"
 
 int app2sd_usr_pre_app_install(const char *pkgid,
                GList *dir_list, int size, uid_t uid);
diff --git a/src/app2ext_debug.h b/src/app2ext_debug.h
new file mode 100644 (file)
index 0000000..a77f852
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * app2ext
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _APP2EXT_DEBUG_H
+#define _APP2EXT_DEBUG_H
+
+#include <dlog.h>
+
+#define _E(fmt, arg...) LOGE(fmt, ##arg)
+#define _D(fmt, arg...) LOGD(fmt, ##arg)
+#define _W(fmt, arg...) LOGW(fmt, ##arg)
+#define _I(fmt, arg...) LOGI(fmt, ##arg)
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "APP2EXT"
+
+#endif
index 3407a7a..5ec1602 100644 (file)
 #include <dirent.h>
 
 #include "app2ext_interface.h"
-#include "app2ext_utils.h"
+#include "app2ext_debug.h"
 
 #define APP2EXT_SD_PLUGIN_PATH LIBPREFIX "/libapp2sd.so"
+#define REGULAR_USER 5000
 
 app2ext_handle *app2ext_init(int storage_type)
 {
index 737d486..69403f5 100644 (file)
 #include <getopt.h>
 #include <unzip.h>
 #include <storage-internal.h>
+#include <tzplatform_config.h>
 
 #include "app2ext_interface.h"
-#include "app2ext_utils.h"
 
 #define SUCCESS 0
 #define FAIL 1
 #define CMD_LEN 256
 #define TEST_PKGNAME "org.example.basicuiapplication"
 #define TEST_PKGNAME_PATH "/tmp/org.example.basicuiapplication-1.0.0-arm.tpk"
+#define OWNER_ROOT 0
+#define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
 
 app2ext_handle *handle = NULL;