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