1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Dynamically find python in meson build.

This is better than requiring a python3 binary to be on the path because some installations might have, e.g. python3.9.

Also add the python3-distutils package to Debian builds to make this work.
This commit is contained in:
Michael Schout 2024-04-25 04:32:07 -05:00 committed by GitHub
parent 55e996912a
commit e00e33b528
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 41 additions and 22 deletions

View File

@ -103,7 +103,7 @@ jobs:
install: |
apt-get update
DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive apt-get install -y perl sudo libxml-checker-perl libyaml-perl rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config make gcc ccache meson git liblz4-dev liblz4-tool zstd libzstd-dev bzip2 libbz2-dev
DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive apt-get install -y perl sudo libxml-checker-perl libyaml-perl rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config make gcc ccache python3-distutils meson git liblz4-dev liblz4-tool zstd libzstd-dev bzip2 libbz2-dev
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE?}/pgbackrest

View File

@ -33,7 +33,7 @@ pgbackrest-dev => Install development tools
sudo apt-get install rsync git devscripts build-essential valgrind lcov autoconf \
autoconf-archive libssl-dev zlib1g-dev libxml2-dev libpq-dev pkg-config \
libxml-checker-perl libyaml-perl libdbd-pg-perl liblz4-dev liblz4-tool \
zstd libzstd-dev bzip2 libbz2-dev libyaml-dev ccache meson
zstd libzstd-dev bzip2 libbz2-dev libyaml-dev ccache python3-distutils meson
```
Some unit tests and all the integration tests require Docker. Running in containers allows us to simulate multiple hosts, test on different distributions and versions of PostgreSQL, and use sudo without affecting the host system.
@ -238,7 +238,7 @@ pgbackrest/test/test.pl --dry-run
P00 INFO: test begin on x86_64 - log level info
P00 INFO: clean autogenerate code
--> P00 INFO: 81 tests selected
P00 INFO: P1-T01/81 - vm=none, module=common, test=error
[filtered 78 lines of output]
P00 INFO: P1-T80/81 - vm=none, module=performance, test=type
@ -260,27 +260,27 @@ pgbackrest/test/test.pl --vm-out --module=common --test=wait
P00 INFO: autogenerate code
P00 INFO: build for none (/home/vagrant/test/build/none)
P00 INFO: 1 test selected
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
P00 INFO: test command begin 2.51: [common/wait] --log-level=info --no-log-timestamp --repo-path=/home/vagrant/test/repo --test-path=/home/vagrant/test --vm=none --vm-id=0
P00 INFO: test command end: completed successfully
run 1 - waitNew(), waitMore, and waitFree()
L0018 expect AssertError: assertion 'waitTime <= 999999000' failed
run 1/1 ----- L0021 0ms wait
L0025 new wait
L0026 check wait time
L0027 check sleep time
L0028 check sleep prev time
L0029 no wait more
run 1/2 ----- L0032 100ms with retries after time expired
L0034 new wait
L0037 time expired, first retry
L0038 time expired, second retry
L0039 time expired, retries expired
run 1/3 ----- L0042 200ms wait
L0046 new wait = 0.2 sec
L0047 check wait time
@ -295,7 +295,7 @@ pgbackrest/test/test.pl --vm-out --module=common --test=wait
L0064 lower range check
L0065 upper range check
L0067 free wait
run 1/4 ----- L0070 1100ms wait
L0074 new wait = 1.1 sec
L0075 check wait time
@ -305,9 +305,9 @@ pgbackrest/test/test.pl --vm-out --module=common --test=wait
L0084 lower range check
L0085 upper range check
L0087 free wait
TESTS COMPLETED SUCCESSFULLY
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
P00 INFO: tested modules have full coverage
P00 INFO: writing C coverage report
@ -330,7 +330,7 @@ pgbackrest/test/test.pl --module=postgres
P00 INFO: autogenerate code
P00 INFO: build for none (/home/vagrant/test/build/none)
P00 INFO: 2 tests selected
P00 INFO: P1-T1/2 - vm=none, module=postgres, test=client
P00 INFO: P1-T2/2 - vm=none, module=postgres, test=interface
P00 INFO: tested modules have full coverage
@ -369,7 +369,7 @@ pgbackrest/test/test.pl --vm=u20 --module=postgres --test=interface --run=2
P00 INFO: autogenerate code
P00 INFO: clean build for u20 (/home/vagrant/test/build/u20)
P00 INFO: 1 test selected
P00 INFO: P1-T1/1 - vm=u20, module=postgres, test=interface, run=2
P00 INFO: no code modules had all tests run required for coverage
P00 INFO: tested modules have full coverage

View File

@ -94,7 +94,7 @@
apt-get install rsync git devscripts build-essential valgrind lcov autoconf
autoconf-archive libssl-dev zlib1g-dev libxml2-dev libpq-dev pkg-config
libxml-checker-perl libyaml-perl libdbd-pg-perl liblz4-dev liblz4-tool
zstd libzstd-dev bzip2 libbz2-dev libyaml-dev ccache meson
zstd libzstd-dev bzip2 libbz2-dev libyaml-dev ccache python3-distutils meson
</exe-cmd>
<exe-cmd-extra>-y 2>&amp;1</exe-cmd-extra>
</execute>

View File

@ -42,6 +42,20 @@
<p>Allow explicit disabling of optional dependencies in meson builds.</p>
</release-item>
<release-item>
<commit subject="Update meson minimum version to 0.47."/>
<commit subject="Dynamically find python in meson build.">
<github-pull-request id="2338"/>
</commit>
<release-item-contributor-list>
<release-item-contributor id="michael.schout"/>
<release-item-reviewer id="david.steele"/>
</release-item-contributor-list>
<p>Dynamically find <proper>python</proper> in <proper>meson</proper> build.</p>
</release-item>
<release-item>
<github-pull-request id="2312"/>

View File

@ -1043,8 +1043,8 @@
<execute if="{[os-type-is-debian]}" user="root" pre="y">
<exe-cmd>
apt-get install meson gcc libpq-dev libssl-dev libxml2-dev pkg-config
liblz4-dev libzstd-dev libbz2-dev libz-dev libyaml-dev libssh2-1-dev
apt-get install python3-distutils meson gcc libpq-dev libssl-dev libxml2-dev
pkg-config liblz4-dev libzstd-dev libbz2-dev libz-dev libyaml-dev libssh2-1-dev
</exe-cmd>
<exe-cmd-extra>-y 2>&amp;1</exe-cmd-extra>
</execute>

View File

@ -114,9 +114,11 @@ endif
# reproducible builds and minimizes the file path in debug messages, just like an in-tree make build. For test source, prefix with
# test/ in case there are any module name collisions.
####################################################################################################################################
python = import('python').find_installation()
file_prefix = run_command(
[
'python3',
python,
'-c',
'import sys, os; print(os.path.relpath(sys.argv[1], sys.argv[2]))',
meson.current_source_dir(),

View File

@ -182,7 +182,7 @@ eval
{
# Build list of packages that need to be installed
my $strPackage =
"gcc ccache python3-pip git rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config uncrustify" .
"gcc ccache python3-distutils git rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config uncrustify" .
" libssh2-1-dev valgrind";
# Add lcov when testing coverage

View File

@ -12,10 +12,13 @@
# - docker login -u pgbackrest
# - VM=XXX;DATE=YYYYMMDDX;BASE=pgbackrest/test:${VM?}-base;docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?}
# **********************************************************************************************************************************
20240425A:
x86_64:
d10: fb03907abefd68fe16557b759e7e110e99eda748
u20: c3fc7cc1956c5eb10995119deed7a21b92dd07a7
u22: 11cead06a18450f45518b386181a4b7e8ffaf4c1
20240423A:
x86_64:
d10: e0f7a22cefb28f36d5c4f53b306ce76cd22a55b1
f38: 6f15d0dd72891c84b6ef5697cbe4b1c7e95c57cb
rh7: 3ba01dc5bbc96eed48287b8e4f52054d4d7030a5
u20: c75f3d16e66aefb847da47eacb5c5e2595b582a5
u22: 5d9d1cf2d1df9f20fae8e1edda93bd41e3d38626

View File

@ -408,7 +408,7 @@ sub containerBuild
" export DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive && \\\n" .
" apt-get update && \\\n" .
" apt-get install -y --no-install-recommends openssh-server wget sudo gcc make valgrind git \\\n" .
" libdbd-pg-perl libhtml-parser-perl libssl-dev libperl-dev \\\n" .
" libdbd-pg-perl libhtml-parser-perl libssl-dev libperl-dev python3-distutils \\\n" .
" libyaml-libyaml-perl tzdata devscripts lintian libxml-checker-perl txt2man debhelper \\\n" .
" libppi-html-perl libtemplate-perl libtest-differences-perl zlib1g-dev libxml2-dev pkg-config \\\n" .
" libbz2-dev bzip2 libyaml-dev libjson-pp-perl liblz4-dev liblz4-tool gnupg lsb-release ccache meson \\\n" .