added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
From 8f3ed8df4721991958a5becf75a69493d67e7514 Mon Sep 17 00:00:00 2001
From: "Roy.Li" <rongqing.li@windriver.com>
Date: Tue, 5 Sep 2017 10:24:10 +0800
Subject: [PATCH] [PATCH] do not use the hardcode libdir
Upstream-Status: Pending
Signed-off-by: Roy.Li <rongqing.li@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 00b359e..ba50e6f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,7 +114,7 @@ if test "$with_libpq" != yes; then
if test -d "$with_libpq"; then
PATH="$with_libpq/bin:$PATH"
CPPFLAGS="$CPPFLAGS -I$with_libpq/include -I$with_libpq/include/postgresql/internal"
- LDFLAGS="$LDFLAGS -L$with_libpq/lib"
+ LDFLAGS="$LDFLAGS -L$with_libpq/${base_libdir}"
else
if test -x "$with_libpq"; then
PG_CONFIG=$with_libpq

View File

@@ -0,0 +1,129 @@
From 96896b88776d0080609ec830cf9538d2babe665a Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Tue, 5 Sep 2017 10:24:10 +0800
Subject: [PATCH] psqlodbc: fixes for ptest support
* Fix the LIBODBC since we don't use ODBC_CONFIG.
* Fix the path for driver.
* Add the default info of postgresql server.
* Fix the output format for ptest.
* Fix the results and exe dir.
Upstream-Status: Inappropriate [OE ptest specific]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
test/Makefile.in | 2 +-
test/odbcini-gen.sh | 8 ++++----
test/runsuite.c | 20 ++++++++++----------
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 3f9a9af..09406ae 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -19,7 +19,7 @@ CPPFLAGS = @CPPFLAGS@ -I.. # config.h
ODBC_CONFIG = @ODBC_CONFIG@
PROVE = @PROVE@
-LIBODBC = @LIBODBC@
+LIBODBC = -lodbc
all: $(TESTBINS) runsuite reset-db
diff --git a/test/odbcini-gen.sh b/test/odbcini-gen.sh
index 2eaba35..6555cdb 100755
--- a/test/odbcini-gen.sh
+++ b/test/odbcini-gen.sh
@@ -6,7 +6,7 @@
outini=odbc.ini
outinstini=odbcinst.ini
-drvr=../.libs/psqlodbcw
+drvr=@LIBDIR@/psqlodbca
driver=${drvr}.so
if test ! -e $driver ; then
driver=${drvr}.dll
@@ -52,10 +52,10 @@ Driver = PostgreSQL Unicode
Trace = No
TraceFile =
Database = contrib_regression
-Servername =
-Username =
+Servername = localhost
+Username = postgres
Password =
-Port =
+Port = 5432
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
diff --git a/test/runsuite.c b/test/runsuite.c
index 3be5732..cd842dc 100644
--- a/test/runsuite.c
+++ b/test/runsuite.c
@@ -55,7 +55,7 @@ bailout(const char *fmt, ...)
/* Given a test program's name, get the test name */
void
-parse_argument(const char *in, char *testname, char *binname)
+parse_argument(const char *in, char *testname, char *binname, const char *inputdir)
{
const char *basename;
#ifdef WIN32
@@ -69,7 +69,7 @@ parse_argument(const char *in, char *testname, char *binname)
if (strchr(in, DIR_SEP) == NULL)
{
strcpy(testname, in);
- sprintf(binname, "exe%c%s-test", DIR_SEP, in);
+ sprintf(binname, "%s%cexe%c%s-test", inputdir, DIR_SEP, DIR_SEP, in);
return;
}
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
failures = 0;
for (i = 1, j = 1; i <= numtests; i++, j++)
{
- parse_argument(argv[j], testname, binname);
+ parse_argument(argv[j], testname, binname, inputdir);
if (runtest(binname, testname, i, inputdir) != 0)
failures++;
}
@@ -161,29 +161,29 @@ runtest(const char *binname, const char *testname, int testno, const char *input
#ifndef WIN32
snprintf(cmdline, sizeof(cmdline),
"ODBCSYSINI=. ODBCINSTINI=./odbcinst.ini ODBCINI=./odbc.ini "
- "%s > results/%s.out",
- binname, testname);
+ "%s > %s/results/%s.out",
+ binname, inputdir, testname);
#else
snprintf(cmdline, sizeof(cmdline),
- "%s > results\\%s.out",
- binname, testname);
+ "%s > %s/results\\%s.out",
+ binname, inputdir, testname);
#endif
rc = system(cmdline);
diff = rundiff(testname, inputdir);
if (rc != 0)
{
- printf("not ok %d - %s test returned %d\n", testno, testname, rc);
+ printf("FAIL: %d - %s\n\ttest returned %d\n", testno, testname, rc);
ret = 1;
}
else if (diff != 0)
{
- printf("not ok %d - %s test output differs\n", testno, testname);
+ printf("FAIL: %d - %s\n\ttest output differs\n", testno, testname);
ret = 1;
}
else
{
- printf("ok %d - %s\n", testno, testname);
+ printf("PASS: %d - %s\n", testno, testname);
ret = 0;
}
fflush(stdout);

View File

@@ -0,0 +1,134 @@
From 8ca6b0c72b6b933642ec7c4ebb83734244fec46f Mon Sep 17 00:00:00 2001
From: "Song.Li" <Song.Li@windriver.com>
Date: Tue, 5 Sep 2017 10:24:10 +0800
Subject: [PATCH] remove some checks for cross-compiling
some lib check is not suitable for
cross-compiling, so remove them.
Upstream-Status: Inappropriate [not a real bug,just for cross-compiling]
Signed-off-by: Song.Li <Song.Li@windriver.com>
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
configure.ac | 80 +++++-----------------------------------------------
1 file changed, 7 insertions(+), 73 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7f79563..00b359e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,71 +57,20 @@ AC_ARG_WITH(iodbc, [ --with-iodbc[[=DIR]] [[default=no]] DIR is the iODBC bas
if test "$with_iodbc" != no; then
with_unixodbc=no
AC_DEFINE(WITH_IODBC, 1, [Define to 1 to build with iODBC support])
- if test "$with_iodbc" = yes; then
- AC_PATH_PROGS(ODBC_CONFIG, iodbc-config)
- else
- ODBC_CONFIG=$with_iodbc
- fi
- if test ! -x "${ODBC_CONFIG}/bin/iodbc-config"; then
- if test ! -x "${ODBC_CONFIG}"; then
- AC_MSG_ERROR([iodbc-config not found (required for iODBC build)])
- fi
- else
- ODBC_CONFIG=${ODBC_CONFIG}/bin/iodbc-config
- fi
fi
wo_odbc_config=__without_odbc_config
if test "$with_unixodbc" != no; then
AC_DEFINE(WITH_UNIXODBC, 1,
[Define to 1 to build with unixODBC support])
- if test "$with_unixodbc" = yes; then
- AC_PATH_PROGS(ODBC_CONFIG, odbc_config)
- else
- ODBC_CONFIG=$with_unixodbc
- fi
- if test "${ODBC_CONFIG}" = "${wo_odbc_config}"; then
- :
- elif test ! -x "${ODBC_CONFIG}/bin/odbc_config"; then
- if test ! -x "${ODBC_CONFIG}"; then
- AC_MSG_ERROR([odbc_config not found (required for unixODBC build)])
- fi
- else
- ODBC_CONFIG=${ODBC_CONFIG}/bin/odbc_config
- fi
fi
#
# ODBC include and library
#
-
-if test "$ODBC_CONFIG" != ""; then
- if test "$with_iodbc" != no; then
- ODBC_INCLUDE=`${ODBC_CONFIG} --cflags`
- CPPFLAGS="$CPPFLAGS ${ODBC_INCLUDE}"
- # Linking libiodoc is rather problematic
- [ODBC_LIBDIR=`${ODBC_CONFIG} --libs | sed -e "s/^\(-L\|.*[ \t]-L\)\([^ \n\r\f\t]*\).*$/-L\2/"`]
- LDFLAGS="$LDFLAGS ${ODBC_LIBDIR}"
- LIBODBC=`${ODBC_CONFIG} --libs` # for regression test
- elif test "${ODBC_CONFIG}" = "${wo_odbc_config}"; then
- ODBC_INCLUDE=/usr/include
- CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
- ODBC_LIBDiR=""
- LIBODBC="-lodbc" # for regression test
- else
- ODBC_INCLUDE=`${ODBC_CONFIG} --include-prefix`
- CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
- # Linking libodbc is rather problematic
- ODBC_LIBDIR=`${ODBC_CONFIG} --lib-prefix`
- if test "${ODBC_LIBDIR}" != ""; then
- LDFLAGS="$LDFLAGS -L${ODBC_LIBDIR}"
- fi
- LIBODBC=`${ODBC_CONFIG} --libs` # for regression test
- fi
- AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBDIR])
- AC_MSG_NOTICE([using $LIBODBC for regression test])
-fi
-AC_SUBST(LIBODBC)
+ODBC_LIBS="-lodbcinst"
+LIBS="$LIBS ${ODBC_LIBS}"
+AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBS])
#
# SQLCOLATTRIBUTE_SQLLEN check
@@ -190,19 +139,10 @@ PGAC_ARG_BOOL(enable, pthreads, yes,
# Find libpq headers and libraries
#
-if test -z "$PG_CONFIG"; then
- AC_PATH_PROGS(PG_CONFIG, pg_config)
-fi
-
-if test -n "$PG_CONFIG"; then
- pg_includedir=`"$PG_CONFIG" --includedir`
- pg_pkg_includedir=`"$PG_CONFIG" --pkgincludedir`
- pg_libdir=`"$PG_CONFIG" --libdir`
- CPPFLAGS="$CPPFLAGS -I$pg_includedir -I$pg_pkg_includedir/internal"
- LDFLAGS="$LDFLAGS -L$pg_libdir"
-fi
-
-
+pg_includedir=""
+pg_libdir=""
+CPPFLAGS="$CPPFLAGS"
+LDFLAGS="$LDFLAGS"
# 1. Programs
@@ -226,12 +166,6 @@ if test "$with_iodbc" != no; then
[AC_MSG_ERROR([iODBC library "iodbcinst" not found])])
fi
-if test "$enable_pthreads" = yes; then
- AC_CHECK_LIB(pthreads, pthread_create,
- [],
- [AC_CHECK_LIB(pthread, pthread_create)])
-fi
-
AC_CHECK_LIB(pq, PQsetSingleRowMode, [],
[AC_MSG_ERROR([libpq library version >= 9.2 is required])])

View File

@@ -0,0 +1,46 @@
#!/bin/sh
BASEDIR="$(dirname $(readlink -f $0))"
# init and start postgresql server for testing
PGDATA="/var/lib/postgresql/data"
if [ -f "${PGDATA}/PG_VERSION" ]; then
echo "Data directory is not empty! Skip initdb."
else
echo "Initializing database: "
chown -R postgres:postgres ${PGDATA}
su -l postgres -c "/usr/bin/initdb --pgdata='$PGDATA'"
fi
SYSV_INIT="/etc/init.d/postgresql-server"
if [ -e ${SYSV_INIT} ]; then
RESTART_POSTGRESQL="${SYSV_INIT} restart"
STOP_POSTGRESQL="${SYSV_INIT} stop"
else
RESTART_POSTGRESQL="systemctl restart postgresql"
STOP_POSTGRESQL="systemctl stop postgresql"
fi
${RESTART_POSTGRESQL} || echo "Failed to restart postgresql, skip the tests."
if [ ! -d ${BASEDIR}/results ]; then
mkdir ${BASEDIR}/results
fi
# Generate odbc config files and reset db
${BASEDIR}/odbcini-gen.sh || echo "FAIL: Generate odbc config files"
ODBCSYSINI=. ODBCINSTINI=./odbcinst.ini ODBCINI=./odbc.ini \
${BASEDIR}/reset-db < ${BASEDIR}/sampletables.sql \
|| echo "FAIL: reset db with sample tables"
# Run the actual tests
TESTS=
for i in `ls ${BASEDIR}/exe/*-test`; do
TESTS="$TESTS $(basename ${i%-test})"
done
${BASEDIR}/runsuite ${TESTS} --inputdir=${BASEDIR}
# Cleanup
${STOP_POSTGRESQL}
rm -f regression.diffs odbcinst.ini odbc.ini

View File

@@ -0,0 +1,62 @@
SUMMARY = "ODBC driver for PostgreSQL"
DESCRIPTION = "\
This package provides a driver that allows ODBC-enabled applications to \
access PostgreSQL databases. ODBC is an abstraction layer that allows \
applications written for that layer to access databases in a manner \
that is relatively independent of the particular database management \
system. \
. \
You need to install this package if you want to use an application that \
provides database access through ODBC and you want that application to \
access a PostgreSQL database. This package would need to be installed \
on the same machine as that client application; the PostgreSQL database \
server can be on a different machine and does not need any additional \
software to accept ODBC clients. \
"
SECTION = "libs"
HOMEPAGE = "https://odbc.postgresql.org/"
LICENSE = "LGPL-2.0-only"
LIC_FILES_CHKSUM = "file://license.txt;md5=6db3822fc7512e83087ba798da013692"
SRC_URI = "http://ftp.postgresql.org/pub/odbc/versions/src/${BPN}-${PV}.tar.gz \
file://psqlodbc-remove-some-checks-for-cross-compiling.patch \
file://psqlodbc-donot-use-the-hardcode-libdir.patch \
file://psqlodbc-fix-for-ptest-support.patch \
file://run-ptest \
"
SRC_URI[sha256sum] = "b39b7e5c41fd6475c551112fa724bf57c4a446175ec4188a90e2844cc1612585"
DEPENDS += "postgresql unixodbc"
EXTRA_OECONF = "\
ac_cv_lib_ltdl_lt_dlopen=no \
ac_cv_lib_pq_PQconnectdb=yes \
--with-unixodbc=yes \
--with-libpq=${STAGING_LIBDIR}/.. \
--enable-pthreads \
LIBS='-lpthread' \
"
inherit autotools pkgconfig ptest
do_compile_ptest() {
oe_runmake -C ${B}/test
}
do_install_ptest() {
install -d ${D}${PTEST_PATH}
cp -a --no-preserve=ownership ${B}/test/exe ${S}/test/expected ${D}${PTEST_PATH}
install -m 0755 ${B}/test/reset-db ${D}${PTEST_PATH}
install -m 0755 ${B}/test/runsuite ${D}${PTEST_PATH}
install -m 0755 ${S}/test/odbcini-gen.sh ${D}${PTEST_PATH}
install -m 0755 ${S}/test/sampletables.sql ${D}${PTEST_PATH}
sed -i -e 's|@LIBDIR@|${libdir}|' ${D}${PTEST_PATH}/odbcini-gen.sh
}
FILES:${PN} += "${libdir}"
# The tests need a local PostgreSQL server running
RDEPENDS:${PN}-ptest = "postgresql"