From: Taeyoung Kim Date: Sat, 6 Jun 2015 12:18:20 +0000 (+0900) Subject: common: move file paths to spec file X-Git-Tag: submit/tizen/20150609.090025~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f0fcdb82f9c51a8ed7545cac66df33fec994fa3;p=platform%2Fcore%2Fapi%2Fsystem-info.git common: move file paths to spec file - The paths of config files are configurable. Thus the positions to define the paths are moved to the spec file. Change-Id: Ia15309e6286eba38be5de7d934257d469d42920d Signed-off-by: Taeyoung Kim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 709b02a..ebf03a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,11 @@ IF("${ARCH}" STREQUAL "arm") ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DCONFIG_FILE_PATH=\"${CONFIG_FILE_PATH}\"") +ADD_DEFINITIONS("-DINFO_FILE_PATH=\"${INFO_FILE_PATH}\"") +ADD_DEFINITIONS("-DOS_RELEASE_FILE_PATH=\"${OS_RELEASE_FILE_PATH}\"") +ADD_DEFINITIONS("-DSERIAL_PATH=\"${SERIAL_PATH}\"") +ADD_DEFINITIONS("-DTIZEN_ID_PATH=\"${TIZEN_ID_PATH}\"") ADD_DEFINITIONS("-DSLP_DEBUG") ADD_DEFINITIONS("-DLIBPATH=\"${LIB_INSTALL_DIR}\"") diff --git a/include/system_info_private.h b/include/system_info_private.h index 7aeebdb..1d3625c 100644 --- a/include/system_info_private.h +++ b/include/system_info_private.h @@ -27,12 +27,8 @@ extern "C" #define API __attribute__ ((visibility("default"))) #endif -#define INFO_FILE_PATH "/etc/info.ini" -#define OS_RELEASE_FILE_PATH "/etc/os-release" #define CPU_INFO_FILE_PATH "/proc/cpuinfo" #define CPU_INFO_MAX_FREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq" -#define CONFIG_FILE_PATH "/etc/config/model-config.xml" -#define SERIAL_PATH "/csa/imei/serialno.dat" #define MAXBUFSIZE 512 #define PLATFORM_TAG "platform" diff --git a/packaging/capi-system-info.spec b/packaging/capi-system-info.spec index a524a92..61638e3 100644 --- a/packaging/capi-system-info.spec +++ b/packaging/capi-system-info.spec @@ -40,13 +40,23 @@ Requires: %{name} = %{version}-%{release} %setup -q cp %{SOURCE1001} . +%define config_file_path /etc/config/model-config.xml +%define info_file_path /etc/info.ini +%define os_release_file_path /etc/os-release +%define serial_path /csa/imei/serialno.dat +%define tizen_id_path /opt/home/root/tizenid + %build -MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%cmake . \ %if !%{with x} && %{with wayland} -%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DENABLE_WAYLAND=TRUE -%else -%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} + -DENABLE_WAYLAND=TRUE \ %endif + -DCONFIG_FILE_PATH=%{config_file_path} \ + -DINFO_FILE_PATH=%{info_file_path} \ + -DOS_RELEASE_FILE_PATH=%{os_release_file_path} \ + -DSERIAL_PATH=%{serial_path} \ + -DTIZEN_ID_PATH=%{tizen_id_path} + %__make %{?_smp_mflags} %install diff --git a/src/system_info_no_file.c b/src/system_info_no_file.c index d64e4f7..583ea70 100644 --- a/src/system_info_no_file.c +++ b/src/system_info_no_file.c @@ -36,8 +36,6 @@ #define SERIAL_TOK_DELIMITER "," #define BUF_MAX 256 -#define TIZEN_ID_PATH "/opt/home/root/tizenid" - static int get_tizenid(char **value) { char id[BUF_MAX]; diff --git a/src/tizenid/tizenid.c b/src/tizenid/tizenid.c index bc79d86..3c194a6 100755 --- a/src/tizenid/tizenid.c +++ b/src/tizenid/tizenid.c @@ -43,9 +43,7 @@ #define KEY_MAX 20 -#define TIZEN_ID_PATH "/opt/home/root/tizenid" #define RANDOM_PATH "/dev/random" -#define MODEL_CONFIG_PATH "/etc/config/model-config.xml" static int get_pw_key(char *pw, unsigned int len) { @@ -90,9 +88,9 @@ static int get_salt_by_model(char *salt, unsigned int len) if (!salt) return -EINVAL; - fp = fopen(MODEL_CONFIG_PATH, "r"); + fp = fopen(CONFIG_FILE_PATH, "r"); if (!fp) { - _E("Failed to open (%s)", MODEL_CONFIG_PATH); + _E("Failed to open (%s)", CONFIG_FILE_PATH); return -ENOENT; }