# Generated by go2rpm 1.11.0 %bcond_without check %global debug_package %{nil} # https://github.com/jackc/pgx %global goipath github.com/jackc/pgx/v5 Version: 5.5.5 %gometa -L -f %global common_description %{expand: PostgreSQL driver and toolkit for Go.} %global golicenses LICENSE %global godocs examples README.md CHANGELOG.md CONTRIBUTING.md\\\ pgproto3/README.md pgconn/README.md Name: golang-github-jackc-pgx5 Release: %autorelease Summary: PostgreSQL driver and toolkit for Go License: MIT URL: %{gourl} Source: %{gosource} BuildRequires: postgresql-server BuildRequires: postgresql-contrib %description %{common_description} %gopkg %prep %goprep -A %autopatch -p1 %generate_buildrequires %go_generate_buildrequires %build %gobuild -o %{gobuilddir}/bin/generate_certs %{goipath}/testsetup %install %gopkginstall %if %{with check} %check set -o pipefail DATA_DIR=$(pwd)/.testdb/data/ CERT_DIR=$(pwd)/.testdb/ # Postgres environment export PGHOST=127.0.0.1 export PGPORT=5015 export PGUSER=postgres export PGDATABASE=pgx_test # Initialize Postgres initdb --locale=C --encoding=UTF-8 --lc-messages=C --username=postgres --pgdata="$DATA_DIR" cp testsetup/pg_hba.conf "$DATA_DIR/pg_hba.conf" # SSL setup cat testsetup/postgresql_ssl.conf >> "$DATA_DIR/postgresql.conf" pushd "$CERT_DIR" || exit %{gobuilddir}/bin/generate_certs cp ca.pem "$DATA_DIR/root.crt" cp localhost.key "$DATA_DIR/server.key" chmod 600 "$DATA_DIR/server.key" cp localhost.crt "$DATA_DIR/server.crt" popd || exit # Start Postgres pg_ctl start -D "$DATA_DIR" -o '-k /tmp -c logging_collector=off' # Prepare database for tests createdb -h /tmp psql -h /tmp --no-psqlrc -f testsetup/postgresql_setup.sql # Run tests export PGX_TEST_DATABASE="user=pgx_md5 password=secret" export PGX_TEST_TCP_CONN_STRING="user=pgx_md5 password=secret" export PGX_TEST_MD5_PASSWORD_CONN_STRING="user=pgx_md5 password=secret" export PGX_TEST_SCRAM_PASSWORD_CONN_STRING="user=pgx_scram password=secret" export PGX_TEST_PLAIN_PASSWORD_CONN_STRING="user=pgx_pw password=secret" export PGX_TEST_UNIX_SOCKET_CONN_STRING="host=/tmp" export PGX_SSL_PASSWORD=certpw export PGX_TEST_TLS_CONN_STRING="user=pgx_ssl password=secret sslmode=verify-full sslrootcert='$CERT_DIR/ca.pem'" export PGX_TEST_TLS_CLIENT_CONN_STRING="user=pgx_sslcert sslmode=verify-full sslrootcert='$CERT_DIR/ca.pem' sslcert='$CERT_DIR/pgx_sslcert.crt' sslkey='$CERT_DIR/pgx_sslcert.key'" %global gotestflags %{gotestflags} -v %gocheck | tee check.stdout # Guard against silently skipping tests requiring new environment variables ! cat check.stdout | (grep "Skipping due to missing environment variable " || true) | grep -vE "PGX_TEST_CRATEDB_CONN_STRING|PGX_TEST_PGBOUNCER_CONN_STRING" %endif %gopkgfiles %changelog %autochangelog