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 \
26 # Use debug mode to increase logging. Beware, also compiles with less optimization
27 # and thus has to disable FORTIFY_SOURCE below.
28 PACKAGECONFIG[debug] = "-DCMAKE_BUILD_TYPE=DEBUG,-DCMAKE_BUILD_TYPE=RELEASE,libunwind elfutils"
33 -DCMAKE_VERBOSE_MAKEFILE=ON \
34 -DBUILD_WITH_SYSTEMD_DAEMON=ON \
35 -DBUILD_WITH_SYSTEMD_JOURNAL=ON \
36 -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir} \
37 -DSOCKET_DIR=/run/cynara \
41 -DCYNARA_ADMIN_SOCKET_GROUP=cynara \
44 # Explicitly package empty directory. Otherwise Cynara prints warnings
46 # cyad[198]: Couldn't scan for plugins in </usr/lib/cynara/plugin/service/> : <No such file or directory>
47 FILES_${PN}_append = " \
48 ${libdir}/cynara/plugin/service \
49 ${libdir}/cynara/plugin/client \
53 USERADD_PACKAGES = "${PN}"
54 GROUPADD_PARAM_${PN} = "-r cynara"
55 USERADD_PARAM_${PN} = "\
56 --system --home ${localstatedir}/lib/empty \
57 --no-create-home --shell /bin/false \
61 # Causes deadlock during booting, see workaround in postinst below.
63 #SYSTEMD_SERVICE_${PN} = "cynara.service"
65 #do_install_append () {
66 # chmod a+rx ${D}/${sbindir}/cynara-db-migration
68 # install -d ${D}${sysconfdir}/cynara/
69 # install -m 644 ${S}/conf/creds.conf ${D}/${sysconfdir}/cynara/creds.conf
71 # # No need to create empty directories except for those which
72 # # Cynara expects to find.
73 # # install -d ${D}${localstatedir}/cynara/
74 # # install -d ${D}${prefix}/share/cynara/tests/empty_db
75 # install -d ${D}${libdir}/cynara/plugin/client
76 # install -d ${D}${libdir}/cynara/plugin/service
78 # # install db* ${D}${prefix}/share/cynara/tests/
80 # install -d ${D}${systemd_system_unitdir}/sockets.target.wants
81 # ln -s ../cynara.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara.socket
82 # ln -s ../cynara-admin.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara-admin.socket
83 # ln -s ../cynara-agent.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara-agent.socket
86 # We want the post-install logic to create and label /var/cynara, so
87 # it should not be in the package.
88 do_install_append () {
89 rmdir ${D}${localstatedir}/cynara
92 FILES_${PN} += "${systemd_system_unitdir}"
94 # Cynara itself has no dependency on Smack. Only its installation
95 # is Smack-aware in the sense that it sets Smack labels. Do not
96 # depend on smack userspace unless we really need Smack labels.
98 # The Tizen .spec file calls cynara-db-migration in a %pre section.
99 # That only works when cynara-db-migration is packaged separately
100 # (overly complex) and does not seem necessary: perhaps there is a
101 # time window where cynara might already get activated before
102 # the postinst completes, but that is a general problem. It gets
103 # avoided entirely when calling this script while building the
105 DEPENDS_append_with-lsm-smack = " smack smack-native"
106 EXTRA_OECMAKE_append_with-lsm-smack = " -DDB_FILES_SMACK_LABEL=System"
107 CHSMACK_with-lsm-smack = "chsmack"
109 pkg_postinst_ontarget_${PN} () {
110 mkdir -p $D${sysconfdir}/cynara
111 ${CHSMACK} -a System $D${sysconfdir}/cynara
113 # Strip git patch level information, the version comparison code
114 # in cynara-db-migration only expect major.minor.patch version numbers.
115 VERSION=${@d.getVar('PV',d,1).split('+git')[0]}
116 if [ -d $D${localstatedir}/cynara ] ; then
118 echo "NOTE: updating cynara DB to version $VERSION"
119 $D${sbindir}/cynara-db-migration upgrade -f 0.0.0 -t $VERSION
122 echo "NOTE: creating cynara DB for version $VERSION"
123 mkdir -p $D${localstatedir}/cynara
124 ${CHSMACK} -a System $D${localstatedir}/cynara
125 $D${sbindir}/cynara-db-migration install -t $VERSION
128 # Workaround for systemd.bbclass issue: it would call
129 # "systemctl start" without "--no-block", but because
130 # the service is not ready to run at the time when
131 # this scripts gets executed by run-postinsts.service,
133 echo "NOTE: enabling and starting cynara service"
134 systemctl enable cynara
135 systemctl start --no-block cynara
138 # Testing depends on gmock and gtest. They can be found in meta-oe
139 # and are not necessarily available, so this feature is off by default.
140 # If gmock from meta-oe is used, then a workaround is needed to avoid
141 # a link error (libgmock.a calls pthread functions without libpthread
142 # being listed in the .pc file).
143 DEPENDS_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' gmock', '', d)}"
144 LDFLAGS_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' -lpthread', '', d)}"
145 SRC_URI_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' file://run-ptest', '', d)}"
146 PACKAGECONFIG[tests] = "-DBUILD_TESTS:BOOL=ON,-DBUILD_TESTS:BOOL=OFF,gmock gtest,"
148 # Will be empty if no tests were built.
150 FILES_${PN}-ptest += "${bindir}/cynara-tests ${bindir}/cynara-db-migration-tests ${datadir}/cynara/tests"
151 do_install_ptest () {
152 if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then
153 mkdir -p ${D}/${datadir}/cynara/tests
154 cp -r ${S}/test/db/* ${D}/${datadir}/cynara/tests