Add multi-user support 63/16463/1 accepted/tizen_3.0.2014.q3_common tizen_3.0.2014.q3_common tizen_3.0.2014.q4_common tizen_3.0.2015.q1_common tizen_3.0.2015.q2_common tizen_3.0.m1_mobile tizen_3.0.m1_tv accepted/tizen/ivi/20160218.022911 submit/tizen_common/20140521.163740 submit/tizen_common/20140522.130648 submit/tizen_common/20140522.135644 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000001 submit/tizen_mobile/20141120.000000 tizen_3.0.2014.q3_common_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Wed, 12 Feb 2014 16:40:40 +0000 (17:40 +0100)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Mon, 17 Feb 2014 14:48:56 +0000 (15:48 +0100)
Bug-Tizen: PTREL-253
Change-Id: I09b3c1196f6248849fdd39110ae1ffc439eb4d60
Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
CMakeLists.txt
TC/CMakeLists.txt
TC/ppd_test.sh
TC/print-test-opmap.sh
include/pt_optionmapping.h
include/pt_ppd.h
packaging/print-service.spec
scripts/print-test-getppd.sh
src/pt_ppd.c

index a03aad8..6be1c28 100755 (executable)
@@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
 INCLUDE(FindPkgConfig)
 #pkg_check_modules(utils_pkgs REQUIRED ecore eina avahi cups dlog vconf capi-appfw-application)
-pkg_check_modules(utils_pkgs REQUIRED ecore eina dlog vconf capi-appfw-application)
+pkg_check_modules(utils_pkgs REQUIRED ecore eina dlog vconf capi-appfw-application libtzplatform-config)
 
 FOREACH(flag ${utils_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -fdata-sections -ffunction-sections -Wl,--gc-sections")
index 72ec464..5942319 100644 (file)
@@ -7,6 +7,7 @@ SET(PREFIX /usr)
 SET(BINDIR "${PREFIX}/bin")
 SET(LIBDIR ${LIB_INSTALL_DIR})
 SET(SRCS ppd_compare.c)
+SET(ETC ${CMAKE_ETC})
 
 SET(DB_LIB_NAME ptdb)
 SET(GETPPD getppd)
@@ -38,13 +39,13 @@ IF(ENABLE_OM_TESTS)
        SET(HP_PRDLIST     hp_product.list)
        SET(EPSON_LIST     epson.list)
        SET(SAMSUNG_LIST   samsung.list)
-       SET(PRINTLIST_DIR /opt/etc/cups/ppd/)
+       SET(PRINTLIST_DIR ${ETC}/cups/ppd/)
 
        ADD_LIBRARY(${OPMAP_LIB_NAME} SHARED ${SRCS_OM_LIB})
        SET_TARGET_PROPERTIES(${OPMAP_LIB_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
        SET_TARGET_PROPERTIES(${OPMAP_LIB_NAME} PROPERTIES VERSION ${VERSION})
 
-       pkg_check_modules(test_pkgs REQUIRED ecore eina dlog)
+       pkg_check_modules(test_pkgs REQUIRED ecore eina dlog libtzplatform-config)
 
        FOREACH(flag ${test_pkgs_LDFLAGS})
         SET(OPMAP_TEST_LDFLAGS "${flag} ${OPMAP_TEST_LDFLAGS}")
index 6218e80..a73aa25 100755 (executable)
@@ -1,18 +1,20 @@
 #!/bin/sh
 
+eval $(tzplatform-get TZ_SYS_ETC)
+
 #used in extraction test
 hp_drvgz_path="/usr/share/cups/ppd/hp/hp.drv.gz"
 samsung_drvgz_path="/usr/share/cups/ppd/samsung/samsung.drv.gz"
 epson_drvgz_path="/usr/share/cups/ppd/epson/epson.drv.gz"
 
-hp_drv_path="/opt/etc/cups/ppd/hp/hp.drv"
-samsung_drv_path="/opt/etc/cups/ppd/samsung/samsung.drv"
-epson_drv_path="/opt/etc/cups/ppd/epson/epson.drv"
+hp_drv_path=$TZ_SYS_ETC"/cups/ppd/hp/hp.drv"
+samsung_drv_path=$TZ_SYS_ETC"/cups/ppd/samsung/samsung.drv"
+epson_drv_path=$TZ_SYS_ETC"/cups/ppd/epson/epson.drv"
 
-hp_list_path="/opt/etc/cups/ppd/hp.list"
-hp_product_path="/opt/etc/cups/ppd/hp_product.list"
-samsung_list_path="/opt/etc/cups/ppd/samsung.list"
-epson_list_path="/opt/etc/cups/ppd/epson.list"
+hp_list_path=$TZ_SYS_ETC"/cups/ppd/hp.list"
+hp_product_path=$TZ_SYS_ETC"/cups/ppd/hp_product.list"
+samsung_list_path=$TZ_SYS_ETC"/cups/ppd/samsung.list"
+epson_list_path=$TZ_SYS_ETC"/cups/ppd/epson.list"
 
 epson_extraction_complete=0
 samsung_extraction_complete=0
@@ -470,7 +472,7 @@ echo "      Validation TEST - Epson                                                 "
 echo "===================================================================="
 
 EXTRACTION_COMPLETE=$epson_extraction_complete
-ORIGINAL_PPD_PATH="/opt/etc/cups/ppd/org_ppd/epson"
+ORIGINAL_PPD_PATH=$TZ_SYS_ETC"/cups/ppd/org_ppd/epson"
 VALID_PATH=$EPSON_VALID
 VALID_RESULT_PATH=$EPSON_VALID/result
 TEMP_PATH=$EPSON_TEMP
@@ -506,7 +508,7 @@ echo "      Validation TEST - Samsung                                                       "
 echo "===================================================================="
 
 EXTRACTION_COMPLETE=$samsung_extraction_complete
-ORIGINAL_PPD_PATH="/opt/etc/cups/ppd/org_ppd/samsung"
+ORIGINAL_PPD_PATH=$TZ_SYS_ETC"/cups/ppd/org_ppd/samsung"
 VALID_PATH=$SAMSUNG_VALID
 VALID_RESULT_PATH=$SAMSUNG_VALID/result
 TEMP_PATH=$SAMSUNG_TEMP
@@ -542,7 +544,7 @@ echo "      Validation TEST - HP                                                    "
 echo "===================================================================="
 
 EXTRACTION_COMPLETE=$hp_extraction_complete
-ORIGINAL_PPD_PATH="/opt/etc/cups/ppd/org_ppd/hp"
+ORIGINAL_PPD_PATH=$TZ_SYS_ETC"/cups/ppd/org_ppd/hp"
 VALID_PATH=$HP_VALID
 VALID_RESULT_PATH=$HP_VALID/result
 TEMP_PATH=$HP_TEMP
index 974cd9d..a98112d 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 
-PLIST_PATH="/opt/etc/cups/ppd/"
+eval $(tzplatform-get TZ_SYS_ETC)
+
+PLIST_PATH=$TZ_SYS_ETC"/cups/ppd/"
 HP_LIST="hp.list"
 EPSON_LIST="epson.list"
 SAMSUNG_LIST="samsung.list"
index ff13b19..bd2f8ef 100644 (file)
@@ -17,6 +17,9 @@
 *
 */
 
+/* For multi-user support */
+#include <tzplatform_config.h>
+
 #ifndef PT_OPTIONMAPPING_H
 #define PT_OPTIONMAPPING_H
 
@@ -51,7 +54,7 @@ typedef struct {
 } pt_resolution_keyword;
 
 #undef PT_OPTIONCUBE_TEST_PRINT
-#define PT_USER_OPTION_CONFIG_FILE "/opt/etc/cups/ppd/settings.cfg"
+#define PT_USER_OPTION_CONFIG_FILE tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/settings.cfg")
 
 ppd_choice_t *pt_selected_choice(int op, pt_orientation_e p);
 void pt_parse_options(ppd_file_t *ppd);
index 6bf76e0..8d77027 100644 (file)
 *
 */
 
+/* For multi-user support */
+#include <tzplatform_config.h>
+
 #ifndef __PT_PPD_H__
 #define __PT_PPD_H__
 
 #define MAX_PATH_SIZE           512
 #define MAX_COMMAND_SIZE        128*128
 #define MANUFACTURER_NUM        3
-#define PPD_DIR                                "/opt/etc/cups/ppd"
+#define PPD_DIR                                 tzplatform_mkpath3(TZ_SYS_ETC, "cups", "ppd")
 
 /**
  *  This function let the app get ppd file for the specified printer
index 280c1f0..72916aa 100755 (executable)
@@ -1,52 +1,52 @@
-%global DATADIR /opt
-
 Name:       print-service
-Summary:    print service library
+Summary:    Print service library
 Version:    1.2.9
-Release:    1
+Release:    0
 Group:      System/Libraries
-License:    Flora Software License
+License:    Flora
 Source0:    %{name}-%{version}.tar.gz
 Source1001: print-service.manifest
 Source1002: print-driver-data.manifest
 Source1003: print-service-tests.manifest 
-BuildRequires: cmake
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(eina)
-BuildRequires: pkgconfig(ecore)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: glib2-devel
-BuildRequires: binutils-devel
-BuildRequires: cups-devel
-BuildRequires: libxml2-devel
-BuildRequires: capi-appfw-application-devel
-Requires: glib2
-Requires: cups
-Requires(post):  /sbin/ldconfig
-Requires(postun):  /sbin/ldconfig
+BuildRequires:    cmake
+BuildRequires:    pkgconfig(dlog)
+BuildRequires:    pkgconfig(eina)
+BuildRequires:    pkgconfig(ecore)
+BuildRequires:    pkgconfig(vconf)
+BuildRequires:    pkgconfig(libtzplatform-config)
+BuildRequires:    glib2-devel
+BuildRequires:    binutils-devel
+BuildRequires:    cups-devel
+BuildRequires:    libxml2-devel
+BuildRequires:    capi-appfw-application-devel
+Requires:         tizen-platform-config-tools
+Requires:         cups
+Requires(post):   /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
 BuildRoot:  %{_tmppath}/%{name}-%{version}-build
 
 %description
-print-service library
+Print-service library
 
 %package devel
-Summary:    print library - development file
+Summary:    Print library - development file
 Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
 
 %description devel
-print library - development file
+Print library - development file
 
 %package -n print-driver-data
-Summary:    printer data - ppd, cts, data files
+Summary:    Printer data - ppd, cts, data files
 Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
 
 %description -n print-driver-data
-printer data - ppd, cts, data files
+Printer data - ppd, cts, data files
 
 %package tests
-Summary:    testing utilities
+Summary:    Testing utilities
 Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
 
@@ -60,7 +60,7 @@ Set of utilities for testing different parts of library
 cp %{SOURCE1001} .
 cp %{SOURCE1002} .
 cp %{SOURCE1003} .
-%cmake . -DENABLE_OM_TESTS=On
+%cmake . -DENABLE_OM_TESTS=On -DCMAKE_ETC=%{TZ_SYS_ETC}
 
 %install
 rm -rf %{buildroot}
@@ -75,19 +75,19 @@ rm -rf %{buildroot}
 %post
 /sbin/ldconfig
 
-if ! [ -d /opt/etc/cups/ppd/hp ]
+if ! [ -d %{TZ_SYS_ETC}/cups/ppd/hp ]
 then
-       mkdir -p /opt/etc/cups/ppd/hp
+       mkdir -p %{TZ_SYS_ETC}/cups/ppd/hp
 fi
-if ! [ -d /opt/etc/cups/ppd/epson ]
+if ! [ -d %{TZ_SYS_ETC}/cups/ppd/epson ]
 then
-       mkdir -p /opt/etc/cups/ppd/epson
+       mkdir -p %{TZ_SYS_ETC}/cups/ppd/epson
 fi
-if ! [ -d /opt/etc/cups/ppd/samsung ]
+if ! [ -d %{TZ_SYS_ETC}/cups/ppd/samsung ]
 then
-       mkdir -p /opt/etc/cups/ppd/samsung
+       mkdir -p %{TZ_SYS_ETC}/cups/ppd/samsung
 fi
-chown -R 5000:5000 /opt/etc/cups/ppd
+chown -R :%{TZ_SYS_USER_GROUP} %{TZ_SYS_ETC}/cups/ppd
 
 %post -n print-driver-data
 mkdir -p /usr/share/cups/model/samsung
@@ -98,17 +98,17 @@ if [ -e /usr/share/cups/model/samsung/cms ]
 then
        rm /usr/share/cups/model/samsung/cms
 fi
-if [ -f /opt/etc/cups/ppd/hp/hp.drv ]
+if [ -f %{TZ_SYS_ETC}/cups/ppd/hp/hp.drv ]
 then
-       rm /opt/etc/cups/ppd/hp/hp.drv
+       rm %{TZ_SYS_ETC}/cups/ppd/hp/hp.drv
 fi
-if [ -f /opt/etc/cups/ppd/samsung/samsung.drv ]
+if [ -f %{TZ_SYS_ETC}/cups/ppd/samsung/samsung.drv ]
 then
-       rm /opt/etc/cups/ppd/samsung/samsung.drv
+       rm %{TZ_SYS_ETC}/cups/ppd/samsung/samsung.drv
 fi
-if [ -f /opt/etc/cups/ppd/epson/epson.drv ]
+if [ -f %{TZ_SYS_ETC}/cups/ppd/epson/epson.drv ]
 then
-       rm /opt/etc/cups/ppd/epson/epson.drv
+       rm %{TZ_SYS_ETC}/cups/ppd/epson/epson.drv
 fi
 
 %postun
@@ -134,10 +134,10 @@ fi
 /usr/share/license/print-driver-data
 %dir /usr/share/cups/ppd/
 /usr/share/cups/ppd/*
-%exclude %{DATADIR}/etc/cups/ppd/hp_product.list
-%exclude %{DATADIR}/etc/cups/ppd/hp.list
-%exclude %{DATADIR}/etc/cups/ppd/epson.list
-%exclude %{DATADIR}/etc/cups/ppd/samsung.list
+%exclude %{TZ_SYS_ETC}/cups/ppd/hp_product.list
+%exclude %{TZ_SYS_ETC}/cups/ppd/hp.list
+%exclude %{TZ_SYS_ETC}/cups/ppd/epson.list
+%exclude %{TZ_SYS_ETC}/cups/ppd/samsung.list
 
 %files -n print-service-tests
 %manifest print-service-tests.manifest
@@ -147,10 +147,10 @@ fi
 %attr(0755,root,root) %{_bindir}/test-opmap
 %attr(0755,root,root) %{_bindir}/print-test-opmap.sh
 %{_libdir}/libopmap.so*
-%attr(-,app,app) %{DATADIR}/etc/cups/ppd/hp.list
-%attr(-,app,app) %{DATADIR}/etc/cups/ppd/hp_product.list
-%attr(-,app,app) %{DATADIR}/etc/cups/ppd/epson.list
-%attr(-,app,app) %{DATADIR}/etc/cups/ppd/samsung.list
+%attr(-,-,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_ETC}/cups/ppd/hp.list
+%attr(-,-,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_ETC}/cups/ppd/hp_product.list
+%attr(-,-,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_ETC}/cups/ppd/epson.list
+%attr(-,-,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_ETC}/cups/ppd/samsung.list
 
 %changelog
 
index af93689..9b67120 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 
-PLIST_PATH="/opt/etc/cups/ppd/"
+eval $(tzplatform-get TZ_SYS_ETC)
+
+PLIST_PATH=$TZ_SYS_ETC"/cups/ppd/"
 HP_LIST="hp.list"
 EPSON_LIST="epson.list"
 SAMSUNG_LIST="samsung.list"
index d83421a..54fe3de 100644 (file)
 #include <limits.h>
 #include <stdlib.h>
 
+/* For multi-user support */
+#include <tzplatform_config.h>
+
 #include <pt_db.h>
 #include "pt_debug.h"
 #include "pt_common.h"
 #include "pt_ppd.h"
 
 #define GETPPD "/usr/bin/getppd"
-#define CUPS_PPDDIR "/opt/etc/cups/ppd/"
-#define SAMSUNG_DRV "/opt/etc/cups/ppd/samsung/samsung.drv"
-#define SAMSUNG_DRV_GZ "/opt/etc/cups/ppd/samsung/samsung.drv.gz"
+#define CUPS_PPDDIR tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/")
+#define SAMSUNG_DRV tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/samsung/samsung.drv")
+#define SAMSUNG_DRV_GZ tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/samsung/samsung.drv.gz")
 #define SAMSUNG_DRV_GZ_ORG "/usr/share/cups/ppd/samsung/samsung.drv.gz"
-#define HP_DRV "/opt/etc/cups/ppd/hp/hp.drv"
-#define HP_DRV_GZ "/opt/etc/cups/ppd/hp/hp.drv.gz"
+#define HP_DRV tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/hp/hp.drv")
+#define HP_DRV_GZ tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/hp/hp.drv.gz")
 #define HP_DRV_GZ_ORG "/usr/share/cups/ppd/hp/hp.drv.gz"
-#define EPSON_DRV "/opt/etc/cups/ppd/epson/epson.drv"
-#define EPSON_DRV_GZ "/opt/etc/cups/ppd/epson/epson.drv.gz"
+#define EPSON_DRV tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/epson/epson.drv")
+#define EPSON_DRV_GZ tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/epson/epson.drv.gz")
 #define EPSON_DRV_GZ_ORG "/usr/share/cups/ppd/epson/epson.drv.gz"
-#define SAMSUNG_PPD_DIR "/opt/etc/cups/ppd/samsung"
-#define EPSON_PPD_DIR "/opt/etc/cups/ppd/epson"
-#define HP_PPD_DIR "/opt/etc/cups/ppd/hp"
+#define SAMSUNG_PPD_DIR tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/samsung")
+#define EPSON_PPD_DIR tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/epson")
+#define HP_PPD_DIR tzplatform_mkpath(TZ_SYS_ETC, "cups/ppd/hp")
 
 #define PPDC_PREFIX "ppdc: Writing ./"