mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-04 09:43:08 +02:00
Add experimental Meson build.
Meson is a new build system that offers simpler syntax and superior performance to autoconf/make. In addition, Windows is supported natively. The Meson build appears complete, but currently is used only for auto-generation of code and the host build of pgbackrest. Some container upgrades will be required before Meson can be used for container builds. Also patch the Debian package to force autoconf/make rather than Meson.
This commit is contained in:
parent
148956aed8
commit
b8fc20d5b8
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -90,7 +90,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 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 meson git liblz4-dev liblz4-tool zstd libzstd-dev bzip2 libbz2-dev
|
||||
|
||||
run: |
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE?}/pgbackrest
|
||||
|
@ -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
|
||||
zstd libzstd-dev bzip2 libbz2-dev libyaml-dev ccache 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.
|
||||
@ -240,10 +240,9 @@ pgbackrest/test/test.pl --vm=none --dry-run
|
||||
--- output ---
|
||||
|
||||
P00 INFO: test begin on x86_64 - log level info
|
||||
P00 INFO: configure build
|
||||
P00 INFO: builds required: bin
|
||||
--> P00 INFO: 72 tests selected
|
||||
|
||||
|
||||
P00 INFO: P1-T01/72 - vm=none, module=common, test=error
|
||||
[filtered 69 lines of output]
|
||||
P00 INFO: P1-T71/72 - vm=none, module=performance, test=type
|
||||
@ -261,16 +260,16 @@ pgbackrest/test/test.pl --vm=none --vm-out --module=common --test=wait
|
||||
P00 INFO: autogenerate configure
|
||||
P00 INFO: autogenerated version in configure.ac script: no changes
|
||||
P00 INFO: autogenerated configure script: no changes
|
||||
P00 INFO: autogenerate code
|
||||
P00 INFO: clean autogenerate code
|
||||
P00 INFO: cleanup old data
|
||||
P00 INFO: builds required: none
|
||||
P00 INFO: 1 test selected
|
||||
|
||||
|
||||
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
|
||||
|
||||
|
||||
run 1 - waitNew(), waitMore, and waitFree()
|
||||
L0018 expect AssertError: assertion 'waitTime <= 999999000' failed
|
||||
|
||||
|
||||
run 1/1 ------------- L0021 0ms wait
|
||||
L0025 new wait
|
||||
L0026 check remaining time
|
||||
@ -295,9 +294,9 @@ pgbackrest/test/test.pl --vm=none --vm-out --module=common --test=wait
|
||||
L0062 lower range check
|
||||
L0063 upper range check
|
||||
L0065 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
|
||||
@ -320,7 +319,7 @@ pgbackrest/test/test.pl --vm=none --module=postgres
|
||||
P00 INFO: cleanup old data
|
||||
P00 INFO: builds required: 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
|
||||
@ -339,7 +338,7 @@ pgbackrest/test/test.pl --vm-build --vm=u20
|
||||
--- output ---
|
||||
|
||||
P00 INFO: test begin on x86_64 - log level info
|
||||
P00 INFO: Using cached pgbackrest/test:u20-base-20220504A image (45b0905785dfd06c867b4067563171970c7581c5) ...
|
||||
P00 INFO: Using cached pgbackrest/test:u20-base-20220519A image (17c74ed3fd3d76119f672740d77caf873fc57bac) ...
|
||||
P00 INFO: Building pgbackrest/test:u20-test image ...
|
||||
P00 INFO: Build Complete
|
||||
```
|
||||
@ -358,12 +357,11 @@ pgbackrest/test/test.pl --vm=u20 --module=mock --test=archive --run=2
|
||||
P00 INFO: autogenerate code
|
||||
P00 INFO: cleanup old data and containers
|
||||
P00 INFO: builds required: bin, bin host
|
||||
P00 INFO: build bin for u20 (/home/vagrant/test/bin/u20)
|
||||
P00 INFO: bin dependencies have changed, rebuilding
|
||||
P00 INFO: build bin for none (/home/vagrant/test/bin/none)
|
||||
P00 INFO: bin build for u20 (/home/vagrant/test/bin/u20)
|
||||
P00 INFO: bin dependencies have changed, rebuilding
|
||||
P00 INFO: clean bin build for none (/home/vagrant/test/bin/none)
|
||||
P00 INFO: 1 test selected
|
||||
|
||||
|
||||
P00 INFO: P1-T1/1 - vm=u20, module=mock, test=archive, run=2
|
||||
P00 INFO: no code modules had all tests run required for coverage
|
||||
P00 INFO: TESTS COMPLETED SUCCESSFULLY
|
||||
|
@ -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
|
||||
zstd libzstd-dev bzip2 libbz2-dev libyaml-dev ccache meson
|
||||
</exe-cmd>
|
||||
<exe-cmd-extra>-y 2>&1</exe-cmd-extra>
|
||||
</execute>
|
||||
|
@ -16,6 +16,10 @@
|
||||
<release-list>
|
||||
<release date="XXXX-XX-XX" version="2.40dev" title="UNDER DEVELOPMENT">
|
||||
<release-core-list>
|
||||
<text>
|
||||
<p><b>NOTE TO PACKAGERS</b>: An experimental <proper>meson</proper> build has been added but packagers should continue to use the <proper>autoconf</proper>/<proper>make</proper> build for the foreseeable future.</p>
|
||||
</text>
|
||||
|
||||
<release-improvement-list>
|
||||
<release-item>
|
||||
<github-pull-request id="1758"/>
|
||||
@ -80,6 +84,18 @@
|
||||
|
||||
<release-test-list>
|
||||
<release-improvement-list>
|
||||
<release-item>
|
||||
<github-pull-request id="1765"/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
<release-item-reviewer id="eli.schwartz"/>
|
||||
<release-item-reviewer id="sam.bassaly"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Add experimental <proper>Meson</proper> build.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<github-pull-request id="1764"/>
|
||||
|
||||
@ -11488,6 +11504,11 @@
|
||||
<contributor-id type="github">ejberdecia</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="eli.schwartz">
|
||||
<contributor-name-display>Eli Schwartz</contributor-name-display>
|
||||
<contributor-id type="github">eli-schwartz</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="eric.radman">
|
||||
<contributor-name-display>Eric Radman</contributor-name-display>
|
||||
<contributor-id type="github">eradman</contributor-id>
|
||||
@ -11940,6 +11961,11 @@
|
||||
<contributor-id type="github">rustprooflabs</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="sam.bassaly">
|
||||
<contributor-name-display>Sam Bassaly</contributor-name-display>
|
||||
<contributor-id type="github">shkshk90</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="sarah.conway">
|
||||
<contributor-name-display>Sarah Conway</contributor-name-display>
|
||||
<contributor-id type="github">xenophenes</contributor-id>
|
||||
|
161
meson.build
Normal file
161
meson.build
Normal file
@ -0,0 +1,161 @@
|
||||
####################################################################################################################################
|
||||
# pgBackRest Project
|
||||
####################################################################################################################################
|
||||
project(
|
||||
'pgbackrest',
|
||||
['c'],
|
||||
version: '2.40dev',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.53.2',
|
||||
default_options: [
|
||||
# Core options
|
||||
'buildtype=release',
|
||||
'warning_level=2',
|
||||
|
||||
# Base options
|
||||
'b_ndebug=if-release',
|
||||
|
||||
# Compiler options
|
||||
'c_std=c99',
|
||||
],
|
||||
)
|
||||
|
||||
# Selected C compiler
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
####################################################################################################################################
|
||||
# OS-specific settings
|
||||
####################################################################################################################################
|
||||
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')
|
||||
endif
|
||||
|
||||
####################################################################################################################################
|
||||
# Enable/disable warnings
|
||||
####################################################################################################################################
|
||||
# Enable as many additional warnings as possible to catch potential errors
|
||||
warning_enable = [
|
||||
# Warn for implicit conversions that may alter a value
|
||||
'-Wconversion',
|
||||
|
||||
# Warn about duplicated conditions in an if-else-if chain
|
||||
'-Wduplicated-cond',
|
||||
|
||||
# Warn when an if-else has identical branches
|
||||
'-Wduplicated-branches',
|
||||
|
||||
# Warn if the format string is not a string literal and cannot be checked
|
||||
'-Wformat-nonliteral',
|
||||
|
||||
# Enable -Wformat plus additional format checks
|
||||
'-Wformat=2',
|
||||
|
||||
# Warn if the format string requires an unsigned argument and the argument is signed and vice versa
|
||||
'-Wformat-signedness',
|
||||
|
||||
# Warn about anything that depends on the “size of” a function type or of void
|
||||
'-Wpointer-arith',
|
||||
|
||||
# Warn if a function is declared or defined without specifying the argument types
|
||||
'-Wstrict-prototypes',
|
||||
|
||||
# Warn if a variable-length array is used
|
||||
'-Wvla',
|
||||
|
||||
# Give string constants the type const char[length] so that copying the address of one into a non-const char * pointer produces
|
||||
# a warning
|
||||
'-Wwrite-strings',
|
||||
]
|
||||
|
||||
# Disable various unhelpful warnings
|
||||
warning_disable = [
|
||||
# Warn for variables that might be changed by longjmp or vfork. Disable because of constant false positives/negatives.
|
||||
'-Wno-clobbered',
|
||||
|
||||
# Warn if a structure’s initializer has some fields missing. Disable so we can initialize with {0}.
|
||||
'-Wno-missing-field-initializers',
|
||||
|
||||
# Warn when a switch case falls through. Disable because this an useful aspect of switches and tests should catch problems.
|
||||
'-Wno-implicit-fallthrough',
|
||||
]
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments(warning_enable, warning_disable), language: 'c')
|
||||
|
||||
####################################################################################################################################
|
||||
# Enable additional optimizations if the level is high enough
|
||||
####################################################################################################################################
|
||||
if get_option('optimization') in ['2', '3']
|
||||
optimization_enable = [
|
||||
# Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop
|
||||
'-funroll-loops',
|
||||
|
||||
# Perform loop vectorization on trees
|
||||
'-ftree-vectorize',
|
||||
]
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments(optimization_enable), language: 'c')
|
||||
endif
|
||||
|
||||
####################################################################################################################################
|
||||
# Stop after the first error when error on warn enabled. Subsequent errors are often caused by the first error.
|
||||
####################################################################################################################################
|
||||
if get_option('fatal-errors')
|
||||
add_project_arguments(cc.get_supported_arguments('-Wfatal-errors'), language: 'c')
|
||||
endif
|
||||
|
||||
####################################################################################################################################
|
||||
# Build configuration
|
||||
####################################################################################################################################
|
||||
configuration = configuration_data()
|
||||
|
||||
# Find required bz2 library
|
||||
lib_bz2 = cc.find_library('bz2')
|
||||
|
||||
# Find optional lz4 library
|
||||
lib_lz4 = dependency('liblz4', required: false)
|
||||
|
||||
if lib_lz4.found()
|
||||
configuration.set('HAVE_LIBLZ4', true, description: 'Is liblz4 present?')
|
||||
endif
|
||||
|
||||
# Find required openssl library
|
||||
lib_openssl = dependency('openssl')
|
||||
|
||||
# Find required pq library
|
||||
lib_pq = dependency('libpq')
|
||||
|
||||
# Find required xml library
|
||||
lib_xml = dependency('libxml-2.0')
|
||||
|
||||
# Find required yaml library (only used for build)
|
||||
lib_yaml = dependency('yaml-0.1')
|
||||
|
||||
# Find required gz library
|
||||
lib_z = dependency('zlib')
|
||||
|
||||
# Find optional zstd library
|
||||
lib_zstd = dependency('libzstd', version: '>=1.0', required: false)
|
||||
|
||||
if lib_zstd.found()
|
||||
configuration.set('HAVE_LIBZST', true, description: 'Is libzstd present?')
|
||||
endif
|
||||
|
||||
# Check if the C compiler supports _Static_assert()
|
||||
if cc.compiles('''int main(int arg, char **argv) {({ _Static_assert(1, "foo");});} ''')
|
||||
configuration.set('HAVE_STATIC_ASSERT', true, description: 'Does the compiler provide _Static_assert()?')
|
||||
endif
|
||||
|
||||
# Enable debug code
|
||||
if get_option('debug')
|
||||
configuration.set('DEBUG', true, description: 'Enable debug code')
|
||||
endif
|
||||
|
||||
# Set configuration path
|
||||
configuration.set_quoted('CFGOPTDEF_CONFIG_PATH', get_option('configdir'), description: 'Configuration path')
|
||||
|
||||
####################################################################################################################################
|
||||
# Include src
|
||||
####################################################################################################################################
|
||||
subdir('src')
|
2
meson_options.txt
Normal file
2
meson_options.txt
Normal file
@ -0,0 +1,2 @@
|
||||
option('configdir', type: 'string', value: '/etc/pgbackrest', description: 'Configuration directory')
|
||||
option('fatal-errors', type: 'boolean', value: false, description: 'Stop compilation on first error')
|
@ -24,11 +24,25 @@ main(int argListSize, const char *argList[])
|
||||
THROW_ON_SYS_ERROR(getcwd(currentWorkDir, sizeof(currentWorkDir)) == NULL, FormatError, "unable to get cwd");
|
||||
|
||||
// Get repo path (cwd if it was not passed)
|
||||
const String *pathRepo = argListSize >= 2 ? strPath(STR(argList[1])) : strPath(STR(currentWorkDir));
|
||||
const String *pathRepo = strPath(STR(currentWorkDir));
|
||||
String *const pathOut = strCatZ(strNew(), currentWorkDir);
|
||||
|
||||
if (argListSize >= 2)
|
||||
{
|
||||
const String *const pathArg = STR(argList[1]);
|
||||
|
||||
if (strBeginsWith(pathArg, FSLASH_STR))
|
||||
pathRepo = strPath(pathArg);
|
||||
else
|
||||
{
|
||||
pathRepo = strPathAbsolute(pathArg, STR(currentWorkDir));
|
||||
strCatZ(pathOut, "/src");
|
||||
}
|
||||
}
|
||||
|
||||
// Render config
|
||||
const Storage *const storageRepo = storagePosixNewP(pathRepo);
|
||||
const Storage *const storageBuild = storagePosixNewP(STR(currentWorkDir), .write = true);
|
||||
const Storage *const storageBuild = storagePosixNewP(pathOut, .write = true);
|
||||
const BldCfg bldCfg = bldCfgParse(storageRepo);
|
||||
bldHlpRender(storageBuild, bldCfg, bldHlpParse(storageRepo, bldCfg));
|
||||
|
||||
|
15
src/command/help/meson.build
Normal file
15
src/command/help/meson.build
Normal file
@ -0,0 +1,15 @@
|
||||
####################################################################################################################################
|
||||
# Generate help
|
||||
####################################################################################################################################
|
||||
help_auto_c_inc = custom_target(
|
||||
'help.auto.c.inc',
|
||||
output : 'help.auto.c.inc',
|
||||
depend_files: [
|
||||
'../../build/config/config.yaml',
|
||||
'../../build/help/help.xml',
|
||||
],
|
||||
command : [
|
||||
build_help,
|
||||
'@CURRENT_SOURCE_DIR@/../../..'
|
||||
],
|
||||
)
|
309
src/meson.build
Normal file
309
src/meson.build
Normal file
@ -0,0 +1,309 @@
|
||||
####################################################################################################################################
|
||||
# It is very easy to get into confusing states when the source directory contains an in-place build, e.g. the wrong build.auto.h
|
||||
# will be used. So just refuse to build in this case.
|
||||
####################################################################################################################################
|
||||
if import('fs').exists(meson.current_source_dir() / 'build.auto.h')
|
||||
error('''
|
||||
|
||||
Non-clean source code directory detected.
|
||||
|
||||
To build with meson the source tree may not have an in-place, ./configure
|
||||
style, build configured. Use a separate check out for meson based builds, or
|
||||
run 'make clean-all' in the source tree.
|
||||
|
||||
You can have both meson and ./configure style builds for the same source tree
|
||||
by building out-of-source / VPATH with configure as well.''')
|
||||
endif
|
||||
|
||||
####################################################################################################################################
|
||||
# Write configuration
|
||||
####################################################################################################################################
|
||||
configure_file(output: 'build.auto.h', configuration: configuration)
|
||||
|
||||
####################################################################################################################################
|
||||
# Common source used by all targets
|
||||
####################################################################################################################################
|
||||
src_common = [
|
||||
'common/debug.c',
|
||||
'common/encode.c',
|
||||
'common/error.c',
|
||||
'common/io/filter/buffer.c',
|
||||
'common/io/filter/filter.c',
|
||||
'common/io/filter/group.c',
|
||||
'common/io/filter/sink.c',
|
||||
'common/io/bufferRead.c',
|
||||
'common/io/bufferWrite.c',
|
||||
'common/io/io.c',
|
||||
'common/io/read.c',
|
||||
'common/io/write.c',
|
||||
'common/log.c',
|
||||
'common/memContext.c',
|
||||
'common/regExp.c',
|
||||
'common/stackTrace.c',
|
||||
'common/time.c',
|
||||
'common/type/buffer.c',
|
||||
'common/type/convert.c',
|
||||
'common/type/keyValue.c',
|
||||
'common/type/list.c',
|
||||
'common/type/object.c',
|
||||
'common/type/pack.c',
|
||||
'common/type/string.c',
|
||||
'common/type/stringZ.c',
|
||||
'common/type/stringId.c',
|
||||
'common/type/stringList.c',
|
||||
'common/type/variant.c',
|
||||
'common/type/variantList.c',
|
||||
'common/user.c',
|
||||
'common/wait.c',
|
||||
'config/common.c',
|
||||
'storage/posix/read.c',
|
||||
'storage/posix/storage.c',
|
||||
'storage/posix/write.c',
|
||||
'storage/read.c',
|
||||
'storage/storage.c',
|
||||
'storage/write.c',
|
||||
]
|
||||
|
||||
####################################################################################################################################
|
||||
# Build config target
|
||||
####################################################################################################################################
|
||||
src_build_config = [
|
||||
'build/common/render.c',
|
||||
'build/common/yaml.c',
|
||||
'build/config/main.c',
|
||||
'build/config/parse.c',
|
||||
'build/config/render.c',
|
||||
]
|
||||
|
||||
build_config = executable(
|
||||
'build-config',
|
||||
src_common,
|
||||
src_build_config,
|
||||
dependencies : [
|
||||
lib_yaml
|
||||
],
|
||||
build_by_default: false,
|
||||
)
|
||||
|
||||
alias_target('build-config', build_config)
|
||||
|
||||
####################################################################################################################################
|
||||
# Build error target
|
||||
####################################################################################################################################
|
||||
src_build_error = [
|
||||
'build/common/render.c',
|
||||
'build/common/yaml.c',
|
||||
'build/error/main.c',
|
||||
'build/error/parse.c',
|
||||
'build/error/render.c',
|
||||
]
|
||||
|
||||
build_error = executable(
|
||||
'build-error',
|
||||
src_common,
|
||||
src_build_error,
|
||||
dependencies : [
|
||||
lib_yaml
|
||||
],
|
||||
build_by_default: false,
|
||||
)
|
||||
|
||||
alias_target('build-error', build_error)
|
||||
|
||||
####################################################################################################################################
|
||||
# Build help target
|
||||
####################################################################################################################################
|
||||
src_build_help = [
|
||||
'build/common/render.c',
|
||||
'build/common/yaml.c',
|
||||
'build/config/parse.c',
|
||||
'build/help/main.c',
|
||||
'build/help/parse.c',
|
||||
'build/help/render.c',
|
||||
'common/compress/bz2/common.c',
|
||||
'common/compress/bz2/compress.c',
|
||||
'common/type/xml.c',
|
||||
]
|
||||
|
||||
build_help = executable(
|
||||
'build-help',
|
||||
src_common,
|
||||
src_build_help,
|
||||
dependencies: [
|
||||
lib_bz2,
|
||||
lib_xml,
|
||||
lib_yaml
|
||||
],
|
||||
)
|
||||
|
||||
# build help.auto.c.inc
|
||||
subdir('command/help')
|
||||
|
||||
alias_target('build-help', help_auto_c_inc)
|
||||
|
||||
####################################################################################################################################
|
||||
# pgBackRest target
|
||||
####################################################################################################################################
|
||||
src_pgbackrest = [
|
||||
'command/archive/common.c',
|
||||
'command/archive/get/file.c',
|
||||
'command/archive/get/get.c',
|
||||
'command/archive/get/protocol.c',
|
||||
'command/archive/push/file.c',
|
||||
'command/archive/push/protocol.c',
|
||||
'command/archive/push/push.c',
|
||||
'command/backup/backup.c',
|
||||
'command/backup/common.c',
|
||||
'command/backup/pageChecksum.c',
|
||||
'command/backup/protocol.c',
|
||||
'command/backup/file.c',
|
||||
'command/check/check.c',
|
||||
'command/check/common.c',
|
||||
'command/expire/expire.c',
|
||||
'command/help/help.c',
|
||||
'command/info/info.c',
|
||||
'command/command.c',
|
||||
'command/control/common.c',
|
||||
'command/control/start.c',
|
||||
'command/control/stop.c',
|
||||
'command/local/local.c',
|
||||
'command/repo/common.c',
|
||||
'command/repo/create.c',
|
||||
'command/repo/get.c',
|
||||
'command/repo/ls.c',
|
||||
'command/repo/put.c',
|
||||
'command/repo/rm.c',
|
||||
'command/restore/file.c',
|
||||
'command/restore/protocol.c',
|
||||
'command/restore/restore.c',
|
||||
'command/remote/remote.c',
|
||||
'command/server/ping.c',
|
||||
'command/server/server.c',
|
||||
'command/stanza/common.c',
|
||||
'command/stanza/create.c',
|
||||
'command/stanza/delete.c',
|
||||
'command/stanza/upgrade.c',
|
||||
'command/verify/file.c',
|
||||
'command/verify/protocol.c',
|
||||
'command/verify/verify.c',
|
||||
'common/compress/helper.c',
|
||||
'common/compress/bz2/common.c',
|
||||
'common/compress/bz2/compress.c',
|
||||
'common/compress/bz2/decompress.c',
|
||||
'common/compress/gz/common.c',
|
||||
'common/compress/gz/compress.c',
|
||||
'common/compress/gz/decompress.c',
|
||||
'common/compress/lz4/common.c',
|
||||
'common/compress/lz4/compress.c',
|
||||
'common/compress/lz4/decompress.c',
|
||||
'common/compress/zst/common.c',
|
||||
'common/compress/zst/compress.c',
|
||||
'common/compress/zst/decompress.c',
|
||||
'common/crypto/cipherBlock.c',
|
||||
'common/crypto/common.c',
|
||||
'common/crypto/hash.c',
|
||||
'common/exec.c',
|
||||
'common/exit.c',
|
||||
'common/fork.c',
|
||||
'common/ini.c',
|
||||
'common/io/client.c',
|
||||
'common/io/fd.c',
|
||||
'common/io/fdRead.c',
|
||||
'common/io/fdWrite.c',
|
||||
'common/io/filter/size.c',
|
||||
'common/io/http/client.c',
|
||||
'common/io/http/common.c',
|
||||
'common/io/http/header.c',
|
||||
'common/io/http/query.c',
|
||||
'common/io/http/request.c',
|
||||
'common/io/http/response.c',
|
||||
'common/io/http/session.c',
|
||||
'common/io/http/url.c',
|
||||
'common/io/server.c',
|
||||
'common/io/session.c',
|
||||
'common/io/socket/client.c',
|
||||
'common/io/socket/common.c',
|
||||
'common/io/socket/server.c',
|
||||
'common/io/socket/session.c',
|
||||
'common/io/tls/client.c',
|
||||
'common/io/tls/common.c',
|
||||
'common/io/tls/server.c',
|
||||
'common/io/tls/session.c',
|
||||
'common/lock.c',
|
||||
'common/stat.c',
|
||||
'common/type/json.c',
|
||||
'common/type/xml.c',
|
||||
'config/config.c',
|
||||
'config/exec.c',
|
||||
'config/load.c',
|
||||
'config/parse.c',
|
||||
'config/protocol.c',
|
||||
'db/db.c',
|
||||
'db/helper.c',
|
||||
'db/protocol.c',
|
||||
'info/info.c',
|
||||
'info/infoArchive.c',
|
||||
'info/infoBackup.c',
|
||||
'info/manifest.c',
|
||||
'info/infoPg.c',
|
||||
'postgres/client.c',
|
||||
'postgres/interface.c',
|
||||
'postgres/interface/page.c',
|
||||
'postgres/interface/v090.c',
|
||||
'postgres/interface/v091.c',
|
||||
'postgres/interface/v092.c',
|
||||
'postgres/interface/v093.c',
|
||||
'postgres/interface/v094.c',
|
||||
'postgres/interface/v095.c',
|
||||
'postgres/interface/v096.c',
|
||||
'postgres/interface/v100.c',
|
||||
'postgres/interface/v110.c',
|
||||
'postgres/interface/v120.c',
|
||||
'postgres/interface/v130.c',
|
||||
'postgres/interface/v140.c',
|
||||
'postgres/interface/v150.c',
|
||||
'protocol/client.c',
|
||||
'protocol/command.c',
|
||||
'protocol/helper.c',
|
||||
'protocol/parallel.c',
|
||||
'protocol/parallelJob.c',
|
||||
'protocol/server.c',
|
||||
'storage/azure/helper.c',
|
||||
'storage/azure/read.c',
|
||||
'storage/azure/storage.c',
|
||||
'storage/azure/write.c',
|
||||
'storage/cifs/helper.c',
|
||||
'storage/cifs/storage.c',
|
||||
'storage/gcs/helper.c',
|
||||
'storage/gcs/read.c',
|
||||
'storage/gcs/storage.c',
|
||||
'storage/gcs/write.c',
|
||||
'storage/helper.c',
|
||||
'storage/remote/read.c',
|
||||
'storage/remote/protocol.c',
|
||||
'storage/remote/storage.c',
|
||||
'storage/remote/write.c',
|
||||
'storage/s3/helper.c',
|
||||
'storage/s3/read.c',
|
||||
'storage/s3/storage.c',
|
||||
'storage/s3/write.c',
|
||||
'main.c',
|
||||
]
|
||||
|
||||
pgbackrest = executable(
|
||||
'pgbackrest',
|
||||
src_common,
|
||||
src_pgbackrest,
|
||||
help_auto_c_inc,
|
||||
dependencies : [
|
||||
lib_bz2,
|
||||
lib_openssl,
|
||||
lib_lz4,
|
||||
lib_pq,
|
||||
lib_xml,
|
||||
lib_z,
|
||||
lib_zstd,
|
||||
]
|
||||
)
|
||||
|
||||
alias_target('pgbackrest', pgbackrest)
|
@ -9,7 +9,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
||||
sudo vim htop jq rsync sysstat curl \
|
||||
libdbd-pg-perl libxml-checker-perl libyaml-perl \
|
||||
devscripts build-essential lintian git cloc txt2man debhelper libssl-dev zlib1g-dev libperl-dev libxml2-dev liblz4-dev \
|
||||
liblz4-tool libpq-dev lcov autoconf-archive zstd libzstd-dev bzip2 libbz2-dev pkg-config libyaml-dev libc6-dbg wget
|
||||
liblz4-tool libpq-dev lcov autoconf-archive zstd libzstd-dev bzip2 libbz2-dev pkg-config libyaml-dev libc6-dbg wget meson \
|
||||
ccache
|
||||
|
||||
# Install Docker
|
||||
RUN groupadd -g5000 docker
|
||||
|
2
test/Vagrantfile
vendored
2
test/Vagrantfile
vendored
@ -76,7 +76,7 @@ Vagrant.configure(2) do |config|
|
||||
echo 'Install Build Tools' && date
|
||||
apt-get install -y devscripts build-essential lintian git cloc txt2man debhelper libssl-dev zlib1g-dev libperl-dev \
|
||||
libxml2-dev liblz4-dev liblz4-tool libpq-dev lcov autoconf-archive zstd libzstd-dev bzip2 libbz2-dev pkg-config \
|
||||
libyaml-dev libc6-dbg
|
||||
libyaml-dev libc6-dbg meson ccache
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
echo 'Install Docker' && date
|
||||
|
@ -187,7 +187,8 @@ eval
|
||||
elsif ($ARGV[0] eq 'test')
|
||||
{
|
||||
# Build list of packages that need to be installed
|
||||
my $strPackage = "make gcc git rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config";
|
||||
my $strPackage =
|
||||
"make gcc ccache meson python3-pip git rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config";
|
||||
|
||||
# Add lcov when testing coverage
|
||||
if (vmCoverageC($strVm))
|
||||
|
@ -147,6 +147,14 @@ doc/xml/user-guide.xml:
|
||||
class: doc/source
|
||||
type: xml
|
||||
|
||||
meson.build:
|
||||
class: build
|
||||
type: meson
|
||||
|
||||
meson_options.txt:
|
||||
class: build
|
||||
type: meson
|
||||
|
||||
src/Makefile.in:
|
||||
class: build
|
||||
type: make
|
||||
@ -423,6 +431,10 @@ src/command/help/help.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/command/help/meson.build:
|
||||
class: build
|
||||
type: meson
|
||||
|
||||
src/command/info/info.c:
|
||||
class: core
|
||||
type: c
|
||||
@ -1403,6 +1415,10 @@ src/main.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/meson.build:
|
||||
class: build
|
||||
type: meson
|
||||
|
||||
src/postgres/client.c:
|
||||
class: core
|
||||
type: c
|
||||
|
@ -80,7 +80,7 @@ sub codeCountScan
|
||||
$strClass = 'doc/core';
|
||||
}
|
||||
elsif ($strFile =~ '^build/' || $strFile eq 'src/Makefile.in' || $strFile eq 'src/configure' ||
|
||||
$strFile =~ '^src/build/')
|
||||
$strFile =~ '^src/build/' || $strFile =~ 'meson\.build$' || $strFile =~ 'meson_options\.txt$')
|
||||
{
|
||||
$strClass = 'build';
|
||||
}
|
||||
@ -139,6 +139,11 @@ sub codeCountScan
|
||||
$strType = 'make';
|
||||
$strForceLang = 'make';
|
||||
}
|
||||
elsif ($strFile =~ 'meson\.build$' || $strFile =~ 'meson_options\.txt$')
|
||||
{
|
||||
$strType = 'meson';
|
||||
$strForceLang = 'make';
|
||||
}
|
||||
elsif ($strFile =~ '\.xml$')
|
||||
{
|
||||
$strType = 'xml';
|
||||
|
@ -609,7 +609,9 @@ sub run
|
||||
$strTestDepend .= " ${strTestFile}";
|
||||
|
||||
# Determine where the project exe is located
|
||||
my $strProjectExePath = "$self->{strTestPath}/bin/$self->{oTest}->{&TEST_VM}/" . PROJECT_EXE;
|
||||
my $strProjectExePath =
|
||||
"$self->{strTestPath}/bin/$self->{oTest}->{&TEST_VM}/" . ($self->{oTest}->{&TEST_VM} eq VM_NONE ? 'src/' : '') .
|
||||
PROJECT_EXE;
|
||||
|
||||
# Is this test running in a container?
|
||||
my $strContainer = $self->{oTest}->{&TEST_VM} eq VM_NONE ? 'false' : 'true';
|
||||
|
11
test/patch/debian-package.patch
Normal file
11
test/patch/debian-package.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- rules
|
||||
+++ rules
|
||||
@@ -14,7 +14,7 @@
|
||||
override_dh_auto_configure:
|
||||
# src contains a seperate configure script.
|
||||
cd $(CURDIR)/src && ./configure --prefix=/usr --bindir=/usr/bin
|
||||
- dh_auto_configure
|
||||
+ dh_auto_configure --buildsystem=makefile
|
||||
|
||||
override_dh_auto_build:
|
||||
# Replace user name in doc cache with the current user
|
143
test/test.pl
143
test/test.pl
@ -491,31 +491,41 @@ eval
|
||||
&log(INFO, " autogenerated configure script: " . (@stryBuilt ? join(', ', @stryBuilt) : 'no changes'));
|
||||
}
|
||||
|
||||
# Create the build path
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my $strBuildPath = "${strTestPath}/build";
|
||||
|
||||
# Determine if we need to start from scratch due to changes that make may not detect
|
||||
if (!-e "${strBuildPath}/Makefile" ||
|
||||
stat("${strBackRestBase}/src/Makefile.in")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
|
||||
stat("${strBackRestBase}/src/configure")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
|
||||
stat("${strBackRestBase}/src/build.auto.h.in")->mtime > stat("${strBuildPath}/Makefile")->mtime)
|
||||
{
|
||||
&log(INFO, "configure build");
|
||||
|
||||
$oStorageTest->pathCreate("${strBuildPath}/repo", {strMode => '0770', bIgnoreExists => true, bCreateParent => true});
|
||||
executeTest("find ${strBuildPath} -mindepth 1 -print0 | xargs -0 rm -rf");
|
||||
executeTest("cd ${strBuildPath} && ${strBackRestBase}/src/configure -q --enable-test");
|
||||
}
|
||||
|
||||
# Auto-generate code files unless --no-gen specified
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if (!$bNoGen)
|
||||
{
|
||||
&log(INFO, "autogenerate code");
|
||||
my $strBuildPath = "${strTestPath}/build";
|
||||
|
||||
&log(INFO, (!-e $strBuildPath ? 'clean ' : '') . 'autogenerate code');
|
||||
|
||||
# Auto-generate version for root meson.build script
|
||||
my $strMesonBuildOld = ${$oStorageTest->get("${strBackRestBase}/meson.build")};
|
||||
my $strMesonBuildNew;
|
||||
|
||||
foreach my $strLine (split("\n", $strMesonBuildOld))
|
||||
{
|
||||
if ($strLine =~ /^ version\: '/)
|
||||
{
|
||||
$strLine = " version: '" . PROJECT_VERSION . "',";
|
||||
}
|
||||
|
||||
$strMesonBuildNew .= "${strLine}\n";
|
||||
}
|
||||
|
||||
buildPutDiffers($oStorageBackRest, "${strBackRestBase}/meson.build", $strMesonBuildNew);
|
||||
|
||||
# Setup build if it does not exist
|
||||
if (!-e $strBuildPath)
|
||||
{
|
||||
executeTest("meson setup -Dwerror=true -Dfatal-errors=true -Dbuildtype=debug ${strBuildPath} ${strBackRestBase}");
|
||||
}
|
||||
|
||||
# Build code
|
||||
executeTest("make -C ${strBuildPath} build-config build-error build-help");
|
||||
executeTest(
|
||||
"ninja -C ${strBuildPath} build-config build-error build-help" .
|
||||
" && ${strBuildPath}/src/build-config ${strBackRestBase}/src" .
|
||||
" && ${strBuildPath}/src/build-error ${strBackRestBase}/src");
|
||||
|
||||
if ($bGenOnly)
|
||||
{
|
||||
@ -672,58 +682,69 @@ eval
|
||||
foreach my $strBuildVM (@stryBuildVm)
|
||||
{
|
||||
my $strBuildPath = "${strBinPath}/${strBuildVM}";
|
||||
my $bRebuild = false;
|
||||
$rhBinBuild->{$strBuildVM} = false;
|
||||
|
||||
# Build configure/compile options and see if they have changed from the previous build
|
||||
my $strCFlags =
|
||||
(vmWithBackTrace($strBuildVM) && $bBackTrace ? ' -DWITH_BACKTRACE' : '') .
|
||||
($bDebugTestTrace ? ' -DDEBUG_TEST_TRACE' : '');
|
||||
my $strLdFlags = vmWithBackTrace($strBuildVM) && $bBackTrace ? '-lbacktrace' : '';
|
||||
my $strConfigOptions = (vmDebugIntegration($strBuildVM) ? ' --enable-test' : '');
|
||||
my $strBuildFlags = "CFLAGS_EXTRA=${strCFlags}\nLDFLAGS_EXTRA=${strLdFlags}\nCONFIGURE=${strConfigOptions}";
|
||||
my $strBuildFlagFile = "${strBinPath}/${strBuildVM}/build.flags";
|
||||
|
||||
my $bBuildOptionsDiffer = buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags);
|
||||
|
||||
&log(INFO, " build bin for ${strBuildVM} (${strBuildPath})");
|
||||
|
||||
if ($strBuildVM ne VM_NONE)
|
||||
if ($strBuildVM eq VM_NONE)
|
||||
{
|
||||
&log(INFO, " " . (!-e $strBuildPath ? 'clean ' : '') . "bin build for ${strBuildVM} (${strBuildPath})");
|
||||
|
||||
# Setup build if it does not exist
|
||||
if (!-e $strBuildPath)
|
||||
{
|
||||
executeTest("meson setup -Dwerror=true -Dfatal-errors=true ${strBuildPath} ${strBackRestBase}");
|
||||
}
|
||||
|
||||
# Build code
|
||||
executeTest("ninja -C ${strBuildPath}");
|
||||
}
|
||||
else
|
||||
{
|
||||
&log(INFO, " bin build for ${strBuildVM} (${strBuildPath})");
|
||||
|
||||
my $bRebuild = false;
|
||||
$rhBinBuild->{$strBuildVM} = false;
|
||||
|
||||
# Build configure/compile options and see if they have changed from the previous build
|
||||
my $strCFlags =
|
||||
(vmWithBackTrace($strBuildVM) && $bBackTrace ? ' -DWITH_BACKTRACE' : '') .
|
||||
($bDebugTestTrace ? ' -DDEBUG_TEST_TRACE' : '');
|
||||
my $strLdFlags = vmWithBackTrace($strBuildVM) && $bBackTrace ? '-lbacktrace' : '';
|
||||
my $strConfigOptions = (vmDebugIntegration($strBuildVM) ? ' --enable-test' : '');
|
||||
my $strBuildFlags = "CFLAGS_EXTRA=${strCFlags}\nLDFLAGS_EXTRA=${strLdFlags}\nCONFIGURE=${strConfigOptions}";
|
||||
my $strBuildFlagFile = "${strBinPath}/${strBuildVM}/build.flags";
|
||||
|
||||
my $bBuildOptionsDiffer = buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags);
|
||||
|
||||
executeTest(
|
||||
"docker run -itd -h test-build --name=test-build" .
|
||||
" -v ${strBackRestBase}:${strBackRestBase} -v ${strTestPath}:${strTestPath} " .
|
||||
containerRepo() . ":${strBuildVM}-test",
|
||||
{bSuppressStdErr => true});
|
||||
}
|
||||
|
||||
if ($bBuildOptionsDiffer ||
|
||||
!-e "${strBuildPath}/Makefile" ||
|
||||
stat("${strBackRestBase}/src/Makefile.in")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
|
||||
stat("${strBackRestBase}/src/configure")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
|
||||
stat("${strBackRestBase}/src/build.auto.h.in")->mtime > stat("${strBuildPath}/Makefile")->mtime)
|
||||
{
|
||||
&log(INFO, ' bin dependencies have changed, rebuilding');
|
||||
if ($bBuildOptionsDiffer ||
|
||||
!-e "${strBuildPath}/Makefile" ||
|
||||
stat("${strBackRestBase}/src/Makefile.in")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
|
||||
stat("${strBackRestBase}/src/configure")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
|
||||
stat("${strBackRestBase}/src/build.auto.h.in")->mtime > stat("${strBuildPath}/Makefile")->mtime)
|
||||
{
|
||||
&log(INFO, ' bin dependencies have changed, rebuilding');
|
||||
|
||||
# Remove old path if it exists and save the build flags
|
||||
executeTest("rm -rf ${strBuildPath}");
|
||||
buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags);
|
||||
# Remove old path if it exists and save the build flags
|
||||
executeTest("rm -rf ${strBuildPath}");
|
||||
buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags);
|
||||
|
||||
executeTest(
|
||||
'docker exec -i -u ' . TEST_USER . ' test-build ' .
|
||||
"bash -c 'cd ${strBuildPath} && ${strBackRestBase}/src/configure -q${strConfigOptions}'",
|
||||
{bShowOutputAsync => $bLogDetail});
|
||||
}
|
||||
|
||||
executeTest(
|
||||
($strBuildVM ne VM_NONE ? 'docker exec -i -u ' . TEST_USER . ' test-build ' : '') .
|
||||
"bash -c 'cd ${strBuildPath} && ${strBackRestBase}/src/configure -q${strConfigOptions}'",
|
||||
'docker exec -i -u ' . TEST_USER . ' test-build ' .
|
||||
"${strMakeCmd} -s -j ${iBuildMax}" . ($bLogDetail ? '' : ' --silent') .
|
||||
" --directory ${strBuildPath} CFLAGS_EXTRA='${strCFlags}'" .
|
||||
($strLdFlags ne '' ? " LDFLAGS_EXTRA='${strLdFlags}'" : ''),
|
||||
{bShowOutputAsync => $bLogDetail});
|
||||
}
|
||||
|
||||
executeTest(
|
||||
($strBuildVM ne VM_NONE ? 'docker exec -i -u ' . TEST_USER . ' test-build ' : '') .
|
||||
"${strMakeCmd} -s -j ${iBuildMax}" . ($bLogDetail ? '' : ' --silent') .
|
||||
" --directory ${strBuildPath} CFLAGS_EXTRA='${strCFlags}'" .
|
||||
($strLdFlags ne '' ? " LDFLAGS_EXTRA='${strLdFlags}'" : ''),
|
||||
{bShowOutputAsync => $bLogDetail});
|
||||
|
||||
if ($strBuildVM ne VM_NONE)
|
||||
{
|
||||
executeTest("docker rm -f test-build");
|
||||
}
|
||||
}
|
||||
@ -773,7 +794,7 @@ eval
|
||||
# Patch files in debian package builds
|
||||
#
|
||||
# Use these commands to create a new patch (may need to modify first line):
|
||||
# BRDIR=/backrest;BRVM=u20;BRPATCHFILE=${BRDIR?}/test/patch/debian-package.patch
|
||||
# BRDIR=/home/vagrant/pgbackrest;BRVM=u20;BRPATCHFILE=${BRDIR?}/test/patch/debian-package.patch
|
||||
# DBDIR=${BRDIR?}/test/result/package/${BRVM}/debian
|
||||
# diff -Naur ${DBDIR?}.old ${DBDIR}.new > ${BRPATCHFILE?}
|
||||
my $strDebianPackagePatch = "${strBackRestBase}/test/patch/debian-package.patch";
|
||||
@ -885,7 +906,7 @@ eval
|
||||
# Patch files in RHEL package builds
|
||||
#
|
||||
# Use these commands to create a new patch (may need to modify first line):
|
||||
# BRDIR=/backrest;BRVM=rh7;BRPATCHFILE=${BRDIR?}/test/patch/rhel-package.patch
|
||||
# BRDIR=/home/vagrant/pgbackrest;BRVM=rh7;BRPATCHFILE=${BRDIR?}/test/patch/rhel-package.patch
|
||||
# PKDIR=${BRDIR?}/test/result/package/${BRVM}/SPECS
|
||||
# diff -Naur ${PKDIR?}.old ${PKDIR}.new > ${BRPATCHFILE?}
|
||||
my $strPackagePatch = "${strBackRestBase}/test/patch/rhel-package.patch";
|
||||
@ -1076,7 +1097,7 @@ eval
|
||||
$strBackRestBase, # Base backrest directory
|
||||
$strTestPath, # Path where the tests will run
|
||||
dirname($strTestPath) . "/bin/${strVm}/" . PROJECT_EXE, # Path to the pgbackrest binary
|
||||
dirname($strTestPath) . "/bin/" . VM_NONE . '/' . PROJECT_EXE, # Path to the backrest Perl storage helper
|
||||
dirname($strTestPath) . "/bin/" . VM_NONE . '/src/' . PROJECT_EXE, # Path to the pgbackrest storage helper
|
||||
$strPgVersion ne 'minimal' ? $strPgSqlBin: undef, # Pg bin path
|
||||
$strPgVersion ne 'minimal' ? $strPgVersion: undef, # Pg version
|
||||
$stryModule[0], $stryModuleTest[0], \@iyModuleTestRun, # Module info
|
||||
|
Loading…
Reference in New Issue
Block a user