From 6c5d9ef0dbb3e5ae9259536aaa0f16df352a147b Mon Sep 17 00:00:00 2001 From: Peter Marko Date: Fri, 5 Sep 2025 00:11:37 +0200 Subject: [PATCH] poco: enable postgresql support This was added in recent poco versions and this recipe seems to have configs for all features. Signed-off-by: Peter Marko Signed-off-by: Khem Raj --- meta-oe/recipes-support/poco/poco/run-ptest | 21 +++++++++++++++++++++ meta-oe/recipes-support/poco/poco_1.13.3.bb | 16 +++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/meta-oe/recipes-support/poco/poco/run-ptest b/meta-oe/recipes-support/poco/poco/run-ptest index 95fd988e48..5721ca39e4 100644 --- a/meta-oe/recipes-support/poco/poco/run-ptest +++ b/meta-oe/recipes-support/poco/poco/run-ptest @@ -7,6 +7,25 @@ if ! nslookup secure.appinf.com >/dev/null 2>&1; then echo 'nameserver 8.8.8.8' > /etc/resolv.conf fi +setup_test() { + case "$1" in + "DataPostgreSQL-testrunner") + if [ "$2" = "start" ]; then + # init database + postgresql-setup initdb + # do not require authentication for tests + mv /var/lib/postgresql/data/pg_hba.conf /var/lib/postgresql/data/pg_hba.conf.backup + sed s:ident$:trust: /var/lib/postgresql/data/pg_hba.conf.backup > /var/lib/postgresql/data/pg_hba.conf + # start as in combination of posgresql.service and posgresql.init + su -l postgres -c 'pg_ctl start -D /var/lib/postgresql/data -s -o "-p 5432" -w -t 300' + else + su -l postgres -c 'pg_ctl stop -D /var/lib/postgresql/data -s -m fast' + mv /var/lib/postgresql/data/pg_hba.conf.backup /var/lib/postgresql/data/pg_hba.conf + fi + ;; + esac +} + export POCO_BASE=/usr/lib/poco/ptest export LD_LIBRARY_PATH=${POCO_BASE}/bin:${LD_LIBRARY_PATH} i=0 @@ -14,7 +33,9 @@ while read runner; do oldpath=`pwd` >/dev/null cd bin echo Testing $runner + setup_test $runner start ./$runner -ignore $oldpath/cppignore.lnx -all + setup_test $runner stop export res$((i++))=$? cd $oldpath >/dev/null done < testrunners diff --git a/meta-oe/recipes-support/poco/poco_1.13.3.bb b/meta-oe/recipes-support/poco/poco_1.13.3.bb index 6d93ca4b08..c57c207f82 100644 --- a/meta-oe/recipes-support/poco/poco_1.13.3.bb +++ b/meta-oe/recipes-support/poco/poco_1.13.3.bb @@ -24,7 +24,7 @@ inherit cmake ptest # By default the most commonly used poco components are built # Foundation is built anyway and doesn't need to be listed explicitly # these don't have dependencies outside oe-core -PACKAGECONFIG ??= "XML JSON PDF Util Net NetSSL Crypto JWT Data DataSQLite Zip Encodings Prometheus" +PACKAGECONFIG ??= "XML JSON PDF Util Net NetSSL Crypto JWT Data DataPostgreSQL DataSQLite Zip Encodings Prometheus" # MongoDB does not build for all architectures yet keep in sync with COMPATIBLE_HOST list in mongodb recipe # and mongodb needs meta-python enabled as well PACKAGECONFIG:remove:riscv32 = "MongoDB" @@ -32,7 +32,7 @@ PACKAGECONFIG:remove:riscv64 = "MongoDB" PACKAGECONFIG:remove:mipsarch = "MongoDB" PACKAGECONFIG:remove:powerpc = "MongoDB" # Following options have dependencies on recipes which don't have native variant -PACKAGECONFIG:remove:class-native = "MongoDB DataODBC" +PACKAGECONFIG:remove:class-native = "MongoDB DataODBC DataPostgreSQL" PACKAGECONFIG[XML] = "-DENABLE_XML=ON,-DENABLE_XML=OFF,expat" PACKAGECONFIG[JSON] = "-DENABLE_JSON=ON,-DENABLE_JSON=OFF" @@ -43,6 +43,7 @@ PACKAGECONFIG[NetSSL] = "-DENABLE_NETSSL=ON,-DENABLE_NETSSL=OFF,openssl" PACKAGECONFIG[Crypto] = "-DENABLE_CRYPTO=ON,-DENABLE_CRYPTO=OFF,openssl" PACKAGECONFIG[JWT] = "-DENABLE_JWT=ON,-DENABLE_JWT=OFF,openssl" PACKAGECONFIG[Data] = "-DENABLE_DATA=ON,-DENABLE_DATA=OFF" +PACKAGECONFIG[DataPostgreSQL] = "-DENABLE_DATA_POSTGRESQL=ON,-DENABLE_DATA_POSTGRESQL=OFF,postgresql,postgresql" PACKAGECONFIG[DataSQLite] = "-DENABLE_DATA_SQLITE=ON,-DENABLE_DATA_SQLITE=OFF,sqlite3" PACKAGECONFIG[Zip] = "-DENABLE_ZIP=ON,-DENABLE_ZIP=OFF" PACKAGECONFIG[Encodings] = "-DENABLE_ENCODINGS=ON,-DENABLE_ENCODINGS=OFF" @@ -94,6 +95,9 @@ python populate_packages:prepend () { do_install_ptest () { cp -rf ${B}/bin/ ${D}${PTEST_PATH} cp -f ${B}/lib/libCppUnit.so* ${D}${libdir} + if ${@bb.utils.contains('PACKAGECONFIG', 'DataPostgreSQL', 'true', 'false', d)}; then + cp -f ${B}/lib/libPocoDataTest.so* ${D}${libdir} + fi cp -rf ${B}/*/testsuite/data ${D}${PTEST_PATH}/bin/ find "${D}${PTEST_PATH}" -executable -exec chrpath -d {} \; rm -f ${D}${PTEST_PATH}/testrunners @@ -108,12 +112,14 @@ PACKAGES_DYNAMIC = "poco-.*" # "poco" is a metapackage which pulls in all Poco components ALLOW_EMPTY:${PN} = "1" -# cppunit is only built if tests are enabled -PACKAGES =+ "${PN}-cppunit" +# cppunit and datatest is only built if tests are enabled +PACKAGES =+ "${PN}-cppunit ${PN}-datatest" FILES:${PN}-cppunit += "${libdir}/libCppUnit.so*" ALLOW_EMPTY:${PN}-cppunit = "1" +FILES:${PN}-datatest += "${libdir}/libPocoDataTest.so*" +ALLOW_EMPTY:${PN}-datatest = "1" -RDEPENDS:${PN}-ptest += "${PN}-cppunit" +RDEPENDS:${PN}-ptest += "${PN}-cppunit ${PN}-datatest" RDEPENDS:${PN}-ptest += "${@bb.utils.contains('PACKAGECONFIG', 'MongoDB', 'mongodb', '', d)}" RDEPENDS:${PN}-ptest += "${@bb.utils.contains('PACKAGECONFIG', 'Redis', 'redis', '', d)}"