You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-10-23 21:28:56 +03:00
Support building on illumos.
The illumos headers hide POSIX and extension functions when compiling with -std=c11 unless a feature test macro is defined, which left kill(), sigaction(), gmtime_r(), localtime_r(), nanosleep(), and flock() undeclared. Define _POSIX_C_SOURCE=200809L and __EXTENSIONS__ in meson when the host system is sunos, as is done for Linux and MacOS. _POSIX_C_SOURCE alone does not expose flock(). Also link libsocket, which is separate from libc on illumos. Meson reports sunos for Solaris as well, but Solaris has not been tested. Add an OmniOS job to CI that runs selected unit tests and the smoke test against the oldest and newest available PostgreSQL versions.
This commit is contained in:
80
.github/workflows/test-illumos.yml
vendored
Normal file
80
.github/workflows/test-illumos.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# Selected unit tests and the smoke test on illumos. OmniOS runs in a VM hosted on a Linux runner.
|
||||
name: illumos
|
||||
|
||||
on: workflow_call
|
||||
|
||||
# Limit permissions on the repository
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Selected unit tests and the smoke test on OmniOS
|
||||
omnios:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Start VM
|
||||
uses: cross-platform-actions/action@v1.3.0
|
||||
with:
|
||||
operating_system: omnios
|
||||
version: r151058
|
||||
|
||||
# The custom shell runs the commands in the VM started above. Do not set this as a job default since the checkout step must
|
||||
# run on the host.
|
||||
- name: Install
|
||||
shell: cpa.sh {0}
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg refresh
|
||||
|
||||
# The PostgreSQL versions supported by pgBackRest, oldest first, read from the generated header so the list never needs to
|
||||
# be updated here. OmniOS leaves the dot out of the package name, e.g. 9.6 is postgresql-96.
|
||||
pgSupport=$(sed -n 's/^#define PG_VERSION_[0-9_]*_Z *"\([0-9.]*\)".*/\1/p' \
|
||||
${GITHUB_WORKSPACE?}/src/postgres/version.auto.h | tr -d . | sed 's/^/ooce\/database\/postgresql-/')
|
||||
|
||||
# The versions that are both supported and available. The order comes from the supported list since these do not sort
|
||||
# naturally, e.g. postgresql-96 is not greater than postgresql-10.
|
||||
pgAvail=$(echo "${pgSupport}" | grep -xF "$(pkg list -aH 'ooce/database/postgresql-*' | awk '{print $1}')")
|
||||
echo "postgresql available: $(echo ${pgAvail})"
|
||||
|
||||
# Each PostgreSQL version installs into its own prefix, so the oldest and newest are installed together
|
||||
pgOldest=$(echo "${pgAvail}" | head -1)
|
||||
pgNewest=$(echo "${pgAvail}" | tail -1)
|
||||
|
||||
# pkg exits with 4 when everything is already installed
|
||||
sudo pkg install developer/build-essential developer/pkg-config developer/versioning/git library/python-3/meson-313 \
|
||||
library/python-3/pyyaml-313 ooce/developer/ninja library/libxml2 library/zlib library/security/openssl-3 \
|
||||
compress/bzip2 compress/lz4 compress/zstd ${pgOldest} ${pgNewest} || test $? -eq 4
|
||||
|
||||
# meson and ninja are not in the default path. /usr/bin/pkg-config is 32-bit and searches the 32-bit libraries, so the
|
||||
# 64-bit pkgconfig directories are set explicitly, including the one for the libpq of the newest PostgreSQL.
|
||||
echo "export PATH=/usr/lib/python3.13/bin:/opt/ooce/bin:${PATH?}" > ${HOME?}/omnios.env
|
||||
echo "export PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig:/opt/ooce/pgsql-${pgNewest##*-}/lib/amd64/pkgconfig" \
|
||||
>> ${HOME?}/omnios.env
|
||||
|
||||
. ${HOME?}/omnios.env
|
||||
gcc --version | head -1
|
||||
meson --version
|
||||
ninja --version
|
||||
pkg-config --modversion libpq libxml-2.0 openssl zlib liblz4 libzstd
|
||||
python3 -c 'import sys, yaml; print("python %s, PyYAML %s" % (sys.version.split()[0], yaml.__version__))'
|
||||
|
||||
- name: Run Test
|
||||
shell: cpa.sh {0}
|
||||
run: |
|
||||
. ${HOME?}/omnios.env
|
||||
cd .. && ${GITHUB_WORKSPACE?}/test/test.py --vm-max=2 --no-coverage --no-valgrind --module=command/backup \
|
||||
--module=command/info --module=command/archive/push
|
||||
|
||||
# The integration tests cannot run here because there are no containers, but the smoke test drives a backup/restore cycle
|
||||
# against each PostgreSQL installed above, which covers the basics
|
||||
- name: Run Smoke Test
|
||||
shell: cpa.sh {0}
|
||||
run: |
|
||||
. ${HOME?}/omnios.env
|
||||
cd ..
|
||||
meson setup build ${GITHUB_WORKSPACE?}
|
||||
ninja -C build src/pgbackrest
|
||||
meson test -C build --suite smoke -v
|
||||
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -49,6 +49,9 @@ jobs:
|
||||
bsd:
|
||||
uses: ./.github/workflows/test-bsd.yml
|
||||
|
||||
illumos:
|
||||
uses: ./.github/workflows/test-illumos.yml
|
||||
|
||||
compile:
|
||||
uses: ./.github/workflows/test-compile.yml
|
||||
|
||||
|
||||
@@ -106,6 +106,18 @@
|
||||
|
||||
<p>Add context to block map read errors during backup.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<github-pull-request id="2870"/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="kalevi.kolttonen"/>
|
||||
<release-item-reviewer id="douglas.j.hunley"/>
|
||||
<release-item-reviewer id="david.steele"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Support building on <proper>illumos</proper>.</p>
|
||||
</release-item>
|
||||
</release-improvement-list>
|
||||
|
||||
<release-development-list>
|
||||
|
||||
@@ -760,6 +760,11 @@
|
||||
<contributor-id type="github">ImTheKai</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="kalevi.kolttonen">
|
||||
<contributor-name-display>Kalevi Kolttonen</contributor-name-display>
|
||||
<contributor-id type="github">retrodood</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="krmozejko">
|
||||
<contributor-name-display>krmozejko</contributor-name-display>
|
||||
<contributor-id type="github">krmozejko</contributor-id>
|
||||
|
||||
@@ -50,6 +50,8 @@ if host_machine.system() == 'linux'
|
||||
add_global_arguments('-D_POSIX_C_SOURCE=200809L', language: 'c')
|
||||
elif host_machine.system() == 'darwin'
|
||||
add_global_arguments('-D_DARWIN_C_SOURCE', language: 'c')
|
||||
elif host_machine.system() == 'sunos'
|
||||
add_global_arguments('-D_POSIX_C_SOURCE=200809L', '-D__EXTENSIONS__', language: 'c')
|
||||
endif
|
||||
|
||||
####################################################################################################################################
|
||||
@@ -223,6 +225,13 @@ lib_z = dependency('zlib')
|
||||
|
||||
configuration.set('ZLIB_CONST', true, description: 'Require zlib const input buffer')
|
||||
|
||||
# Find socket library on illumos/Solaris, where sockets are not in libc
|
||||
lib_socket = dependency('', required: false)
|
||||
|
||||
if host_machine.system() == 'sunos'
|
||||
lib_socket = cc.find_library('socket')
|
||||
endif
|
||||
|
||||
# Find optional systemd library
|
||||
lib_systemd = dependency('libsystemd', required: get_option('libsystemd'))
|
||||
|
||||
|
||||
@@ -260,6 +260,7 @@ pgbackrest_exe = executable(
|
||||
lib_lz4,
|
||||
lib_systemd,
|
||||
lib_pq,
|
||||
lib_socket,
|
||||
lib_ssh2,
|
||||
lib_xml,
|
||||
lib_z,
|
||||
|
||||
@@ -359,6 +359,7 @@ class TestBuild:
|
||||
+ " lib_openssl,\n"
|
||||
+ " lib_lz4,\n"
|
||||
+ " lib_pq,\n"
|
||||
+ " lib_socket,\n"
|
||||
+ " lib_ssh2,\n"
|
||||
+ " lib_xml,\n"
|
||||
+ " lib_z,\n"
|
||||
|
||||
@@ -143,7 +143,7 @@ def pg_bin_candidates(extra_dirs):
|
||||
"""Candidate bin directories to search for a PostgreSQL installation.
|
||||
|
||||
This is a superset of the list in test/src/harness/host.c since the smoke test also runs where the integration tests
|
||||
cannot, i.e. MacOS and FreeBSD."""
|
||||
cannot, i.e. MacOS, FreeBSD, and OmniOS."""
|
||||
|
||||
candidates = []
|
||||
candidates += sorted(glob.glob("/usr/lib/postgresql/*/bin")) # Debian
|
||||
@@ -152,6 +152,7 @@ def pg_bin_candidates(extra_dirs):
|
||||
candidates += sorted(glob.glob("/opt/homebrew/opt/postgresql@*/bin")) # MacOS (Homebrew on ARM)
|
||||
candidates += sorted(glob.glob("/usr/local/opt/postgresql@*/bin")) # MacOS (Homebrew on Intel)
|
||||
candidates += ["/usr/local/bin"] # FreeBSD
|
||||
candidates += sorted(glob.glob("/opt/ooce/pgsql-*/bin")) # OmniOS
|
||||
candidates += ["/usr/bin"] # Native (e.g. RHEL application stream)
|
||||
candidates += list(extra_dirs)
|
||||
|
||||
|
||||
@@ -287,6 +287,7 @@ MESON_LIB = (
|
||||
" lib_openssl,\n"
|
||||
" lib_lz4,\n"
|
||||
" lib_pq,\n"
|
||||
" lib_socket,\n"
|
||||
" lib_ssh2,\n"
|
||||
" lib_xml,\n"
|
||||
" lib_z,\n"
|
||||
|
||||
Reference in New Issue
Block a user