1 DESCRIPTION = "Cynara service with client libraries"
3 LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327;beginline=3"
5 PV = "0.14.10+git${SRCPV}"
6 SRCREV = "be455dcaf1400bec0272a6ce90852b9147393a60"
7 SRC_URI = "git://github.com/Samsung/cynara.git"
11 file://cynara-db-migration-abort-on-errors.patch \
12 file://0001-Add-fallthrough-tags.patch \
13 file://0002-gcc-7-requires-include-functional-for-std-function.patch \
14 file://0003-Avoid-warning-when-compiling-without-smack.patch \
15 file://0004-Fix-mode-of-sockets.patch \
16 file://0005-Allow-to-tune-sockets.patch \
17 file://0006-Install-socket-activation-by-default.patch \
18 file://0001-fix-fallthrough-in-cmdlineparser.patch \
28 # Use debug mode to increase logging. Beware, also compiles with less optimization
29 # and thus has to disable FORTIFY_SOURCE below.
30 PACKAGECONFIG[debug] = "-DCMAKE_BUILD_TYPE=DEBUG,-DCMAKE_BUILD_TYPE=RELEASE,libunwind elfutils"
35 -DCMAKE_VERBOSE_MAKEFILE=ON \
36 -DBUILD_WITH_SYSTEMD_DAEMON=ON \
37 -DBUILD_WITH_SYSTEMD_JOURNAL=ON \
38 -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir} \
39 -DSOCKET_DIR=/run/cynara \
43 -DCYNARA_ADMIN_SOCKET_GROUP=cynara \
46 # Explicitly package empty directory. Otherwise Cynara prints warnings
48 # cyad[198]: Couldn't scan for plugins in </usr/lib/cynara/plugin/service/> : <No such file or directory>
49 FILES_${PN}_append = " \
50 ${libdir}/cynara/plugin/service \
51 ${libdir}/cynara/plugin/client \
55 USERADD_PACKAGES = "${PN}"
56 GROUPADD_PARAM_${PN} = "-r cynara"
57 USERADD_PARAM_${PN} = "\
58 --system --home ${localstatedir}/lib/empty \
59 --no-create-home --shell /bin/false \
63 # Causes deadlock during booting, see workaround in postinst below.
65 #SYSTEMD_SERVICE_${PN} = "cynara.service"
67 #do_install_append () {
68 # chmod a+rx ${D}/${sbindir}/cynara-db-migration
70 # install -d ${D}${sysconfdir}/cynara/
71 # install -m 644 ${S}/conf/creds.conf ${D}/${sysconfdir}/cynara/creds.conf
73 # # No need to create empty directories except for those which
74 # # Cynara expects to find.
75 # # install -d ${D}${localstatedir}/cynara/
76 # # install -d ${D}${prefix}/share/cynara/tests/empty_db
77 # install -d ${D}${libdir}/cynara/plugin/client
78 # install -d ${D}${libdir}/cynara/plugin/service
80 # # install db* ${D}${prefix}/share/cynara/tests/
82 # install -d ${D}${systemd_system_unitdir}/sockets.target.wants
83 # ln -s ../cynara.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara.socket
84 # ln -s ../cynara-admin.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara-admin.socket
85 # ln -s ../cynara-agent.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara-agent.socket
88 # We want the post-install logic to create and label /var/cynara, so
89 # it should not be in the package.
90 do_install_append () {
91 rmdir ${D}${localstatedir}/cynara
94 FILES_${PN} += "${systemd_system_unitdir}"
96 # Cynara itself has no dependency on Smack. Only its installation
97 # is Smack-aware in the sense that it sets Smack labels. Do not
98 # depend on smack userspace unless we really need Smack labels.
100 # The Tizen .spec file calls cynara-db-migration in a %pre section.
101 # That only works when cynara-db-migration is packaged separately
102 # (overly complex) and does not seem necessary: perhaps there is a
103 # time window where cynara might already get activated before
104 # the postinst completes, but that is a general problem. It gets
105 # avoided entirely when calling this script while building the
107 DEPENDS_append_with-lsm-smack = " smack smack-native"
108 EXTRA_OECMAKE_append_with-lsm-smack = " -DDB_FILES_SMACK_LABEL=System"
109 CHSMACK_with-lsm-smack = "chsmack"
111 pkg_postinst_ontarget_${PN} () {
112 mkdir -p $D${sysconfdir}/cynara
113 ${CHSMACK} -a System $D${sysconfdir}/cynara
115 # Strip git patch level information, the version comparison code
116 # in cynara-db-migration only expect major.minor.patch version numbers.
117 VERSION=${@d.getVar('PV',d,1).split('+git')[0]}
118 if [ -d $D${localstatedir}/cynara ] ; then
120 echo "NOTE: updating cynara DB to version $VERSION"
121 $D${sbindir}/cynara-db-migration upgrade -f 0.0.0 -t $VERSION
124 echo "NOTE: creating cynara DB for version $VERSION"
125 mkdir -p $D${localstatedir}/cynara
126 ${CHSMACK} -a System $D${localstatedir}/cynara
127 $D${sbindir}/cynara-db-migration install -t $VERSION
130 # Workaround for systemd.bbclass issue: it would call
131 # "systemctl start" without "--no-block", but because
132 # the service is not ready to run at the time when
133 # this scripts gets executed by run-postinsts.service,
135 echo "NOTE: enabling and starting cynara service"
136 systemctl enable cynara
137 systemctl start --no-block cynara
140 # Testing depends on gmock and gtest. They can be found in meta-oe
141 # and are not necessarily available, so this feature is off by default.
142 # If gmock from meta-oe is used, then a workaround is needed to avoid
143 # a link error (libgmock.a calls pthread functions without libpthread
144 # being listed in the .pc file).
145 DEPENDS_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' gmock', '', d)}"
146 LDFLAGS_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' -lpthread', '', d)}"
147 SRC_URI_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' file://run-ptest', '', d)}"
148 PACKAGECONFIG[tests] = "-DBUILD_TESTS:BOOL=ON,-DBUILD_TESTS:BOOL=OFF,gmock gtest,"
150 # Will be empty if no tests were built.
152 FILES_${PN}-ptest += "${bindir}/cynara-tests ${bindir}/cynara-db-migration-tests ${datadir}/cynara/tests"
153 do_install_ptest () {
154 if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then
155 mkdir -p ${D}/${datadir}/cynara/tests
156 cp -r ${S}/test/db/* ${D}/${datadir}/cynara/tests