├── .github
└── workflows
│ └── build.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── Makefile
├── README.md
├── doc
├── Readme.md
├── pgprobackup.xml
├── probackup.xml
├── stylesheet.css
└── stylesheet.xsl
├── gen_probackup_project.pl
├── nls.mk
├── packaging
├── Dockerfiles
│ ├── Dockerfile-altlinux_8
│ ├── Dockerfile-altlinux_9
│ ├── Dockerfile-astra_1.11
│ ├── Dockerfile-centos_7
│ ├── Dockerfile-centos_8
│ ├── Dockerfile-createrepo1C
│ ├── Dockerfile-debian_10
│ ├── Dockerfile-debian_11
│ ├── Dockerfile-debian_8
│ ├── Dockerfile-debian_9
│ ├── Dockerfile-oraclelinux_6
│ ├── Dockerfile-oraclelinux_7
│ ├── Dockerfile-oraclelinux_8
│ ├── Dockerfile-rhel_7
│ ├── Dockerfile-rhel_8
│ ├── Dockerfile-rosa_6
│ ├── Dockerfile-suse_15.1
│ ├── Dockerfile-suse_15.2
│ ├── Dockerfile-ubuntu_14.04
│ ├── Dockerfile-ubuntu_16.04
│ ├── Dockerfile-ubuntu_18.04
│ ├── Dockerfile-ubuntu_18.10
│ └── Dockerfile-ubuntu_20.04
├── Makefile.pkg
├── Makefile.repo
├── Makefile.test
├── Readme.md
├── pkg
│ ├── Makefile.alt
│ ├── Makefile.centos
│ ├── Makefile.debian
│ ├── Makefile.oraclelinux
│ ├── Makefile.rhel
│ ├── Makefile.suse
│ ├── Makefile.ubuntu
│ ├── scripts
│ │ ├── alt.sh
│ │ ├── deb.sh
│ │ ├── rpm.sh
│ │ └── suse.sh
│ ├── specs
│ │ ├── deb
│ │ │ └── pg_probackup
│ │ │ │ └── debian
│ │ │ │ ├── changelog
│ │ │ │ ├── compat
│ │ │ │ ├── control
│ │ │ │ ├── pg_probackup.install
│ │ │ │ ├── rules
│ │ │ │ └── source
│ │ │ │ └── format
│ │ └── rpm
│ │ │ └── rpmbuild
│ │ │ ├── SOURCES
│ │ │ ├── GPG-KEY-PG_PROBACKUP
│ │ │ ├── GPG-KEY-PG_PROBACKUP-FORKS
│ │ │ ├── pg_probackup-forks.repo
│ │ │ └── pg_probackup.repo
│ │ │ └── SPECS
│ │ │ ├── pg_probackup-pgpro.spec
│ │ │ ├── pg_probackup-repo-forks.spec
│ │ │ ├── pg_probackup-repo.spec
│ │ │ ├── pg_probackup.alt.forks.spec
│ │ │ ├── pg_probackup.alt.spec
│ │ │ └── pg_probackup.spec
│ └── tarballs
│ │ └── .gitkeep
├── repo
│ ├── reprepro-conf
│ │ ├── changelog.script
│ │ └── distributions
│ ├── rpm-conf
│ │ └── rpmmacros
│ └── scripts
│ │ ├── alt.sh
│ │ ├── deb.sh
│ │ ├── rpm.sh
│ │ └── suse.sh
└── test
│ ├── Makefile.alt
│ ├── Makefile.centos
│ ├── Makefile.debian
│ ├── Makefile.oraclelinux
│ ├── Makefile.rhel
│ ├── Makefile.suse
│ ├── Makefile.ubuntu
│ └── scripts
│ ├── alt.sh
│ ├── alt_forks.sh
│ ├── deb.sh
│ ├── deb_forks.sh
│ ├── rpm.sh
│ ├── rpm_forks.sh
│ ├── suse.sh
│ └── suse_forks.sh
├── po
├── LINGUAS
└── ru.po
├── src
├── archive.c
├── backup.c
├── catalog.c
├── catchup.c
├── checkdb.c
├── configure.c
├── data.c
├── datapagemap.c
├── datapagemap.h
├── delete.c
├── dir.c
├── fetch.c
├── help.c
├── init.c
├── merge.c
├── parsexlog.c
├── pg_probackup.c
├── pg_probackup.h
├── pg_probackup_state.h
├── ptrack.c
├── restore.c
├── show.c
├── stream.c
├── util.c
├── utils
│ ├── configuration.c
│ ├── configuration.h
│ ├── file.c
│ ├── file.h
│ ├── json.c
│ ├── json.h
│ ├── logger.c
│ ├── logger.h
│ ├── parray.c
│ ├── parray.h
│ ├── pgut.c
│ ├── pgut.h
│ ├── remote.c
│ ├── remote.h
│ ├── thread.c
│ └── thread.h
└── validate.c
├── tests
├── CVE_2018_1058_test.py
├── Readme.md
├── __init__.py
├── archive_test.py
├── auth_test.py
├── backup_test.py
├── catchup_test.py
├── cfs_backup_test.py
├── cfs_catchup_test.py
├── cfs_restore_test.py
├── cfs_validate_backup_test.py
├── checkdb_test.py
├── compatibility_test.py
├── compression_test.py
├── config_test.py
├── delete_test.py
├── delta_test.py
├── exclude_test.py
├── expected
│ ├── option_help.out
│ └── option_help_ru.out
├── external_test.py
├── false_positive_test.py
├── helpers
│ ├── __init__.py
│ ├── cfs_helpers.py
│ ├── data_helpers.py
│ └── ptrack_helpers.py
├── incr_restore_test.py
├── init_test.py
├── locking_test.py
├── logging_test.py
├── merge_test.py
├── option_test.py
├── page_test.py
├── pgpro2068_test.py
├── pgpro560_test.py
├── pgpro589_test.py
├── ptrack_test.py
├── remote_test.py
├── replica_test.py
├── requirements.txt
├── restore_test.py
├── retention_test.py
├── set_backup_test.py
├── show_test.py
├── time_consuming_test.py
├── time_stamp_test.py
└── validate_test.py
└── travis
├── before-install.sh
├── before-script-user.sh
├── before-script.sh
├── install.sh
└── script.sh
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build Probackup
2 |
3 | on:
4 | push:
5 | branches:
6 | - "**"
7 | # Runs triggered by pull requests are disabled to prevent executing potentially unsafe code from public pull requests
8 | # pull_request:
9 | # branches:
10 | # - main
11 |
12 | # Allows you to run this workflow manually from the Actions tab
13 | workflow_dispatch:
14 |
15 | jobs:
16 |
17 | build-win2019:
18 |
19 | runs-on:
20 | - windows-2019
21 |
22 | env:
23 | zlib_dir: C:\dep\zlib
24 |
25 | steps:
26 |
27 | - uses: actions/checkout@v2
28 |
29 | - name: Install pacman packages
30 | run: |
31 | $env:PATH += ";C:\msys64\usr\bin"
32 | pacman -S --noconfirm --needed bison flex
33 |
34 | - name: Make zlib
35 | run: |
36 | git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib.git
37 | cd zlib
38 | cmake -DCMAKE_INSTALL_PREFIX:PATH=C:\dep\zlib -G "Visual Studio 16 2019" .
39 | cmake --build . --config Release --target ALL_BUILD
40 | cmake --build . --config Release --target INSTALL
41 | copy C:\dep\zlib\lib\zlibstatic.lib C:\dep\zlib\lib\zdll.lib
42 | copy C:\dep\zlib\bin\zlib.dll C:\dep\zlib\lib
43 |
44 | - name: Get Postgres sources
45 | run: git clone -b REL_14_STABLE https://github.com/postgres/postgres.git
46 |
47 | # Copy ptrack to contrib to build the ptrack extension
48 | # Convert line breaks in the patch file to LF otherwise the patch doesn't apply
49 | - name: Get Ptrack sources
50 | run: |
51 | git clone -b master --depth 1 https://github.com/postgrespro/ptrack.git
52 | Copy-Item -Path ptrack -Destination postgres\contrib -Recurse
53 | (Get-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Raw).Replace("`r`n","`n") | Set-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Force -NoNewline
54 | cd postgres
55 | git apply -3 ../ptrack/patches/REL_14_STABLE-ptrack-core.diff
56 |
57 | - name: Build Postgres
58 | run: |
59 | $env:PATH += ";C:\msys64\usr\bin"
60 | cd postgres\src\tools\msvc
61 | (Get-Content config_default.pl) -Replace "zlib *=>(.*?)(?=,? *#)", "zlib => '${{ env.zlib_dir }}'" | Set-Content config.pl
62 | cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && .\build.bat"
63 |
64 | - name: Build Probackup
65 | run: cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && perl .\gen_probackup_project.pl `"${{ github.workspace }}`"\postgres"
66 |
67 | - name: Install Postgres
68 | run: |
69 | cd postgres
70 | src\tools\msvc\install.bat postgres_install
71 |
72 | - name: Install Testgres
73 | run: |
74 | git clone -b no-port-for --single-branch --depth 1 https://github.com/postgrespro/testgres.git
75 | pip3 install psycopg2 ./testgres
76 |
77 | # Grant the Github runner user full control of the workspace for initdb to successfully process the data folder
78 | - name: Test Probackup
79 | run: |
80 | icacls.exe "${{ github.workspace }}" /grant "${env:USERNAME}:(OI)(CI)F"
81 | $env:PATH += ";${{ github.workspace }}\postgres\postgres_install\lib;${{ env.zlib_dir }}\lib"
82 | $Env:LC_MESSAGES = "English"
83 | $Env:PG_CONFIG = "${{ github.workspace }}\postgres\postgres_install\bin\pg_config.exe"
84 | $Env:PGPROBACKUPBIN = "${{ github.workspace }}\postgres\Release\pg_probackup\pg_probackup.exe"
85 | $Env:PG_PROBACKUP_PTRACK = "ON"
86 | If (!$Env:MODE -Or $Env:MODE -Eq "basic") {
87 | $Env:PG_PROBACKUP_TEST_BASIC = "ON"
88 | python -m unittest -v tests
89 | python -m unittest -v tests.init_test
90 | } else {
91 | python -m unittest -v tests.$Env:MODE
92 | }
93 |
94 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Object files
2 | *.o
3 |
4 | # Libraries
5 | *.lib
6 | *.a
7 |
8 | # Shared objects (inc. Windows DLLs)
9 | *.dll
10 | *.so
11 | *.so.*
12 | *.dylib
13 |
14 | # Executables
15 | *.exe
16 | *.app
17 |
18 | # Dependencies
19 | .deps
20 |
21 | # Binaries
22 | /pg_probackup
23 |
24 | # Generated translated file
25 | /po/ru.mo
26 |
27 | # Generated by test suite
28 | /regression.diffs
29 | /regression.out
30 | /results
31 | /env
32 | /tests/__pycache__/
33 | /tests/helpers/__pycache__/
34 | /tests/tmp_dirs/
35 | /tests/*pyc
36 | /tests/helpers/*pyc
37 |
38 | # Extra files
39 | /src/pg_crc.c
40 | /src/receivelog.c
41 | /src/receivelog.h
42 | /src/streamutil.c
43 | /src/streamutil.h
44 | /src/xlogreader.c
45 | /src/walmethods.c
46 | /src/walmethods.h
47 | /src/instr_time.h
48 |
49 | # Doc files
50 | /doc/*html
51 |
52 | # Docker files
53 | /docker-compose.yml
54 | /Dockerfile
55 | /Dockerfile.in
56 | /make_dockerfile.sh
57 | /backup_restore.sh
58 |
59 | # Packaging
60 | /build
61 | /packaging/pkg/tarballs/pgpro.tar.bz2
62 | /packaging/repo/pg_probackup
63 | /packaging/repo/pg_probackup-forks
64 |
65 | # Misc
66 | .python-version
67 | .vscode
68 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | os: linux
2 |
3 | dist: jammy
4 |
5 | language: c
6 |
7 | cache: ccache
8 |
9 | addons:
10 | apt:
11 | packages:
12 | - sudo
13 | - libc-dev
14 | - bison
15 | - flex
16 | - libreadline-dev
17 | - zlib1g-dev
18 | - libzstd-dev
19 | - libssl-dev
20 | - perl
21 | - libperl-dev
22 | - libdbi-perl
23 | - cpanminus
24 | - locales
25 | - python3
26 | - python3-dev
27 | - python3-pip
28 | - libicu-dev
29 | - libgss-dev
30 | - libkrb5-dev
31 | - libxml2-dev
32 | - libxslt1-dev
33 | - libldap2-dev
34 | - tcl-dev
35 | - diffutils
36 | - gdb
37 | - gettext
38 | - lcov
39 | - openssh-client
40 | - openssh-server
41 | - libipc-run-perl
42 | - libtime-hires-perl
43 | - libtimedate-perl
44 | - libdbd-pg-perl
45 |
46 | before_install:
47 | - sudo travis/before-install.sh
48 |
49 | install:
50 | - travis/install.sh
51 |
52 | before_script:
53 | - sudo travis/before-script.sh
54 | - travis/before-script-user.sh
55 |
56 | script:
57 | - travis/script.sh
58 |
59 | notifications:
60 | email:
61 | on_success: change
62 | on_failure: always
63 |
64 | # Default MODE is basic, i.e. all tests with PG_PROBACKUP_TEST_BASIC=ON
65 | env:
66 | - PG_VERSION=16 PG_BRANCH=master PTRACK_PATCH_PG_BRANCH=master
67 | - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=REL_15_STABLE
68 | - PG_VERSION=14 PG_BRANCH=REL_14_STABLE PTRACK_PATCH_PG_BRANCH=REL_14_STABLE
69 | - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE
70 | - PG_VERSION=12 PG_BRANCH=REL_12_STABLE PTRACK_PATCH_PG_BRANCH=REL_12_STABLE
71 | - PG_VERSION=11 PG_BRANCH=REL_11_STABLE PTRACK_PATCH_PG_BRANCH=REL_11_STABLE
72 | - PG_VERSION=10 PG_BRANCH=REL_10_STABLE
73 | - PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE
74 | - PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE
75 | - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup
76 | - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup_stream
77 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
78 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup
79 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=checkdb
80 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=compression
81 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta
82 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=locking
83 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=merge
84 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=option
85 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=page
86 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=ptrack
87 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=replica
88 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=retention
89 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=restore
90 | # - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=time_consuming
91 |
92 | jobs:
93 | allow_failures:
94 | - if: env(PG_BRANCH) = master
95 | - if: env(PG_BRANCH) = REL9_5_STABLE
96 | # - if: env(MODE) IN (archive, backup, delta, locking, merge, replica, retention, restore)
97 |
98 | # Only run CI for master branch commits to limit our travis usage
99 | #branches:
100 | # only:
101 | # - master
102 |
103 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015-2023, Postgres Professional
2 | Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
3 |
4 | Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
5 | Portions Copyright (c) 1994, The Regents of the University of California
6 |
7 | Permission to use, copy, modify, and distribute this software and its
8 | documentation for any purpose, without fee, and without a written agreement
9 | is hereby granted, provided that the above copyright notice and this
10 | paragraph and the following two paragraphs appear in all copies.
11 |
12 | IN NO EVENT SHALL POSTGRES PROFESSIONAL BE LIABLE TO ANY PARTY FOR
13 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
14 | LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
15 | DOCUMENTATION, EVEN IF POSTGRES PROFESSIONAL HAS BEEN ADVISED OF THE
16 | POSSIBILITY OF SUCH DAMAGE.
17 |
18 | POSTGRES PROFESSIONAL SPECIFICALLY DISCLAIMS ANY WARRANTIES,
19 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20 | AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 | ON AN "AS IS" BASIS, AND POSTGRES PROFESSIONAL HAS NO OBLIGATIONS TO
22 | PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | PROGRAM = pg_probackup
2 | WORKDIR ?= $(CURDIR)
3 | BUILDDIR = $(WORKDIR)/build/
4 | PBK_GIT_REPO = https://github.com/postgrespro/pg_probackup
5 |
6 | # utils
7 | OBJS = src/utils/configuration.o src/utils/json.o src/utils/logger.o \
8 | src/utils/parray.o src/utils/pgut.o src/utils/thread.o src/utils/remote.o src/utils/file.o
9 |
10 | OBJS += src/archive.o src/backup.o src/catalog.o src/checkdb.o src/configure.o src/data.o \
11 | src/delete.o src/dir.o src/fetch.o src/help.o src/init.o src/merge.o \
12 | src/parsexlog.o src/ptrack.o src/pg_probackup.o src/restore.o src/show.o src/stream.o \
13 | src/util.o src/validate.o src/datapagemap.o src/catchup.o
14 |
15 | # borrowed files
16 | OBJS += src/pg_crc.o src/receivelog.o src/streamutil.o \
17 | src/xlogreader.o
18 |
19 | EXTRA_CLEAN = src/pg_crc.c \
20 | src/receivelog.c src/receivelog.h src/streamutil.c src/streamutil.h \
21 | src/xlogreader.c src/instr_time.h
22 |
23 | ifdef top_srcdir
24 | srchome := $(abspath $(top_srcdir))
25 | else
26 | top_srcdir=../..
27 | ifneq (,$(wildcard ../../../contrib/pg_probackup))
28 | # separate build directory support
29 | srchome := $(abspath $(top_srcdir)/..)
30 | else
31 | srchome := $(abspath $(top_srcdir))
32 | endif
33 | endif
34 |
35 | # OBJS variable must be finally defined before invoking the include directive
36 | ifneq (,$(wildcard $(srchome)/src/bin/pg_basebackup/walmethods.c))
37 | OBJS += src/walmethods.o
38 | EXTRA_CLEAN += src/walmethods.c src/walmethods.h
39 | endif
40 |
41 | ifdef USE_PGXS
42 | PG_CONFIG = pg_config
43 | PGXS := $(shell $(PG_CONFIG) --pgxs)
44 | include $(PGXS)
45 | else
46 | subdir=contrib/pg_probackup
47 | top_builddir=../..
48 | include $(top_builddir)/src/Makefile.global
49 | include $(top_srcdir)/contrib/contrib-global.mk
50 | endif
51 |
52 | PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc -I$(srchome)/$(subdir)/src
53 | override CPPFLAGS := -DFRONTEND $(CPPFLAGS) $(PG_CPPFLAGS)
54 | PG_LIBS_INTERNAL = $(libpq_pgport) ${PTHREAD_CFLAGS}
55 |
56 | src/utils/configuration.o: src/datapagemap.h
57 | src/archive.o: src/instr_time.h
58 | src/backup.o: src/receivelog.h src/streamutil.h
59 |
60 | src/instr_time.h: $(srchome)/src/include/portability/instr_time.h
61 | rm -f $@ && $(LN_S) $(srchome)/src/include/portability/instr_time.h $@
62 | src/pg_crc.c: $(srchome)/src/backend/utils/hash/pg_crc.c
63 | rm -f $@ && $(LN_S) $(srchome)/src/backend/utils/hash/pg_crc.c $@
64 | src/receivelog.c: $(srchome)/src/bin/pg_basebackup/receivelog.c
65 | rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/receivelog.c $@
66 | ifneq (,$(wildcard $(srchome)/src/bin/pg_basebackup/walmethods.c))
67 | src/receivelog.h: src/walmethods.h $(srchome)/src/bin/pg_basebackup/receivelog.h
68 | else
69 | src/receivelog.h: $(srchome)/src/bin/pg_basebackup/receivelog.h
70 | endif
71 | rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/receivelog.h $@
72 | src/streamutil.c: $(srchome)/src/bin/pg_basebackup/streamutil.c
73 | rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/streamutil.c $@
74 | src/streamutil.h: $(srchome)/src/bin/pg_basebackup/streamutil.h
75 | rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/streamutil.h $@
76 | src/xlogreader.c: $(srchome)/src/backend/access/transam/xlogreader.c
77 | rm -f $@ && $(LN_S) $(srchome)/src/backend/access/transam/xlogreader.c $@
78 | src/walmethods.c: $(srchome)/src/bin/pg_basebackup/walmethods.c
79 | rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/walmethods.c $@
80 | src/walmethods.h: $(srchome)/src/bin/pg_basebackup/walmethods.h
81 | rm -f $@ && $(LN_S) $(srchome)/src/bin/pg_basebackup/walmethods.h $@
82 |
83 | ifeq ($(PORTNAME), aix)
84 | CC=xlc_r
85 | endif
86 |
87 | include packaging/Makefile.pkg
88 | include packaging/Makefile.repo
89 | include packaging/Makefile.test
90 |
--------------------------------------------------------------------------------
/doc/Readme.md:
--------------------------------------------------------------------------------
1 | # Generating documentation
2 | ```
3 | xmllint --noout --valid probackup.xml
4 | xsltproc stylesheet.xsl probackup.xml >pg-probackup.html
5 | ```
6 | > [!NOTE]
7 | >Install ```docbook-xsl``` if you got
8 | >``` "xsl:import : unable to load http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"```
--------------------------------------------------------------------------------
/doc/probackup.xml:
--------------------------------------------------------------------------------
1 |
5 | ]>
6 |
7 |
8 |
9 | pg_probackup Documentation
10 | &pgprobackup;
11 |
12 |
--------------------------------------------------------------------------------
/doc/stylesheet.xsl:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | book/reference toc, title
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/gen_probackup_project.pl:
--------------------------------------------------------------------------------
1 | # -*-perl-*- hey - emacs - this is a perl file
2 | # my $currpath = cwd();
3 |
4 | our $pgsrc;
5 | our $currpath;
6 |
7 | BEGIN {
8 | # path to the pg_probackup dir
9 | $currpath = File::Basename::dirname(Cwd::abs_path($0));
10 | use Cwd;
11 | use File::Basename;
12 | if (($#ARGV+1)==1)
13 | {
14 | $pgsrc = shift @ARGV;
15 | if($pgsrc eq "--help"){
16 | print STDERR "Usage $0 pg-source-dir\n";
17 | print STDERR "Like this:\n";
18 | print STDERR "$0 C:/PgProject/postgresql.10dev/postgrespro\n";
19 | print STDERR "May need to run this first:\n";
20 | print STDERR "CALL \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" amd64\n";
21 | exit 1;
22 | }
23 | }
24 | else
25 | {
26 | use Cwd qw(abs_path);
27 | my $path = dirname(abs_path($0));
28 | chdir($path);
29 | chdir("../..");
30 | $pgsrc = cwd();
31 | $currpath = "contrib/pg_probackup";
32 | }
33 | chdir("$pgsrc/src/tools/msvc");
34 | push(@INC, "$pgsrc/src/tools/msvc");
35 | chdir("../../..") if (-d "../msvc" && -d "../../../src");
36 |
37 | }
38 | use Win32;
39 | use Carp;
40 | use strict;
41 | use warnings;
42 |
43 |
44 | use Project;
45 | use Solution;
46 | use File::Copy;
47 | use Config;
48 | use VSObjectFactory;
49 | use List::Util qw(first);
50 |
51 | use Exporter;
52 | our (@ISA, @EXPORT_OK);
53 | @ISA = qw(Exporter);
54 | @EXPORT_OK = qw(Mkvcbuild);
55 |
56 | my $solution;
57 | my $libpgport;
58 | my $libpgcommon;
59 | my $libpgfeutils;
60 | my $postgres;
61 | my $libpq;
62 | my @unlink_on_exit;
63 |
64 | if (-d "src/fe_utils")
65 | {
66 | $libpgfeutils = 1;
67 | }
68 | else
69 | {
70 | $libpgfeutils = 0;
71 | }
72 |
73 |
74 |
75 | use lib "src/tools/msvc";
76 |
77 | use Mkvcbuild;
78 |
79 | # if (-e "src/tools/msvc/buildenv.pl")
80 | # {
81 | # do "src/tools/msvc/buildenv.pl";
82 | # }
83 | # elsif (-e "./buildenv.pl")
84 | # {
85 | # do "./buildenv.pl";
86 | # }
87 |
88 | # set up the project
89 | our $config;
90 | do "config_default.pl";
91 | do "config.pl" if (-f "src/tools/msvc/config.pl");
92 |
93 | # my $vcver = Mkvcbuild::mkvcbuild($config);
94 | my $vcver = build_pgprobackup($config);
95 |
96 | # check what sort of build we are doing
97 |
98 | my $bconf = $ENV{CONFIG} || "Release";
99 | my $msbflags = $ENV{MSBFLAGS} || "";
100 | my $buildwhat = $ARGV[1] || "";
101 |
102 | # if (uc($ARGV[0]) eq 'DEBUG')
103 | # {
104 | # $bconf = "Debug";
105 | # }
106 | # elsif (uc($ARGV[0]) ne "RELEASE")
107 | # {
108 | # $buildwhat = $ARGV[0] || "";
109 | # }
110 |
111 | # printf "currpath=$currpath";
112 |
113 | # exit(0);
114 | # ... and do it
115 | system("msbuild pg_probackup.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf" );
116 |
117 | # report status
118 |
119 | my $status = $? >> 8;
120 | printf("Status: $status\n");
121 | printf("Output file built in the folder $pgsrc/$bconf/pg_probackup\n");
122 |
123 | exit $status;
124 |
125 |
126 |
127 | sub build_pgprobackup
128 | {
129 | our $config = shift;
130 |
131 | chdir('../../..') if (-d '../msvc' && -d '../../../src');
132 | die 'Must run from root or msvc directory'
133 | unless (-d 'src/tools/msvc' && -d 'src');
134 |
135 | # my $vsVersion = DetermineVisualStudioVersion();
136 | my $vsVersion = '16.00';
137 |
138 | $solution = CreateSolution($vsVersion, $config);
139 |
140 | $libpq = $solution->AddProject('libpq', 'dll', 'interfaces',
141 | 'src/interfaces/libpq');
142 | if ($libpgfeutils)
143 | {
144 | $libpgfeutils = $solution->AddProject('libpgfeutils', 'lib', 'misc');
145 | }
146 | $libpgcommon = $solution->AddProject('libpgcommon', 'lib', 'misc');
147 | $libpgport = $solution->AddProject('libpgport', 'lib', 'misc');
148 |
149 | #vvs test
150 | my $probackup =
151 | $solution->AddProject("pg_probackup", 'exe', "pg_probackup"); #, 'contrib/pg_probackup'
152 | $probackup->AddDefine('FRONTEND');
153 | $probackup->AddFiles(
154 | "$currpath/src",
155 | 'archive.c',
156 | 'backup.c',
157 | 'catalog.c',
158 | 'catchup.c',
159 | 'configure.c',
160 | 'data.c',
161 | 'delete.c',
162 | 'dir.c',
163 | 'fetch.c',
164 | 'help.c',
165 | 'init.c',
166 | 'merge.c',
167 | 'parsexlog.c',
168 | 'pg_probackup.c',
169 | 'restore.c',
170 | 'show.c',
171 | 'stream.c',
172 | 'util.c',
173 | 'validate.c',
174 | 'checkdb.c',
175 | 'ptrack.c'
176 | );
177 | $probackup->AddFiles(
178 | "$currpath/src/utils",
179 | 'configuration.c',
180 | 'file.c',
181 | 'remote.c',
182 | 'json.c',
183 | 'logger.c',
184 | 'parray.c',
185 | 'pgut.c',
186 | 'thread.c',
187 | 'remote.c'
188 | );
189 | $probackup->AddFile("$pgsrc/src/backend/access/transam/xlogreader.c");
190 | $probackup->AddFile("$pgsrc/src/backend/utils/hash/pg_crc.c");
191 | $probackup->AddFiles(
192 | "$pgsrc/src/bin/pg_basebackup",
193 | 'receivelog.c',
194 | 'streamutil.c'
195 | );
196 |
197 | if (-e "$pgsrc/src/bin/pg_basebackup/walmethods.c")
198 | {
199 | $probackup->AddFile("$pgsrc/src/bin/pg_basebackup/walmethods.c");
200 | }
201 |
202 | $probackup->AddFile("$pgsrc/src/bin/pg_rewind/datapagemap.c");
203 |
204 | $probackup->AddFile("$pgsrc/src/interfaces/libpq/pthread-win32.c");
205 | $probackup->AddFile("$pgsrc/src/timezone/strftime.c");
206 |
207 | $probackup->AddIncludeDir("$pgsrc/src/bin/pg_basebackup");
208 | $probackup->AddIncludeDir("$pgsrc/src/bin/pg_rewind");
209 | $probackup->AddIncludeDir("$pgsrc/src/interfaces/libpq");
210 | $probackup->AddIncludeDir("$pgsrc/src");
211 | $probackup->AddIncludeDir("$pgsrc/src/port");
212 | $probackup->AddIncludeDir("$pgsrc/src/include/portability");
213 |
214 | $probackup->AddIncludeDir("$currpath");
215 | $probackup->AddIncludeDir("$currpath/src");
216 | $probackup->AddIncludeDir("$currpath/src/utils");
217 |
218 | if ($libpgfeutils)
219 | {
220 | $probackup->AddReference($libpq, $libpgfeutils, $libpgcommon, $libpgport);
221 | }
222 | else
223 | {
224 | $probackup->AddReference($libpq, $libpgcommon, $libpgport);
225 | }
226 | $probackup->AddLibrary('ws2_32.lib');
227 |
228 | $probackup->Save();
229 | return $solution->{vcver};
230 |
231 | }
232 |
--------------------------------------------------------------------------------
/nls.mk:
--------------------------------------------------------------------------------
1 | # contrib/pg_probackup/nls.mk
2 | CATALOG_NAME = pg_probackup
3 | AVAIL_LANGUAGES = ru
4 | GETTEXT_FILES = src/help.c
5 | GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS)
6 | GETTEXT_FLAGS = $(FRONTEND_COMMON_GETTEXT_FLAGS)
7 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-altlinux_8:
--------------------------------------------------------------------------------
1 | FROM alt:p8
2 | RUN ulimit -n 1024 && apt-get update -y && apt-get install -y tar wget rpm-build
3 | RUN ulimit -n 1024 && apt-get install -y make perl libicu-devel glibc-devel bison flex
4 | RUN ulimit -n 1024 && apt-get install -y git perl-devel readline-devel libxml2-devel libxslt-devel python-devel zlib-devel openssl-devel libkrb5 libkrb5-devel
5 | RUN ulimit -n 1024 && apt-get upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-altlinux_9:
--------------------------------------------------------------------------------
1 | FROM alt:p9
2 | RUN ulimit -n 1024 && apt-get update -y && apt-get install -y tar wget rpm-build
3 | RUN ulimit -n 1024 && apt-get install -y make perl libicu-devel glibc-devel bison flex
4 | RUN ulimit -n 1024 && apt-get install -y git perl-devel readline-devel libxml2-devel libxslt-devel python-devel zlib-devel openssl-devel libkrb5 libkrb5-devel
5 | RUN ulimit -n 1024 && apt-get dist-upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-astra_1.11:
--------------------------------------------------------------------------------
1 | FROM pgpro/astra:1.11
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install reprepro -y
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-centos_7:
--------------------------------------------------------------------------------
1 | FROM centos:7
2 | RUN yum install -y tar wget rpm-build yum-utils
3 | RUN yum install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN yum install -y git
5 | RUN yum upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-centos_8:
--------------------------------------------------------------------------------
1 | FROM centos:8
2 | RUN yum install -y tar wget rpm-build yum-utils
3 | RUN yum install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN yum install -y git
5 | RUN yum upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-createrepo1C:
--------------------------------------------------------------------------------
1 | FROM ubuntu:17.10
2 | RUN apt-get -qq update -y
3 | RUN apt-get -qq install -y reprepro rpm createrepo gnupg rsync perl less wget expect rsync dpkg-dev
4 | RUN apt-get upgrade -y
5 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-debian_10:
--------------------------------------------------------------------------------
1 | FROM debian:10
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-debian_11:
--------------------------------------------------------------------------------
1 | FROM debian:11
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-debian_8:
--------------------------------------------------------------------------------
1 | FROM debian:8
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-debian_9:
--------------------------------------------------------------------------------
1 | FROM debian:9
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-oraclelinux_6:
--------------------------------------------------------------------------------
1 | FROM oraclelinux:6
2 | RUN yum install -y tar wget rpm-build yum-utils
3 | RUN yum install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN yum install -y git openssl
5 | RUN yum upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-oraclelinux_7:
--------------------------------------------------------------------------------
1 | FROM oraclelinux:7
2 | RUN yum install -y tar wget rpm-build yum-utils
3 | RUN yum install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN yum install -y git openssl
5 | RUN yum upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-oraclelinux_8:
--------------------------------------------------------------------------------
1 | FROM oraclelinux:8
2 | RUN yum install -y tar wget rpm-build yum-utils
3 | RUN yum install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN yum install -y git openssl
5 | RUN yum upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-rhel_7:
--------------------------------------------------------------------------------
1 | FROM registry.access.redhat.com/ubi7
2 | RUN yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/elfutils-0.176-5.el7.x86_64.rpm
3 | RUN yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/rpm-build-4.11.3-45.el7.x86_64.rpm
4 | RUN yum install -y tar wget yum-utils
5 | RUN yum install -y gcc make perl libicu-devel glibc-devel
6 | RUN yum install -y git
7 | RUN yum upgrade -y
8 | RUN yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/bison-3.0.4-2.el7.x86_64.rpm
9 | RUN yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/flex-2.5.37-6.el7.x86_64.rpm
10 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-rhel_8:
--------------------------------------------------------------------------------
1 | FROM registry.access.redhat.com/ubi8
2 | RUN yum install -y tar wget rpm-build yum-utils
3 | RUN yum install -y gcc make perl libicu-devel glibc-devel
4 | RUN yum install -y git
5 | RUN yum upgrade -y
6 | RUN yum install -y http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/bison-3.0.4-10.el8.x86_64.rpm
7 | RUN yum install -y http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/flex-2.6.1-9.el8.x86_64.rpm
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-rosa_6:
--------------------------------------------------------------------------------
1 | FROM pgpro/rosa-6
2 | RUN yum install -y tar wget rpm-build yum-utils
3 | RUN yum install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN yum install -y git
5 | RUN yum upgrade -y
6 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-suse_15.1:
--------------------------------------------------------------------------------
1 | FROM opensuse/leap:15.1
2 | RUN ulimit -n 1024 && zypper install -y tar wget rpm-build
3 | RUN ulimit -n 1024 && zypper install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN ulimit -n 1024 && zypper install -y git rsync
5 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-suse_15.2:
--------------------------------------------------------------------------------
1 | FROM opensuse/leap:15.2
2 | RUN ulimit -n 1024 && zypper install -y tar wget rpm-build
3 | RUN ulimit -n 1024 && zypper install -y gcc make perl libicu-devel glibc-devel bison flex
4 | RUN ulimit -n 1024 && zypper install -y git rsync
5 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-ubuntu_14.04:
--------------------------------------------------------------------------------
1 | FROM ubuntu:14.04
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-ubuntu_16.04:
--------------------------------------------------------------------------------
1 | FROM ubuntu:16.04
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-ubuntu_18.04:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.04
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-ubuntu_18.10:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.10
2 | RUN apt-get update -y
3 | RUN apt-get install -y devscripts
4 | RUN apt-get install -y dpkg-dev lsb-release git equivs wget vim
5 | RUN apt-get install -y cmake bison flex libboost-all-dev
6 | RUN apt-get install -y reprepro
7 | RUN apt-get upgrade -y
8 |
--------------------------------------------------------------------------------
/packaging/Dockerfiles/Dockerfile-ubuntu_20.04:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 | ENV DEBIAN_FRONTEND noninteractive
3 | RUN ulimit -n 1024 && apt-get update -y
4 | RUN ulimit -n 1024 && apt-get install -y devscripts
5 | RUN ulimit -n 1024 && apt-get install -y dpkg-dev lsb-release git equivs wget vim
6 | RUN ulimit -n 1024 && apt-get install -y cmake bison flex libboost-all-dev
7 | RUN ulimit -n 1024 && apt-get install -y reprepro
8 | RUN ulimit -n 1024 && apt-get upgrade -y
9 |
--------------------------------------------------------------------------------
/packaging/Makefile.repo:
--------------------------------------------------------------------------------
1 | #### REPO BUILD ####
2 | repo: check_env repo/debian repo/ubuntu repo/centos repo/oraclelinux repo/rhel repo/alt repo/suse repo_finish
3 | @echo Build repo for all platform: done
4 |
5 | # Debian
6 | repo/debian: build/repo_debian_9 build/repo_debian_10 build/repo_debian_11
7 | @echo Build repo for debian platforms: done
8 |
9 | build/repo_debian_9:
10 | $(call build_repo_deb,debian,9,stretch)
11 | touch build/repo_debian_9
12 |
13 | build/repo_debian_10:
14 | $(call build_repo_deb,debian,10,buster)
15 | touch build/repo_debian_10
16 |
17 | build/repo_debian_11:
18 | $(call build_repo_deb,debian,11,bullseye)
19 | touch build/repo_debian_11
20 |
21 | # Ubuntu
22 | repo/ubuntu: build/repo_ubuntu_18.04 build/repo_ubuntu_20.04
23 | @echo Build repo for ubuntu platforms: done
24 |
25 | build/repo_ubuntu_18.04:
26 | $(call build_repo_deb,ubuntu,18.04,bionic)
27 | touch build/repo_ubuntu_18.04
28 |
29 | build/repo_ubuntu_20.04:
30 | $(call build_repo_deb,ubuntu,20.04,focal)
31 | touch build/repo_ubuntu_20.04
32 |
33 | # Centos
34 | repo/centos: build/repo_centos_7 build/repo_centos_8
35 | @echo Build repo for centos platforms: done
36 |
37 | build/repo_centos_7:
38 | $(call build_repo_rpm,centos,7,,)
39 | touch build/repo_centos_7
40 |
41 | build/repo_centos_8:
42 | $(call build_repo_rpm,centos,8,,)
43 | touch build/repo_centos_8
44 |
45 | # Oraclelinux
46 | repo/oraclelinux: build/repo_oraclelinux_6 build/repo_oraclelinux_7 build/repo_oraclelinux_8
47 | @echo Build repo for oraclelinux platforms: done
48 |
49 | build/repo_oraclelinux_6:
50 | $(call build_repo_rpm,oraclelinux,6,6Server)
51 | touch build/repo_oraclelinux_6
52 |
53 | build/repo_oraclelinux_7:
54 | $(call build_repo_rpm,oraclelinux,7,7Server)
55 | touch build/repo_oraclelinux_7
56 |
57 | build/repo_oraclelinux_8:
58 | $(call build_repo_rpm,oraclelinux,8,,)
59 | touch build/repo_oraclelinux_8
60 |
61 | # RHEL
62 | repo/rhel: build/repo_rhel_7 build/repo_rhel_8
63 | @echo Build repo for rhel platforms: done
64 |
65 | build/repo_rhel_7:
66 | $(call build_repo_rpm,rhel,7,7Server)
67 | touch build/repo_rhel_7
68 |
69 | build/repo_rhel_8:
70 | $(call build_repo_rpm,rhel,8,,)
71 | touch build/repo_rhel_8
72 |
73 | # ALT
74 | repo/alt: build/repo_alt_7 build/repo_alt_8 build/repo_alt_9
75 | @echo Build repo for alt platforms: done
76 |
77 | build/repo_alt_7:
78 | $(call build_repo_alt,alt,7,,)
79 | touch build/repo_alt_7
80 |
81 | build/repo_alt_8:
82 | $(call build_repo_alt,alt,8,,)
83 | touch build/repo_alt_8
84 |
85 | build/repo_alt_9:
86 | $(call build_repo_alt,alt,9,,)
87 | touch build/repo_alt_9
88 |
89 | # SUSE
90 | repo/suse: build/repo_suse_15.1 build/repo_suse_15.2
91 | @echo Build repo for suse platforms: done
92 |
93 | build/repo_suse_15.1:
94 | $(call build_repo_suse,suse,15.1,,)
95 | touch build/repo_suse_15.1
96 |
97 | build/repo_suse_15.2:
98 | $(call build_repo_suse,suse,15.2,,)
99 | touch build/repo_suse_15.2
100 |
101 | repo_finish:
102 | # cd build/data/www/$(PBK_PKG_REPO)/
103 | cd $(BUILDDIR)/data/www/$(PBK_PKG_REPO)/rpm && sudo ln -nsf $(PBK_VERSION) latest
104 | # following line only for vanilla
105 | cd $(BUILDDIR)/data/www/$(PBK_PKG_REPO)/srpm && sudo ln -nsf $(PBK_VERSION) latest
106 |
107 | # sudo ln -rfs build/data/www/$(PBK_PKG_REPO)/rpm/${PBK_VERSION} build/data/www/$(PBK_PKG_REPO)/rpm/latest
108 | # sudo ln -rfs build/data/www/$(PBK_PKG_REPO)/srpm/${PBK_VERSION} build/data/www/$(PBK_PKG_REPO)/srpm/latest
109 |
110 | define build_repo_deb
111 | docker rm -f $1_$2_pbk_repo >> /dev/null 2>&1 ; \
112 | docker run \
113 | -v $(WORKDIR)/packaging/repo:/app/repo \
114 | -v $(WORKDIR)/build/data/www:/app/www \
115 | -v $(WORKDIR)/build/data/$(PBK_PKG_REPO)/$1/$2:/app/in \
116 | -e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" -e "CODENAME=$3" \
117 | -e "PBK_PKG_REPO=$(PBK_PKG_REPO)" -e "PBK_EDITION=$(PBK_EDITION)" \
118 | --name $1_$2_pbk_repo \
119 | --rm pgpro/repo /app/repo/scripts/deb.sh
120 | endef
121 |
122 | define build_repo_rpm
123 | docker rm -f $1_$2_pbk_repo >> /dev/null 2>&1 ; \
124 | docker run \
125 | -v $(WORKDIR)/packaging/repo:/app/repo \
126 | -v $(WORKDIR)/build/data/www:/app/www \
127 | -v $(WORKDIR)/build/data/$(PBK_PKG_REPO)/$1/$2:/app/in \
128 | -e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" -e "CODENAME=$3" \
129 | -e "PBK_PKG_REPO=$(PBK_PKG_REPO)" -e "PBK_EDITION=$(PBK_EDITION)" \
130 | --name $1_$2_pbk_repo \
131 | --rm pgpro/repo /app/repo/scripts/rpm.sh
132 | endef
133 |
134 | define build_repo_alt
135 | docker rm -f $1_$2_pbk_repo >> /dev/null 2>&1 ; \
136 | docker run \
137 | -v $(WORKDIR)/packaging/repo:/app/repo \
138 | -v $(WORKDIR)/build/data/www:/app/www \
139 | -v $(WORKDIR)/build/data/$(PBK_PKG_REPO)/$1/$2:/app/in \
140 | -e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" -e "CODENAME=$3" \
141 | -e "PBK_PKG_REPO=$(PBK_PKG_REPO)" -e "PBK_EDITION=$(PBK_EDITION)" \
142 | --name $1_$2_pbk_repo \
143 | --rm pgpro/$1:$2 /app/repo/scripts/alt.sh
144 | endef
145 |
146 | define build_repo_suse
147 | docker rm -f $1_$2_pbk_repo >> /dev/null 2>&1 ; \
148 | docker run \
149 | -v $(WORKDIR)/packaging/repo:/app/repo \
150 | -v $(WORKDIR)/build/data/www:/app/www \
151 | -v $(WORKDIR)/build/data/$(PBK_PKG_REPO)/$1/$2:/app/in \
152 | -e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" -e "CODENAME=$3" \
153 | -e "PBK_PKG_REPO=$(PBK_PKG_REPO)" -e "PBK_EDITION=$(PBK_EDITION)" \
154 | --name $1_$2_pbk_repo \
155 | --rm pgpro/$1:$2 /app/repo/scripts/suse.sh
156 | endef
157 |
--------------------------------------------------------------------------------
/packaging/Readme.md:
--------------------------------------------------------------------------------
1 | Example:
2 | ```
3 | export PBK_VERSION=2.4.17
4 | export PBK_HASH=57f871accce2604
5 | export PBK_RELEASE=1
6 | export PBK_EDITION=std|ent
7 | make --keep-going pkg
8 | ```
9 |
10 | To build binaries for PostgresPro Standard or Enterprise, a pgpro.tar.bz2 with latest git tree must be preset in `packaging/pkg/tarballs` directory:
11 | ```
12 | cd packaging/pkg/tarballs
13 | git clone pgpro_repo pgpro
14 | tar -cjSf pgpro.tar.bz2 pgpro
15 | ```
16 |
17 | To build repo the gpg keys for package signing must be present ...
18 | Repo must be build using 1 thread (due to debian bullshit):
19 | ```
20 | make repo -j1
21 | ```
22 |
23 |
24 |
--------------------------------------------------------------------------------
/packaging/pkg/Makefile.alt:
--------------------------------------------------------------------------------
1 | # ALT 7
2 | build/alt_7_9.5:
3 | $(call build_alt,alt,7,,9.5,9.5.25)
4 | touch build/alt_7_9.5
5 |
6 | build/alt_7_9.6:
7 | $(call build_alt,alt,7,,9.6,9.6.24)
8 | touch build/alt_7_9.6
9 |
10 | build/alt_7_10:
11 | $(call build_alt,alt,7,,10,10.19)
12 | touch build/alt_7_10
13 |
14 | build/alt_7_11:
15 | $(call build_alt,alt,7,,11,11.14)
16 | touch build/alt_7_11
17 |
18 | build/alt_7_12:
19 | $(call build_alt,alt,7,,12,12.9)
20 | touch build/alt_7_12
21 |
22 | build/alt_7_13:
23 | $(call build_alt,alt,7,,13,13.5)
24 | touch build/alt_7_13
25 |
26 | build/alt_7_14:
27 | $(call build_alt,alt,7,,14,14.1)
28 | touch build/alt_7_14
29 |
30 | # ALT 8
31 | build/alt_8_9.5:
32 | $(call build_alt,alt,8,,9.5,9.5.25)
33 | touch build/alt_8_9.5
34 |
35 | build/alt_8_9.6:
36 | $(call build_alt,alt,8,,9.6,9.6.24)
37 | touch build/alt_8_9.6
38 |
39 | build/alt_8_10:
40 | $(call build_alt,alt,8,,10,10.19)
41 | touch build/alt_8_10
42 |
43 | build/alt_8_11:
44 | $(call build_alt,alt,8,,11,11.14)
45 | touch build/alt_8_11
46 |
47 | build/alt_8_12:
48 | $(call build_alt,alt,8,,12,12.9)
49 | touch build/alt_8_12
50 |
51 | build/alt_8_13:
52 | $(call build_alt,alt,8,,13,13.5)
53 | touch build/alt_8_13
54 |
55 | build/alt_8_14:
56 | $(call build_alt,alt,8,,14,14.1)
57 | touch build/alt_8_14
58 |
59 | # ALT 9
60 | build/alt_9_9.5:
61 | $(call build_alt,alt,9,,9.5,9.5.25)
62 | touch build/alt_9_9.5
63 |
64 | build/alt_9_9.6:
65 | $(call build_alt,alt,9,,9.6,9.6.24)
66 | touch build/alt_9_9.6
67 |
68 | build/alt_9_10:
69 | $(call build_alt,alt,9,,10,10.19)
70 | touch build/alt_9_10
71 |
72 | build/alt_9_11:
73 | $(call build_alt,alt,9,,11,11.14)
74 | touch build/alt_9_11
75 |
76 | build/alt_9_12:
77 | $(call build_alt,alt,9,,12,12.9)
78 | touch build/alt_9_12
79 |
80 | build/alt_9_13:
81 | $(call build_alt,alt,9,,13,13.5)
82 | touch build/alt_9_13
83 |
84 | build/alt_9_14:
85 | $(call build_alt,alt,9,,14,14.1)
86 | touch build/alt_9_14
87 |
88 |
--------------------------------------------------------------------------------
/packaging/pkg/Makefile.centos:
--------------------------------------------------------------------------------
1 | # CENTOS 7
2 | build/centos_7_9.5:
3 | $(call build_rpm,centos,7,,9.5,9.5.25)
4 | touch build/centos_7_9.5
5 |
6 | build/centos_7_9.6:
7 | $(call build_rpm,centos,7,,9.6,9.6.24)
8 | touch build/centos_7_9.6
9 |
10 | build/centos_7_10:
11 | $(call build_rpm,centos,7,,10,10.19)
12 | touch build/centos_7_10
13 |
14 | build/centos_7_11:
15 | $(call build_rpm,centos,7,,11,11.14)
16 | touch build/centos_7_11
17 |
18 | build/centos_7_12:
19 | $(call build_rpm,centos,7,,12,12.9)
20 | touch build/centos_7_12
21 |
22 | build/centos_7_13:
23 | $(call build_rpm,centos,7,,13,13.5)
24 | touch build/centos_7_13
25 |
26 | build/centos_7_14:
27 | $(call build_rpm,centos,7,,14,14.1)
28 | touch build/centos_7_14
29 |
30 | # CENTOS 8
31 | build/centos_8_9.5:
32 | $(call build_rpm,centos,8,,9.5,9.5.25)
33 | touch build/centos_8_9.5
34 |
35 | build/centos_8_9.6:
36 | $(call build_rpm,centos,8,,9.6,9.6.24)
37 | touch build/centos_8_9.6
38 |
39 | build/centos_8_10:
40 | $(call build_rpm,centos,8,,10,10.19)
41 | touch build/centos_8_10
42 |
43 | build/centos_8_11:
44 | $(call build_rpm,centos,8,,11,11.14)
45 | touch build/centos_8_11
46 |
47 | build/centos_8_12:
48 | $(call build_rpm,centos,8,,12,12.9)
49 | touch build/centos_8_12
50 |
51 | build/centos_8_13:
52 | $(call build_rpm,centos,8,,13,13.5)
53 | touch build/centos_8_13
54 |
55 | build/centos_8_14:
56 | $(call build_rpm,centos,8,,14,14.1)
57 | touch build/centos_8_14
58 |
--------------------------------------------------------------------------------
/packaging/pkg/Makefile.debian:
--------------------------------------------------------------------------------
1 | # DEBIAN 9
2 | build/debian_9_9.5:
3 | $(call build_deb,debian,9,stretch,9.5,9.5.25)
4 | touch build/debian_9_9.5
5 |
6 | build/debian_9_9.6:
7 | $(call build_deb,debian,9,stretch,9.6,9.6.24)
8 | touch build/debian_9_9.6
9 |
10 | build/debian_9_10:
11 | $(call build_deb,debian,9,stretch,10,10.19)
12 | touch build/debian_9_10
13 |
14 | build/debian_9_11:
15 | $(call build_deb,debian,9,stretch,11,11.14)
16 | touch build/debian_9_11
17 |
18 | build/debian_9_12:
19 | $(call build_deb,debian,9,stretch,12,12.9)
20 | touch build/debian_9_12
21 |
22 | build/debian_9_13:
23 | $(call build_deb,debian,9,stretch,13,13.5)
24 | touch build/debian_9_13
25 |
26 | build/debian_9_14:
27 | $(call build_deb,debian,9,stretch,14,14.1)
28 | touch build/debian_9_14
29 |
30 | # DEBIAN 10
31 | build/debian_10_9.5:
32 | $(call build_deb,debian,10,buster,9.5,9.5.25)
33 | touch build/debian_10_9.5
34 |
35 | build/debian_10_9.6:
36 | $(call build_deb,debian,10,buster,9.6,9.6.24)
37 | touch build/debian_10_9.6
38 |
39 | build/debian_10_10:
40 | $(call build_deb,debian,10,buster,10,10.19)
41 | touch build/debian_10_10
42 |
43 | build/debian_10_11:
44 | $(call build_deb,debian,10,buster,11,11.14)
45 | touch build/debian_10_11
46 |
47 | build/debian_10_12:
48 | $(call build_deb,debian,10,buster,12,12.9)
49 | touch build/debian_10_12
50 |
51 | build/debian_10_13:
52 | $(call build_deb,debian,10,buster,13,13.5)
53 | touch build/debian_10_13
54 |
55 | build/debian_10_14:
56 | $(call build_deb,debian,10,buster,14,14.1)
57 | touch build/debian_10_14
58 |
59 | # DEBIAN 11
60 | build/debian_11_9.5:
61 | $(call build_deb,debian,11,bullseye,9.5,9.5.25)
62 | touch build/debian_11_9.5
63 |
64 | build/debian_11_9.6:
65 | $(call build_deb,debian,11,bullseye,9.6,9.6.24)
66 | touch build/debian_11_9.6
67 |
68 | build/debian_11_10:
69 | $(call build_deb,debian,11,bullseye,10,10.19)
70 | touch build/debian_11_10
71 |
72 | build/debian_11_11:
73 | $(call build_deb,debian,11,bullseye,11,11.14)
74 | touch build/debian_11_11
75 |
76 | build/debian_11_12:
77 | $(call build_deb,debian,11,bullseye,12,12.9)
78 | touch build/debian_11_12
79 |
80 | build/debian_11_13:
81 | $(call build_deb,debian,11,bullseye,13,13.5)
82 | touch build/debian_11_13
83 |
84 | build/debian_11_14:
85 | $(call build_deb,debian,11,bullseye,14,14.1)
86 | touch build/debian_11_14
87 |
--------------------------------------------------------------------------------
/packaging/pkg/Makefile.oraclelinux:
--------------------------------------------------------------------------------
1 | # ORACLE LINUX 6
2 | build/oraclelinux_6_9.5:
3 | $(call build_rpm,oraclelinux,6,,9.5,9.5.25)
4 | touch build/oraclelinux_6_9.5
5 |
6 | build/oraclelinux_6_9.6:
7 | $(call build_rpm,oraclelinux,6,,9.6,9.6.24)
8 | touch build/oraclelinux_6_9.6
9 |
10 | build/oraclelinux_6_10:
11 | $(call build_rpm,oraclelinux,6,,10,10.19)
12 | touch build/oraclelinux_6_10
13 |
14 | build/oraclelinux_6_11:
15 | $(call build_rpm,oraclelinux,6,,11,11.14)
16 | touch build/oraclelinux_6_11
17 |
18 | build/oraclelinux_6_12:
19 | $(call build_rpm,oraclelinux,6,,12,12.9)
20 | touch build/oraclelinux_6_12
21 |
22 | build/oraclelinux_6_13:
23 | $(call build_rpm,oraclelinux,6,,13,13.5)
24 | touch build/oraclelinux_6_13
25 |
26 | build/oraclelinux_6_14:
27 | $(call build_rpm,oraclelinux,6,,14,14.1)
28 | touch build/oraclelinux_6_14
29 |
30 | # ORACLE LINUX 7
31 | build/oraclelinux_7_9.5:
32 | $(call build_rpm,oraclelinux,7,,9.5,9.5.25)
33 | touch build/oraclelinux_7_9.5
34 |
35 | build/oraclelinux_7_9.6:
36 | $(call build_rpm,oraclelinux,7,,9.6,9.6.24)
37 | touch build/oraclelinux_7_9.6
38 |
39 | build/oraclelinux_7_10:
40 | $(call build_rpm,oraclelinux,7,,10,10.19)
41 | touch build/oraclelinux_7_10
42 |
43 | build/oraclelinux_7_11:
44 | $(call build_rpm,oraclelinux,7,,11,11.14)
45 | touch build/oraclelinux_7_11
46 |
47 | build/oraclelinux_7_12:
48 | $(call build_rpm,oraclelinux,7,,12,12.9)
49 | touch build/oraclelinux_7_12
50 |
51 | build/oraclelinux_7_13:
52 | $(call build_rpm,oraclelinux,7,,13,13.5)
53 | touch build/oraclelinux_7_13
54 |
55 | build/oraclelinux_7_14:
56 | $(call build_rpm,oraclelinux,7,,14,14.1)
57 | touch build/oraclelinux_7_14
58 |
59 | # ORACLE LINUX 8
60 | build/oraclelinux_8_9.5:
61 | $(call build_rpm,oraclelinux,8,,9.5,9.5.25)
62 | touch build/oraclelinux_8_9.5
63 |
64 | build/oraclelinux_8_9.6:
65 | $(call build_rpm,oraclelinux,8,,9.6,9.6.24)
66 | touch build/oraclelinux_8_9.6
67 |
68 | build/oraclelinux_8_10:
69 | $(call build_rpm,oraclelinux,8,,10,10.19)
70 | touch build/oraclelinux_8_10
71 |
72 | build/oraclelinux_8_11:
73 | $(call build_rpm,oraclelinux,8,,11,11.14)
74 | touch build/oraclelinux_8_11
75 |
76 | build/oraclelinux_8_12:
77 | $(call build_rpm,oraclelinux,8,,12,12.9)
78 | touch build/oraclelinux_8_12
79 |
80 | build/oraclelinux_8_13:
81 | $(call build_rpm,oraclelinux,8,,13,13.5)
82 | touch build/oraclelinux_8_13
83 |
84 | build/oraclelinux_8_14:
85 | $(call build_rpm,oraclelinux,8,,14,14.1)
86 | touch build/oraclelinux_8_14
87 |
88 |
--------------------------------------------------------------------------------
/packaging/pkg/Makefile.rhel:
--------------------------------------------------------------------------------
1 | # RHEL 7
2 | build/rhel_7_9.5:
3 | $(call build_rpm,rhel,7,7Server,9.5,9.5.25)
4 | touch build/rhel_7_9.5
5 |
6 | build/rhel_7_9.6:
7 | $(call build_rpm,rhel,7,7Server,9.6,9.6.24)
8 | touch build/rhel_7_9.6
9 |
10 | build/rhel_7_10:
11 | $(call build_rpm,rhel,7,7Server,10,10.19)
12 | touch build/rhel_7_10
13 |
14 | build/rhel_7_11:
15 | $(call build_rpm,rhel,7,7Server,11,11.14)
16 | touch build/rhel_7_11
17 |
18 | build/rhel_7_12:
19 | $(call build_rpm,rhel,7,7Server,12,12.9)
20 | touch build/rhel_7_12
21 |
22 | build/rhel_7_13:
23 | $(call build_rpm,rhel,7,7Server,13,13.5)
24 | touch build/rhel_7_13
25 |
26 | build/rhel_7_14:
27 | $(call build_rpm,rhel,7,7Server,14,14.1)
28 | touch build/rhel_7_14
29 |
30 | # RHEL 8
31 | build/rhel_8_9.5:
32 | $(call build_rpm,rhel,8,8Server,9.5,9.5.25)
33 | touch build/rhel_8_9.5
34 |
35 | build/rhel_8_9.6:
36 | $(call build_rpm,rhel,8,8Server,9.6,9.6.24)
37 | touch build/rhel_8_9.6
38 |
39 | build/rhel_8_10:
40 | $(call build_rpm,rhel,8,8Server,10,10.19)
41 | touch build/rhel_8_10
42 |
43 | build/rhel_8_11:
44 | $(call build_rpm,rhel,8,8Server,11,11.14)
45 | touch build/rhel_8_11
46 |
47 | build/rhel_8_12:
48 | $(call build_rpm,rhel,8,8Server,12,12.9)
49 | touch build/rhel_8_12
50 |
51 | build/rhel_8_13:
52 | $(call build_rpm,rhel,8,8Server,13,13.5)
53 | touch build/rhel_8_13
54 |
55 | build/rhel_8_14:
56 | $(call build_rpm,rhel,8,8Server,14,14.1)
57 | touch build/rhel_8_14
58 |
--------------------------------------------------------------------------------
/packaging/pkg/Makefile.suse:
--------------------------------------------------------------------------------
1 | # Suse 15.1
2 | build/suse_15.1_9.5:
3 | $(call build_suse,suse,15.1,,9.5,9.5.25)
4 | touch build/suse_15.1_9.5
5 |
6 | build/suse_15.1_9.6:
7 | $(call build_suse,suse,15.1,,9.6,9.6.24)
8 | touch build/suse_15.1_9.6
9 |
10 | build/suse_15.1_10:
11 | $(call build_suse,suse,15.1,,10,10.19)
12 | touch build/suse_15.1_10
13 |
14 | build/suse_15.1_11:
15 | $(call build_suse,suse,15.1,,11,11.14)
16 | touch build/suse_15.1_11
17 |
18 | build/suse_15.1_12:
19 | $(call build_suse,suse,15.1,,12,12.9)
20 | touch build/suse_15.1_12
21 |
22 | build/suse_15.1_13:
23 | $(call build_suse,suse,15.1,,13,13.5)
24 | touch build/suse_15.1_13
25 |
26 | build/suse_15.1_14:
27 | $(call build_suse,suse,15.1,,14,14.1)
28 | touch build/suse_15.1_14
29 |
30 | # Suse 15.2
31 | build/suse_15.2_9.5:
32 | $(call build_suse,suse,15.2,,9.5,9.5.25)
33 | touch build/suse_15.2_9.5
34 |
35 | build/suse_15.2_9.6:
36 | $(call build_suse,suse,15.2,,9.6,9.6.24)
37 | touch build/suse_15.2_9.6
38 |
39 | build/suse_15.2_10:
40 | $(call build_suse,suse,15.2,,10,10.19)
41 | touch build/suse_15.2_10
42 |
43 | build/suse_15.2_11:
44 | $(call build_suse,suse,15.2,,11,11.14)
45 | touch build/suse_15.2_11
46 |
47 | build/suse_15.2_12:
48 | $(call build_suse,suse,15.2,,12,12.9)
49 | touch build/suse_15.2_12
50 |
51 | build/suse_15.2_13:
52 | $(call build_suse,suse,15.2,,13,13.5)
53 | touch build/suse_15.2_13
54 |
55 | build/suse_15.2_14:
56 | $(call build_suse,suse,15.2,,14,14.1)
57 | touch build/suse_15.2_14
58 |
--------------------------------------------------------------------------------
/packaging/pkg/Makefile.ubuntu:
--------------------------------------------------------------------------------
1 | # UBUNTU 20.04
2 | build/ubuntu_20.04_9.5:
3 | $(call build_deb,ubuntu,20.04,focal,9.5,9.5.25)
4 | touch build/ubuntu_20.04_9.5
5 |
6 | build/ubuntu_20.04_9.6:
7 | $(call build_deb,ubuntu,20.04,focal,9.6,9.6.24)
8 | touch build/ubuntu_20.04_9.6
9 |
10 | build/ubuntu_20.04_10:
11 | $(call build_deb,ubuntu,20.04,focal,10,10.19)
12 | touch build/ubuntu_20.04_10
13 |
14 | build/ubuntu_20.04_11:
15 | $(call build_deb,ubuntu,20.04,focal,11,11.14)
16 | touch build/ubuntu_20.04_11
17 |
18 | build/ubuntu_20.04_12:
19 | $(call build_deb,ubuntu,20.04,focal,12,12.9)
20 | touch build/ubuntu_20.04_12
21 |
22 | build/ubuntu_20.04_13:
23 | $(call build_deb,ubuntu,20.04,focal,13,13.5)
24 | touch build/ubuntu_20.04_13
25 |
26 | build/ubuntu_20.04_14:
27 | $(call build_deb,ubuntu,20.04,focal,14,14.1)
28 | touch build/ubuntu_20.04_14
29 |
30 | # UBUNTU 18.04
31 | build/ubuntu_18.04_9.5:
32 | $(call build_deb,ubuntu,18.04,bionic,9.5,9.5.25)
33 | touch build/ubuntu_18.04_9.5
34 |
35 | build/ubuntu_18.04_9.6:
36 | $(call build_deb,ubuntu,18.04,bionic,9.6,9.6.24)
37 | touch build/ubuntu_18.04_9.6
38 |
39 | build/ubuntu_18.04_10:
40 | $(call build_deb,ubuntu,18.04,bionic,10,10.19)
41 | touch build/ubuntu_18.04_10
42 |
43 | build/ubuntu_18.04_11:
44 | $(call build_deb,ubuntu,18.04,bionic,11,11.14)
45 | touch build/ubuntu_18.04_11
46 |
47 | build/ubuntu_18.04_12:
48 | $(call build_deb,ubuntu,18.04,bionic,12,12.9)
49 | touch build/ubuntu_18.04_12
50 |
51 | build/ubuntu_18.04_13:
52 | $(call build_deb,ubuntu,18.04,bionic,13,13.5)
53 | touch build/ubuntu_18.04_13
54 |
55 | build/ubuntu_18.04_14:
56 | $(call build_deb,ubuntu,18.04,bionic,14,14.1)
57 | touch build/ubuntu_18.04_14
58 |
59 |
--------------------------------------------------------------------------------
/packaging/pkg/scripts/alt.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -xe
9 | set -o pipefail
10 |
11 | # THere is no std/ent packages for PG 9.5
12 | if [[ ${PG_VERSION} == '9.5' ]] && [[ ${PBK_EDITION} != '' ]] ; then
13 | exit 0
14 | fi
15 |
16 | # fix https://github.com/moby/moby/issues/23137
17 | ulimit -n 1024
18 | apt-get update -y
19 |
20 | mkdir /root/build
21 | cd /root/build
22 |
23 | # Copy rpmbuild
24 | cp -rv /app/in/specs/rpm/rpmbuild /root/
25 |
26 | # download pbk
27 | git clone $PKG_URL pg_probackup-${PKG_VERSION}
28 | cd pg_probackup-${PKG_VERSION}
29 | git checkout ${PKG_HASH}
30 | cd ..
31 |
32 | # tarball it
33 | if [[ ${PBK_EDITION} == '' ]] ; then
34 | tar -cjf pg_probackup-${PKG_VERSION}.tar.bz2 pg_probackup-${PKG_VERSION}
35 | mv pg_probackup-${PKG_VERSION}.tar.bz2 /root/rpmbuild/SOURCES
36 | rm -rf pg_probackup-${PKG_VERSION}
37 | else
38 | mv pg_probackup-${PKG_VERSION} /root/rpmbuild/SOURCES
39 | fi
40 |
41 |
42 | if [[ ${PBK_EDITION} == '' ]] ; then
43 | # Download PostgreSQL source
44 | wget -q http://ftp.postgresql.org/pub/source/v${PG_FULL_VERSION}/postgresql-${PG_FULL_VERSION}.tar.bz2 -O postgresql-${PG_VERSION}.tar.bz2
45 | mv postgresql-${PG_VERSION}.tar.bz2 /root/rpmbuild/SOURCES/
46 |
47 | else
48 | tar -xf /app/in/tarballs/pgpro.tar.bz2 -C /root/rpmbuild/SOURCES/
49 | cd /root/rpmbuild/SOURCES/pgpro
50 |
51 | PGPRO_TOC=$(echo ${PG_FULL_VERSION} | sed 's|\.|_|g')
52 | if [[ ${PBK_EDITION} == 'std' ]] ; then
53 | git checkout "PGPRO${PGPRO_TOC}_1"
54 | else
55 | git checkout "PGPROEE${PGPRO_TOC}_1"
56 | fi
57 | rm -rf .git
58 |
59 | cd /root/rpmbuild/SOURCES/
60 | mv pgpro postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}
61 | chown -R root:root postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}
62 | fi
63 |
64 |
65 | #cd /root/rpmbuild/SOURCES
66 | #sed -i "s/@PG_VERSION@/${PKG_VERSION}/" pg_probackup.repo
67 |
68 | # build postgresql
69 | echo '%_allow_root_build yes' > /root/.rpmmacros
70 | echo '%_topdir %{getenv:HOME}/rpmbuild' >> /root/.rpmmacros
71 |
72 | cd /root/rpmbuild/SPECS
73 | if [[ ${PBK_EDITION} == '' ]] ; then
74 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup.alt.spec
75 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup.alt.spec
76 | sed -i "s/@PKG_HASH@/${PKG_HASH}/" pg_probackup.alt.spec
77 | sed -i "s/@PG_VERSION@/${PG_VERSION}/" pg_probackup.alt.spec
78 | sed -i "s/@PG_FULL_VERSION@/${PG_FULL_VERSION}/" pg_probackup.alt.spec
79 | else
80 | sed -i "s/@EDITION@/${PBK_EDITION}/" pg_probackup.alt.forks.spec
81 | sed -i "s/@EDITION_FULL@/${PBK_EDITION_FULL}/" pg_probackup.alt.forks.spec
82 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup.alt.forks.spec
83 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup.alt.forks.spec
84 | sed -i "s/@PKG_HASH@/${PKG_HASH}/" pg_probackup.alt.forks.spec
85 | sed -i "s/@PG_VERSION@/${PG_VERSION}/" pg_probackup.alt.forks.spec
86 | sed -i "s/@PG_FULL_VERSION@/${PG_FULL_VERSION}/" pg_probackup.alt.forks.spec
87 |
88 | if [ ${PG_VERSION} != '9.6' ]; then
89 | sed -i "s|@PREFIX@|/opt/pgpro/${EDITION}-${PG_VERSION}|g" pg_probackup.alt.forks.spec
90 | fi
91 | fi
92 |
93 | # ALT Linux suck as detecting dependecies, so the manual hint is required
94 | if [ ${DISTRIB_VERSION} == '7' ]; then
95 | apt-get install libpq5.10
96 |
97 | elif [ ${DISTRIB_VERSION} == '8' ]; then
98 | apt-get install libpq5.12
99 |
100 | else
101 | apt-get install libpq5
102 | fi
103 |
104 | # install dependencies
105 | #stolen from postgrespro
106 | apt-get install -y flex libldap-devel libpam-devel libreadline-devel libssl-devel
107 |
108 | if [[ ${PBK_EDITION} == '' ]] ; then
109 | # build pg_probackup
110 | rpmbuild -bs pg_probackup.alt.spec
111 | rpmbuild -ba pg_probackup.alt.spec #2>&1 | tee -ai /app/out/build.log
112 |
113 | # write artefacts to out directory
114 | rm -rf /app/out/*
115 | cp -arv /root/rpmbuild/{RPMS,SRPMS} /app/out
116 | else
117 | rpmbuild -ba pg_probackup.alt.forks.spec #2>&1 | tee -ai /app/out/build.log
118 | # write artefacts to out directory
119 | rm -rf /app/out/*
120 | # cp -arv /root/rpmbuild/{RPMS,SRPMS} /app/out
121 | cp -arv /root/rpmbuild/RPMS /app/out
122 | fi
123 |
--------------------------------------------------------------------------------
/packaging/pkg/scripts/deb.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -xe
9 | set -o pipefail
10 |
11 | # fix https://github.com/moby/moby/issues/23137
12 | ulimit -n 1024
13 |
14 | # There is no std/ent packages for PG 9.5
15 | if [[ ${PG_VERSION} == '9.5' ]] && [[ ${PBK_EDITION} != '' ]] ; then
16 | exit 0
17 | fi
18 |
19 | # PACKAGES NEEDED
20 | apt-get --allow-releaseinfo-change update -y && apt-get install -y git wget bzip2 devscripts equivs
21 |
22 | # Prepare
23 | export DEBIAN_FRONTEND=noninteractive
24 | echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
25 |
26 | if [ ${CODENAME} == 'jessie' ]; then
27 | printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
28 | fi
29 |
30 | apt-get -qq update -y
31 |
32 | # download PKG_URL if PKG_HASH is omitted
33 | mkdir /root/build
34 | cd /root/build
35 |
36 | # clone pbk repo
37 | git clone $PKG_URL ${PKG_NAME}_${PKG_VERSION}
38 | cd ${PKG_NAME}_${PKG_VERSION}
39 | git checkout ${PKG_HASH}
40 | cd ..
41 |
42 | PG_TOC=$(echo ${PG_VERSION} | sed 's|\.||g')
43 | # Download PostgreSQL source if building for vanilla
44 | if [[ ${PBK_EDITION} == '' ]] ; then
45 | wget -q http://ftp.postgresql.org/pub/source/v${PG_FULL_VERSION}/postgresql-${PG_FULL_VERSION}.tar.bz2
46 | fi
47 |
48 | cd /root/build/${PKG_NAME}_${PKG_VERSION}
49 | cp -av /app/in/specs/deb/pg_probackup/debian ./
50 | if [[ ${PBK_EDITION} == '' ]] ; then
51 | sed -i "s/@PKG_NAME@/${PKG_NAME}/g" debian/changelog
52 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/g" debian/changelog
53 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/g" debian/changelog
54 | sed -i "s/@PKG_HASH@/${PKG_HASH}/g" debian/changelog
55 | sed -i "s/@CODENAME@/${CODENAME}/g" debian/changelog
56 |
57 | sed -i "s/@PKG_NAME@/${PKG_NAME}/g" debian/control
58 | sed -i "s/@PG_VERSION@/${PG_VERSION}/g" debian/control
59 |
60 | sed -i "s/@PG_VERSION@/${PG_VERSION}/" debian/pg_probackup.install
61 | mv debian/pg_probackup.install debian/${PKG_NAME}.install
62 |
63 | sed -i "s/@PKG_NAME@/${PKG_NAME}/g" debian/rules
64 | sed -i "s/@PG_TOC@/${PG_TOC}/g" debian/rules
65 | sed -i "s/@PG_VERSION@/${PG_VERSION}/g" debian/rules
66 | sed -i "s/@PG_FULL_VERSION@/${PG_FULL_VERSION}/g" debian/rules
67 | sed -i "s|@PREFIX@|/stump|g" debian/rules
68 | else
69 | sed -i "s/@PKG_NAME@/pg-probackup-${PBK_EDITION}-${PG_VERSION}/g" debian/changelog
70 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/g" debian/changelog
71 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/g" debian/changelog
72 | sed -i "s/@PKG_HASH@/${PKG_HASH}/g" debian/changelog
73 | sed -i "s/@CODENAME@/${CODENAME}/g" debian/changelog
74 |
75 | sed -i "s/@PKG_NAME@/pg-probackup-${PBK_EDITION}-${PG_VERSION}/g" debian/control
76 | sed -i "s/pg-probackup-@PG_VERSION@/pg-probackup-${PBK_EDITION}-${PG_VERSION}/g" debian/control
77 | sed -i "s/@PG_VERSION@/${PG_VERSION}/g" debian/control
78 | sed -i "s/PostgreSQL/PostgresPro ${PBK_EDITION_FULL}/g" debian/control
79 |
80 | sed -i "s/pg_probackup-@PG_VERSION@/pg_probackup-${PBK_EDITION}-${PG_VERSION}/" debian/pg_probackup.install
81 | mv debian/pg_probackup.install debian/pg-probackup-${PBK_EDITION}-${PG_VERSION}.install
82 |
83 | sed -i "s/@PKG_NAME@/pg-probackup-${PBK_EDITION}-${PG_VERSION}/g" debian/rules
84 | sed -i "s/@PG_TOC@/${PG_TOC}/g" debian/rules
85 | sed -i "s/pg_probackup-@PG_VERSION@/pg_probackup-${PBK_EDITION}-${PG_VERSION}/g" debian/rules
86 | sed -i "s/postgresql-@PG_FULL_VERSION@/postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}/g" debian/rules
87 |
88 | if [ ${PG_VERSION} == '9.6' ]; then
89 | sed -i "s|@PREFIX@|/stump|g" debian/rules
90 | else
91 | sed -i "s|@PREFIX@|/opt/pgpro/${PBK_EDITION}-${PG_VERSION}|g" debian/rules
92 | fi
93 | fi
94 |
95 | # Build dependencies
96 | mk-build-deps --install --remove --tool 'apt-get --no-install-recommends --yes' debian/control
97 | rm -rf ./*.deb
98 |
99 | # Pack source to orig.tar.gz
100 | mkdir -p /root/build/dsc
101 | if [[ ${PBK_EDITION} == '' ]] ; then
102 | mv /root/build/postgresql-${PG_FULL_VERSION}.tar.bz2 \
103 | /root/build/dsc/${PKG_NAME}_${PKG_VERSION}.orig-postgresql${PG_TOC}.tar.bz2
104 |
105 | cd /root/build/${PKG_NAME}_${PKG_VERSION}
106 | tar -xf /root/build/dsc/${PKG_NAME}_${PKG_VERSION}.orig-postgresql${PG_TOC}.tar.bz2
107 | cd /root/build
108 |
109 | tar -czf ${PKG_NAME}_${PKG_VERSION}.orig.tar.gz \
110 | ${PKG_NAME}_${PKG_VERSION}
111 |
112 | mv /root/build/${PKG_NAME}_${PKG_VERSION}.orig.tar.gz /root/build/dsc
113 |
114 | cd /root/build/${PKG_NAME}_${PKG_VERSION}
115 | tar -xf /root/build/dsc/${PKG_NAME}_${PKG_VERSION}.orig-postgresql${PG_TOC}.tar.bz2
116 | else
117 | tar -xf /app/in/tarballs/pgpro.tar.bz2 -C /root/build/dsc/
118 | cd /root/build/dsc/pgpro
119 |
120 | PGPRO_TOC=$(echo ${PG_FULL_VERSION} | sed 's|\.|_|g')
121 | if [[ ${PBK_EDITION} == 'std' ]] ; then
122 | git checkout "PGPRO${PGPRO_TOC}_1"
123 | else
124 | git checkout "PGPROEE${PGPRO_TOC}_1"
125 | fi
126 |
127 | mv /root/build/dsc/pgpro /root/build/${PKG_NAME}_${PKG_VERSION}/postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}
128 | fi
129 |
130 | # BUILD: SOURCE PKG
131 | if [[ ${PBK_EDITION} == '' ]] ; then
132 | cd /root/build/dsc
133 | dpkg-source -b /root/build/${PKG_NAME}_${PKG_VERSION}
134 | fi
135 |
136 | # BUILD: DEB PKG
137 | cd /root/build/${PKG_NAME}_${PKG_VERSION}
138 | dpkg-buildpackage -b #&> /app/out/build.log
139 |
140 | # COPY ARTEFACTS
141 | rm -rf /app/out/*
142 | cd /root/build
143 | cp -v *.deb /app/out
144 | cp -v *.changes /app/out
145 |
146 | if [[ ${PBK_EDITION} == '' ]] ; then
147 | cp -arv dsc /app/out
148 | fi
149 |
--------------------------------------------------------------------------------
/packaging/pkg/scripts/rpm.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2021 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 |
9 | #yum upgrade -y || echo "some packages in docker fail to install"
10 | #if [ -f /etc/rosa-release ]; then
11 | # # Avoids old yum bugs on rosa-6
12 | # yum upgrade -y || echo "some packages in docker fail to install"
13 | #fi
14 |
15 | set -xe
16 | set -o pipefail
17 |
18 | # fix https://github.com/moby/moby/issues/23137
19 | ulimit -n 1024
20 |
21 | if [ ${DISTRIB} = 'centos' ] ; then
22 | sed -i 's|^baseurl=http://|baseurl=https://|g' /etc/yum.repos.d/*.repo
23 | if [ ${DISTRIB_VERSION} = '8' ]; then
24 | sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*.repo
25 | sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
26 | fi
27 | yum update -y
28 | if [ ${DISTRIB_VERSION} = '8' ]; then
29 | sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*.repo
30 | sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
31 | fi
32 | fi
33 |
34 | # PACKAGES NEEDED
35 | yum install -y git wget bzip2 rpm-build
36 | if [ ${DISTRIB} = 'oraclelinux' -a ${DISTRIB_VERSION} = '8' -a -n ${PBK_EDITION} ] ; then
37 | yum install -y bison flex
38 | fi
39 |
40 | mkdir /root/build
41 | cd /root/build
42 | rpm --rebuilddb && yum clean all
43 |
44 | # Copy rpmbuild
45 | cp -rv /app/in/specs/rpm/rpmbuild /root/
46 |
47 | # download pbk
48 | git clone $PKG_URL pg_probackup-${PKG_VERSION}
49 | cd pg_probackup-${PKG_VERSION}
50 | git checkout ${PKG_HASH}
51 |
52 | # move it to source
53 | cd /root/build
54 | if [[ ${PBK_EDITION} == '' ]] ; then
55 | tar -cjf pg_probackup-${PKG_VERSION}.tar.bz2 pg_probackup-${PKG_VERSION}
56 | mv pg_probackup-${PKG_VERSION}.tar.bz2 /root/rpmbuild/SOURCES
57 | rm -rf pg_probackup-${PKG_VERSION}
58 | else
59 | mv pg_probackup-${PKG_VERSION} /root/rpmbuild/SOURCES
60 | fi
61 |
62 | if [[ ${PBK_EDITION} == '' ]] ; then
63 |
64 | # Download PostgreSQL source
65 | wget -q http://ftp.postgresql.org/pub/source/v${PG_FULL_VERSION}/postgresql-${PG_FULL_VERSION}.tar.bz2 -O /root/rpmbuild/SOURCES/postgresql-${PG_VERSION}.tar.bz2
66 |
67 | cd /root/rpmbuild/SOURCES/
68 | sed -i "s/@DISTRIB@/${DISTRIB}/" pg_probackup.repo
69 | if [ $DISTRIB == 'centos' ]
70 | then sed -i "s/@SHORT_CODENAME@/Centos/" pg_probackup.repo
71 | elif [ $DISTRIB == 'rhel' ]
72 | then sed -i "s/@SHORT_CODENAME@/RedHat/" pg_probackup.repo
73 | elif [ $DISTRIB == 'oraclelinux' ]
74 | then sed -i "s/@SHORT_CODENAME@/Oracle/" pg_probackup.repo
75 | fi
76 | else
77 | tar -xf /app/in/tarballs/pgpro.tar.bz2 -C /root/rpmbuild/SOURCES/
78 | cd /root/rpmbuild/SOURCES/pgpro
79 |
80 | PGPRO_TOC=$(echo ${PG_FULL_VERSION} | sed 's|\.|_|g')
81 | if [[ ${PBK_EDITION} == 'std' ]] ; then
82 | git checkout "PGPRO${PGPRO_TOC}_1"
83 | else
84 | git checkout "PGPROEE${PGPRO_TOC}_1"
85 | fi
86 | rm -rf .git
87 |
88 | cd /root/rpmbuild/SOURCES/
89 | sed -i "s/@DISTRIB@/${DISTRIB}/" pg_probackup-forks.repo
90 | if [ $DISTRIB == 'centos' ]
91 | then sed -i "s/@SHORT_CODENAME@/Centos/" pg_probackup-forks.repo
92 | elif [ $DISTRIB == 'rhel' ]
93 | then sed -i "s/@SHORT_CODENAME@/RedHat/" pg_probackup-forks.repo
94 | elif [ $DISTRIB == 'oraclelinux' ]
95 | then sed -i "s/@SHORT_CODENAME@/Oracle/" pg_probackup-forks.repo
96 | fi
97 |
98 | mv pgpro postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}
99 | chown -R root:root postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}
100 |
101 | # tar -cjf postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}.tar.bz2 postgrespro-${PBK_EDITION}-${PG_FULL_VERSION}
102 | fi
103 |
104 | cd /root/rpmbuild/SPECS
105 | if [[ ${PBK_EDITION} == '' ]] ; then
106 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup.spec
107 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup.spec
108 | sed -i "s/@PKG_HASH@/${PKG_HASH}/" pg_probackup.spec
109 | sed -i "s/@PG_VERSION@/${PG_VERSION}/" pg_probackup.spec
110 | sed -i "s/@PG_FULL_VERSION@/${PG_FULL_VERSION}/" pg_probackup.spec
111 |
112 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup-repo.spec
113 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup-repo.spec
114 | else
115 | sed -i "s/@EDITION@/${PBK_EDITION}/" pg_probackup-pgpro.spec
116 | sed -i "s/@EDITION_FULL@/${PBK_EDITION_FULL}/" pg_probackup-pgpro.spec
117 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup-pgpro.spec
118 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup-pgpro.spec
119 | sed -i "s/@PKG_HASH@/${PKG_HASH}/" pg_probackup-pgpro.spec
120 | sed -i "s/@PG_VERSION@/${PG_VERSION}/" pg_probackup-pgpro.spec
121 | sed -i "s/@PG_FULL_VERSION@/${PG_FULL_VERSION}/" pg_probackup-pgpro.spec
122 |
123 | if [ ${PG_VERSION} != '9.6' ]; then
124 | sed -i "s|@PREFIX@|/opt/pgpro/${EDITION}-${PG_VERSION}|g" pg_probackup-pgpro.spec
125 | fi
126 |
127 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup-repo-forks.spec
128 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup-repo-forks.spec
129 | fi
130 |
131 | if [[ ${PBK_EDITION} == '' ]] ; then
132 |
133 | # install dependencies
134 | yum-builddep -y pg_probackup.spec
135 |
136 | # build pg_probackup
137 | rpmbuild -bs pg_probackup.spec
138 | rpmbuild -ba pg_probackup.spec
139 |
140 | # build repo files
141 | rpmbuild -bs pg_probackup-repo.spec
142 | rpmbuild -ba pg_probackup-repo.spec
143 |
144 | # write artefacts to out directory
145 | rm -rf /app/out/*
146 | cp -arv /root/rpmbuild/{RPMS,SRPMS} /app/out
147 | else
148 | # install dependencies
149 | yum-builddep -y pg_probackup-pgpro.spec
150 | # build pg_probackup
151 | rpmbuild -ba pg_probackup-pgpro.spec
152 |
153 | # build repo files
154 | rpmbuild -ba pg_probackup-repo-forks.spec
155 |
156 | # write artefacts to out directory
157 | rm -rf /app/out/*
158 | cp -arv /root/rpmbuild/RPMS /app/out
159 | fi
160 |
--------------------------------------------------------------------------------
/packaging/pkg/scripts/suse.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 |
9 | #yum upgrade -y || echo "some packages in docker fail to install"
10 | #if [ -f /etc/rosa-release ]; then
11 | # # Avoids old yum bugs on rosa-6
12 | # yum upgrade -y || echo "some packages in docker fail to install"
13 | #fi
14 |
15 | set -xe
16 | set -o pipefail
17 |
18 | # currenctly we do not build std|ent packages for Suse
19 | if [[ ${PBK_EDITION} != '' ]] ; then
20 | exit 0
21 | fi
22 |
23 | # fix https://github.com/moby/moby/issues/23137
24 | ulimit -n 1024
25 | zypper clean
26 |
27 | # PACKAGES NEEDED
28 | zypper install -y git wget bzip2 rpm-build
29 |
30 | mkdir /root/build
31 | cd /root/build
32 |
33 | # Copy rpmbuild
34 | cp -rv /app/in/specs/rpm/rpmbuild /root/
35 |
36 | # download pbk
37 | git clone $PKG_URL pg_probackup-${PKG_VERSION}
38 | cd pg_probackup-${PKG_VERSION}
39 | git checkout ${PKG_HASH}
40 | cd ..
41 |
42 | # tarball it
43 | tar -cjf pg_probackup-${PKG_VERSION}.tar.bz2 pg_probackup-${PKG_VERSION}
44 | mv pg_probackup-${PKG_VERSION}.tar.bz2 /root/rpmbuild/SOURCES
45 | rm -rf pg_probackup-${PKG_VERSION}
46 |
47 | # Download PostgreSQL source
48 | wget -q http://ftp.postgresql.org/pub/source/v${PG_FULL_VERSION}/postgresql-${PG_FULL_VERSION}.tar.bz2 -O /root/rpmbuild/SOURCES/postgresql-${PG_VERSION}.tar.bz2
49 |
50 | rm -rf /usr/src/packages
51 | ln -s /root/rpmbuild /usr/src/packages
52 |
53 | cd /root/rpmbuild/SOURCES
54 | sed -i "s/@PG_VERSION@/${PKG_VERSION}/" pg_probackup.repo
55 |
56 |
57 | # change to build dir
58 | cd /root/rpmbuild/SOURCES
59 | sed -i "s/@DISTRIB@/${DISTRIB}/" pg_probackup.repo
60 | if [ $DISTRIB == 'centos' ]
61 | then sed -i "s/@SHORT_CODENAME@/Centos/" pg_probackup.repo
62 | elif [ $DISTRIB == 'rhel' ]
63 | then sed -i "s/@SHORT_CODENAME@/RedHat/" pg_probackup.repo
64 | elif [ $DISTRIB == 'oraclelinux' ]
65 | then sed -i "s/@SHORT_CODENAME@/Oracle/" pg_probackup.repo
66 | elif [ $DISTRIB == 'suse' ]
67 | then sed -i "s/@SHORT_CODENAME@/SUSE/" pg_probackup.repo
68 | fi
69 |
70 | cd /root/rpmbuild/SPECS
71 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup.spec
72 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup.spec
73 | sed -i "s/@PKG_HASH@/${PKG_HASH}/" pg_probackup.spec
74 | sed -i "s/@PG_VERSION@/${PG_VERSION}/" pg_probackup.spec
75 | sed -i "s/@PG_FULL_VERSION@/${PG_FULL_VERSION}/" pg_probackup.spec
76 |
77 | sed -i "s/@PG_VERSION@/${PG_VERSION}/" pg_probackup-repo.spec
78 | sed -i "s/@PKG_VERSION@/${PKG_VERSION}/" pg_probackup-repo.spec
79 | sed -i "s/@PKG_RELEASE@/${PKG_RELEASE}/" pg_probackup-repo.spec
80 |
81 | # install dependencies
82 | zypper -n install \
83 | $(rpmspec --parse pg_probackup.spec | grep BuildRequires | cut -d':' -f2 | xargs)
84 |
85 | # build pg_probackup
86 | rpmbuild -bs pg_probackup.spec
87 | rpmbuild -ba pg_probackup.spec #2>&1 | tee -ai /app/out/build.log
88 |
89 | # build repo files, TODO: move to separate repo
90 | rpmbuild -ba pg_probackup-repo.spec
91 |
92 | # write artefacts to out directory
93 | rm -rf /app/out/*
94 |
95 | cp -arv /root/rpmbuild/{RPMS,SRPMS} /app/out
96 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/deb/pg_probackup/debian/changelog:
--------------------------------------------------------------------------------
1 | @PKG_NAME@ (@PKG_VERSION@-@PKG_RELEASE@.@PKG_HASH@.@CODENAME@) @CODENAME@; urgency=medium
2 |
3 | * @PKG_VERSION@
4 |
5 | -- Grigory Smolkin Wed, 9 Feb 2018 10:22:08 +0300
6 |
7 | @PKG_NAME@ (2.0.14-1.@CODENAME@) @CODENAME@; urgency=medium
8 |
9 | * Initial package
10 |
11 | -- Grigory Smolkin Fri, 29 Jan 2018 10:22:08 +0300
12 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/deb/pg_probackup/debian/compat:
--------------------------------------------------------------------------------
1 | 9
2 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/deb/pg_probackup/debian/control:
--------------------------------------------------------------------------------
1 | Source: @PKG_NAME@
2 | Section: database
3 | Priority: optional
4 | Maintainer: PostgresPro DBA
5 | Uploaders: Grigory Smolkin
6 | Build-Depends:
7 | debhelper (>= 9),
8 | bison,
9 | dpkg-dev,
10 | flex,
11 | gettext,
12 | zlib1g-dev | libz-dev,
13 | libpq5
14 | Standards-Version: 3.9.6
15 | Homepage: https://github.com/postgrespro/pg_probackup
16 |
17 | Package: @PKG_NAME@
18 | Architecture: any
19 | Depends: ${misc:Depends}, ${shlibs:Depends}
20 | Description: Backup tool for PostgreSQL.
21 | .
22 | This package provides pg_probackup binary for PostgreSQL @PG_VERSION@.
23 |
24 | Package: @PKG_NAME@-dbg
25 | Depends: @PKG_NAME@
26 | Architecture: any
27 | Description: Backup tool for PostgreSQL.
28 | .
29 | This package provides detached debugging symbols for pg_probackup
30 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/deb/pg_probackup/debian/pg_probackup.install:
--------------------------------------------------------------------------------
1 | pg_probackup-@PG_VERSION@ /usr/bin/
--------------------------------------------------------------------------------
/packaging/pkg/specs/deb/pg_probackup/debian/rules:
--------------------------------------------------------------------------------
1 | #!/usr/bin/make -f
2 |
3 | # Uncomment this to turn on verbose mode.
4 | export DH_VERBOSE=1
5 |
6 | %:
7 | dh $@
8 |
9 | override_dh_auto_clean:
10 | # skip
11 |
12 | override_dh_auto_build:
13 | cd postgresql-@PG_FULL_VERSION@ && ./configure --enable-debug --without-readline --prefix=@PREFIX@ &&\
14 | make MAKELEVEL=0 install DESTDIR=$(CURDIR)/debian/tmp && cd .. &&\
15 | make USE_PGXS=1 top_srcdir=$(CURDIR)/postgresql-@PG_FULL_VERSION@ PG_CONFIG=$(CURDIR)/debian/tmp/@PREFIX@/bin/pg_config &&\
16 | mv pg_probackup pg_probackup-@PG_VERSION@
17 |
18 | override_dh_auto_test:
19 | # skip
20 |
21 | override_dh_auto_install:
22 | # skip
23 |
24 | override_dh_strip:
25 | dh_strip --dbg-package=@PKG_NAME@-dbg
26 |
27 | override_dh_auto_clean:
28 | # skip
29 | #make clean top_srcdir=$(CURDIR)/pg@PG_TOC@-source PG_CONFIG=$(CURDIR)/debian/tmp/stump/bin/pg_config
30 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/deb/pg_probackup/debian/source/format:
--------------------------------------------------------------------------------
1 | 3.0 (quilt)
2 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SOURCES/GPG-KEY-PG_PROBACKUP:
--------------------------------------------------------------------------------
1 | -----BEGIN PGP PUBLIC KEY BLOCK-----
2 | Version: GnuPG v2.0.22 (GNU/Linux)
3 |
4 | mQINBFpy9DABEADd44hR3o4i4DrUephrr7iHPHcRH0Zego3A36NdOf0ymP94H8Bi
5 | U8C6YyKFbltShh18IC3QZJK04hLRQEs6sPKC2XHwlz+Tndi49Z45pfV54xEVKmBS
6 | IZ5AM9y1FxwQAOzu6pZGu32DWDXZzhI7nLuY8rqAMMuzKeRcGm3sQ6ZcAwYOLT+e
7 | ZAxkUL05MBGDaLc91HtKiurRlHuMySiVdkNu9ebTGV4zZv+ocBK8iC5rJjTJCv78
8 | eLkrRgjp7/MuLQ7mmiwfZx5lUIO9S87HDeH940mcYWRGUsdCbj0791wHY0PXlqhH
9 | 6lCLGur9/5yM88pGU79uahCblxsYdue6fdgIZR0hQBUxnLphI2SCshP89VDEwaP2
10 | dlC/qESJ3xyULkdJz67wlhOrIPC9T1d2pa5MUurOK0yTFH7j4JLWjBgU59h31ZEF
11 | NMHde+Fwv+lL/yRht2Xz7HG5Rt8ogn4/rPBloXr1v83iN34aZnnqanyhSbE9xUhP
12 | RNK3fBxXmX9IjFsBhRelPcv5NWNnxnnMkEfhoZvrAy+ykUGLP+J+Rj+d5v/8nAUc
13 | taxqAXlUz1VabR0BVISBsRY+ket4O2dJ1WbZ8KXG6q/F9UMpS0v9aRdb1JyzrWCw
14 | wT/l3q9x89i27SgDZgAfEFhvbMN6hUmFyVoMBgk8kqvi4b3lZZGCeuLX5wARAQAB
15 | tCxQb3N0Z3JlU1FMIFByb2Zlc3Npb25hbCA8ZGJhQHBvc3RncmVzcHJvLnJ1PokC
16 | OQQTAQIAIwUCWnL0MAIbAwcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJEKeJ
17 | efZjbXF+zDUP/RfYxlq3erzP/cG6/LghZlJy6hGuUgyDFj2zUVAbpoFhqCAmaNLc
18 | +bBYMCyNRhS8/oXushCSxUV8D7LRIRIRdtbNAnd4MNl6U4ORF6JcdPPNLROzwMik
19 | 3TmIVACMdjb9IRF5+8jVrIgDPI/FVtf5qp0Ot6OBtpD5oWQ7ubZ31RPR3pacdujK
20 | jlbzL5Y6HsonhMbSJU/d0d9DylMvX4Gcxdw7M2Pfe3E6mjPJmcHiKuCKln2eLOsg
21 | 53HA/RWKy+uYDo+vdefUsQCIdnC5VghnXG8FTuvVqeqiSeU2XdyuzjndqxKZNrMw
22 | YK1POK7R55R1aKJaOKEwnfd5oN02p77U+R/vb/mDcfZWbXI8JrHwPKVOQiEl0S+G
23 | ePPW57EmX9yFuWAzcOPp9yCt/+roVry1ICifrFaLOhtT+/vle0j3+rbn31BMPsjf
24 | QbREVetHfWB0N78k/hKC8SivDdrXsdqovcGgSAjFzPEdznvx9vKopwz2CQ6DK25Q
25 | 3M4j79Akcaa08k5Wphyx48PbhzSeE/d4xVzey7ge0BwYMdNGXKeyBjT6h9e+iySE
26 | UTZ3/3c7O1D8p2EfPUMT/aI5fWlLBXlT5fDp2yX0HMTt/NUIXAiTHb5BDnZ+4ld3
27 | KXjHw4WzaOfHBfGDjJDtHPgdTEJTsQbH8//D+wwU3ueNS1ho4DpLqc+YuQINBFpy
28 | 9DABEADJMkgQ2m4g4LX7FNnmQbRgDcuhL8Y0VRGST+5x6xvb2em1boQHUaTt7/3z
29 | DnaIRrZqrFP09O6xblSjEu9FZE+JuQGNyC4TH9fjvKnkRlqTF6X87nRVGByRmrdL
30 | lPp9XPJY2Mc7c0PisncI/j7d9PmUHOSmaWeLG/WqMbzZA+s1IWjC0tqIN2k5ivTN
31 | PfRm+9ebEHMUN+D7yZQMBlCmFexwy6h5pAioyj4tAOHqxfNDE33qezaeBn/E1BpW
32 | NyegKwNtPUL0t2kXTO5tspKKCcny4HJ7K60gak0fWp42qVygwSPR54ztFM+6XjCh
33 | 0MmZ/mAdzLd6OJiP8RfMCfXbXpK4793+Cw0AK3Mu+mnJ26kz1KEZ9DKiAEhBhK3r
34 | Z3/isUc8LcVYLHIduH9b/K50FjgR0T1Lm4r6Hpf6nTROlfiFSMXJU0HepAzMPHRq
35 | EWqTJ49UgI7Llf+aBP7fGLqRPvWJpAJaQkMiUxfP5JYYCb+45d7I54iXQCD6ToK1
36 | bDnh+zZIrwyUIxPfFQh1xPYyFWRELJpeOFzm+espqiVFPXpBoimVlytwNrGdbxbY
37 | SO0eEVlE41AjD8cgk+ibAvt/moT2+Mps/t083LR+J92kj+iX/D4NHVy4CjJTrhwO
38 | rI3FrxtdU+NFXULyj0KslOKuyG5WuHLQvfL5P3JGuTkP4iJOTQARAQABiQIfBBgB
39 | AgAJBQJacvQwAhsMAAoJEKeJefZjbXF+8JgQAJqlO1ftIsJvZ/+4ZVVOTPx5ZmYs
40 | ABp4/2gaiLdhajN8ynbZqtCyjtQwSCLJFf2CcDL8XUooJzdQECkqdiI7ouYSFBzO
41 | ui3jjCuFz5oHv88OtX2cIRxHqlZQmXEHvk0gH61xDV5CWBJmjxdRcsC7n1I8DSVg
42 | Qmuq06S+xIX6rHf2CRxYKahBip71u7OIH4BRV44y26xf1a8an+8BkqF9+mYt7zqO
43 | vyMCJ1UftXcuE5SxY54jnNAavF7Kq/2Yp7v3aYqFREngxtbWudyo7QW5EuToSvY2
44 | qY6tpInahWjuXxeARsFzp4fB0Eo/yH+iqG30zkQCuxLyxzbMMcNQP4if3yV6uO14
45 | LqapZLrMp6IMTfHDKmbbtDQ2RpRRut3K4khXRQ1LjGKziOU4ZCEazrXEijm2AlKw
46 | 7JS3POGvM+VAiaGNBqfdHpTwXXT7zkxJjfJC3Et/6fHy1xuCtUtMs41PjHS/HWi8
47 | w70T8XpKub+ewVElxq2D83rx07w3HuBtVUyqG0XgcACwqQA1vMLJaR3VoX1024ho
48 | sf2PtZqQ7SCgt0hkZAT72j05nz4bIxUIcDkAGtd9FDPQ4Ixi6fRfTJpZ7lIEV5as
49 | Zs9C0hrxmWgJwSGgQa2Waylvw47fMwfMn+gUNRqwanyOjVYfpSJafLc6Ol43bQN/
50 | jCKs4enncezhjcAh
51 | =TVZj
52 | -----END PGP PUBLIC KEY BLOCK-----
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SOURCES/GPG-KEY-PG_PROBACKUP-FORKS:
--------------------------------------------------------------------------------
1 | -----BEGIN PGP PUBLIC KEY BLOCK-----
2 | Version: GnuPG v2.0.22 (GNU/Linux)
3 |
4 | mQINBFpy9DABEADd44hR3o4i4DrUephrr7iHPHcRH0Zego3A36NdOf0ymP94H8Bi
5 | U8C6YyKFbltShh18IC3QZJK04hLRQEs6sPKC2XHwlz+Tndi49Z45pfV54xEVKmBS
6 | IZ5AM9y1FxwQAOzu6pZGu32DWDXZzhI7nLuY8rqAMMuzKeRcGm3sQ6ZcAwYOLT+e
7 | ZAxkUL05MBGDaLc91HtKiurRlHuMySiVdkNu9ebTGV4zZv+ocBK8iC5rJjTJCv78
8 | eLkrRgjp7/MuLQ7mmiwfZx5lUIO9S87HDeH940mcYWRGUsdCbj0791wHY0PXlqhH
9 | 6lCLGur9/5yM88pGU79uahCblxsYdue6fdgIZR0hQBUxnLphI2SCshP89VDEwaP2
10 | dlC/qESJ3xyULkdJz67wlhOrIPC9T1d2pa5MUurOK0yTFH7j4JLWjBgU59h31ZEF
11 | NMHde+Fwv+lL/yRht2Xz7HG5Rt8ogn4/rPBloXr1v83iN34aZnnqanyhSbE9xUhP
12 | RNK3fBxXmX9IjFsBhRelPcv5NWNnxnnMkEfhoZvrAy+ykUGLP+J+Rj+d5v/8nAUc
13 | taxqAXlUz1VabR0BVISBsRY+ket4O2dJ1WbZ8KXG6q/F9UMpS0v9aRdb1JyzrWCw
14 | wT/l3q9x89i27SgDZgAfEFhvbMN6hUmFyVoMBgk8kqvi4b3lZZGCeuLX5wARAQAB
15 | tCxQb3N0Z3JlU1FMIFByb2Zlc3Npb25hbCA8ZGJhQHBvc3RncmVzcHJvLnJ1PokC
16 | OQQTAQIAIwUCWnL0MAIbAwcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJEKeJ
17 | efZjbXF+zDUP/RfYxlq3erzP/cG6/LghZlJy6hGuUgyDFj2zUVAbpoFhqCAmaNLc
18 | +bBYMCyNRhS8/oXushCSxUV8D7LRIRIRdtbNAnd4MNl6U4ORF6JcdPPNLROzwMik
19 | 3TmIVACMdjb9IRF5+8jVrIgDPI/FVtf5qp0Ot6OBtpD5oWQ7ubZ31RPR3pacdujK
20 | jlbzL5Y6HsonhMbSJU/d0d9DylMvX4Gcxdw7M2Pfe3E6mjPJmcHiKuCKln2eLOsg
21 | 53HA/RWKy+uYDo+vdefUsQCIdnC5VghnXG8FTuvVqeqiSeU2XdyuzjndqxKZNrMw
22 | YK1POK7R55R1aKJaOKEwnfd5oN02p77U+R/vb/mDcfZWbXI8JrHwPKVOQiEl0S+G
23 | ePPW57EmX9yFuWAzcOPp9yCt/+roVry1ICifrFaLOhtT+/vle0j3+rbn31BMPsjf
24 | QbREVetHfWB0N78k/hKC8SivDdrXsdqovcGgSAjFzPEdznvx9vKopwz2CQ6DK25Q
25 | 3M4j79Akcaa08k5Wphyx48PbhzSeE/d4xVzey7ge0BwYMdNGXKeyBjT6h9e+iySE
26 | UTZ3/3c7O1D8p2EfPUMT/aI5fWlLBXlT5fDp2yX0HMTt/NUIXAiTHb5BDnZ+4ld3
27 | KXjHw4WzaOfHBfGDjJDtHPgdTEJTsQbH8//D+wwU3ueNS1ho4DpLqc+YuQINBFpy
28 | 9DABEADJMkgQ2m4g4LX7FNnmQbRgDcuhL8Y0VRGST+5x6xvb2em1boQHUaTt7/3z
29 | DnaIRrZqrFP09O6xblSjEu9FZE+JuQGNyC4TH9fjvKnkRlqTF6X87nRVGByRmrdL
30 | lPp9XPJY2Mc7c0PisncI/j7d9PmUHOSmaWeLG/WqMbzZA+s1IWjC0tqIN2k5ivTN
31 | PfRm+9ebEHMUN+D7yZQMBlCmFexwy6h5pAioyj4tAOHqxfNDE33qezaeBn/E1BpW
32 | NyegKwNtPUL0t2kXTO5tspKKCcny4HJ7K60gak0fWp42qVygwSPR54ztFM+6XjCh
33 | 0MmZ/mAdzLd6OJiP8RfMCfXbXpK4793+Cw0AK3Mu+mnJ26kz1KEZ9DKiAEhBhK3r
34 | Z3/isUc8LcVYLHIduH9b/K50FjgR0T1Lm4r6Hpf6nTROlfiFSMXJU0HepAzMPHRq
35 | EWqTJ49UgI7Llf+aBP7fGLqRPvWJpAJaQkMiUxfP5JYYCb+45d7I54iXQCD6ToK1
36 | bDnh+zZIrwyUIxPfFQh1xPYyFWRELJpeOFzm+espqiVFPXpBoimVlytwNrGdbxbY
37 | SO0eEVlE41AjD8cgk+ibAvt/moT2+Mps/t083LR+J92kj+iX/D4NHVy4CjJTrhwO
38 | rI3FrxtdU+NFXULyj0KslOKuyG5WuHLQvfL5P3JGuTkP4iJOTQARAQABiQIfBBgB
39 | AgAJBQJacvQwAhsMAAoJEKeJefZjbXF+8JgQAJqlO1ftIsJvZ/+4ZVVOTPx5ZmYs
40 | ABp4/2gaiLdhajN8ynbZqtCyjtQwSCLJFf2CcDL8XUooJzdQECkqdiI7ouYSFBzO
41 | ui3jjCuFz5oHv88OtX2cIRxHqlZQmXEHvk0gH61xDV5CWBJmjxdRcsC7n1I8DSVg
42 | Qmuq06S+xIX6rHf2CRxYKahBip71u7OIH4BRV44y26xf1a8an+8BkqF9+mYt7zqO
43 | vyMCJ1UftXcuE5SxY54jnNAavF7Kq/2Yp7v3aYqFREngxtbWudyo7QW5EuToSvY2
44 | qY6tpInahWjuXxeARsFzp4fB0Eo/yH+iqG30zkQCuxLyxzbMMcNQP4if3yV6uO14
45 | LqapZLrMp6IMTfHDKmbbtDQ2RpRRut3K4khXRQ1LjGKziOU4ZCEazrXEijm2AlKw
46 | 7JS3POGvM+VAiaGNBqfdHpTwXXT7zkxJjfJC3Et/6fHy1xuCtUtMs41PjHS/HWi8
47 | w70T8XpKub+ewVElxq2D83rx07w3HuBtVUyqG0XgcACwqQA1vMLJaR3VoX1024ho
48 | sf2PtZqQ7SCgt0hkZAT72j05nz4bIxUIcDkAGtd9FDPQ4Ixi6fRfTJpZ7lIEV5as
49 | Zs9C0hrxmWgJwSGgQa2Waylvw47fMwfMn+gUNRqwanyOjVYfpSJafLc6Ol43bQN/
50 | jCKs4enncezhjcAh
51 | =TVZj
52 | -----END PGP PUBLIC KEY BLOCK-----
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SOURCES/pg_probackup-forks.repo:
--------------------------------------------------------------------------------
1 | [pg_probackup-forks]
2 | name=PG_PROBACKUP @SHORT_CODENAME@ packages for PostgresPro Standard and Enterprise - $basearch
3 | baseurl=https://repo.postgrespro.ru/pg_probackup-forks/rpm/latest/@DISTRIB@-$releasever-$basearch
4 | enabled=1
5 | gpgcheck=1
6 | gpgkey=file:///etc/pki/rpm-gpg/GPG-KEY-PG_PROBACKUP
7 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SOURCES/pg_probackup.repo:
--------------------------------------------------------------------------------
1 | [pg_probackup]
2 | name=PG_PROBACKUP Packages for @SHORT_CODENAME@ Linux - $basearch
3 | baseurl=https://repo.postgrespro.ru/pg_probackup/rpm/latest/@DISTRIB@-$releasever-$basearch
4 | enabled=1
5 | gpgcheck=1
6 | gpgkey=file:///etc/pki/rpm-gpg/GPG-KEY-PG_PROBACKUP
7 |
8 | [pg_probackup-sources]
9 | name=PG_PROBACKUP Source Packages for @SHORT_CODENAME@ Linux - $basearch
10 | baseurl=https://repo.postgrespro.ru/pg_probackup/srpm/latest/@DISTRIB@-$releasever-$basearch
11 | enabled=1
12 | gpgcheck=1
13 | gpgkey=file:///etc/pki/rpm-gpg/GPG-KEY-PG_PROBACKUP
14 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SPECS/pg_probackup-pgpro.spec:
--------------------------------------------------------------------------------
1 | %global version @PKG_VERSION@
2 | %global release @PKG_RELEASE@
3 | %global hash @PKG_HASH@
4 | %global pgsql_major @PG_VERSION@
5 | %global pgsql_full @PG_FULL_VERSION@
6 | %global edition @EDITION@
7 | %global edition_full @EDITION_FULL@
8 | %global prefix @PREFIX@
9 |
10 | Name: pg_probackup-%{edition}-%{pgsql_major}
11 | Version: %{version}
12 | Release: %{release}.%{hash}
13 | Summary: Backup utility for PostgresPro %{edition_full}
14 | Group: Applications/Databases
15 | License: BSD
16 | Url: http://postgrespro.ru/
17 | #Source0: postgrespro-%{edition}-%{pgsql_full}.tar.bz2
18 | #Source1: pg_probackup-%{version}.tar.bz2
19 | Source0: postgrespro-%{edition}-%{pgsql_full}
20 | Source1: pg_probackup-%{version}
21 | BuildRequires: gcc make perl glibc-devel
22 | BuildRequires: openssl-devel gettext zlib-devel
23 |
24 |
25 | %description
26 | Backup tool for PostgresPro %{edition_full}.
27 |
28 | %prep
29 | #%setup -q -b1 -n pg_probackup-%{version}.tar.bz2
30 | mv %{_topdir}/SOURCES/postgrespro-%{edition}-%{pgsql_full} %{_topdir}/BUILD
31 | cd %{_topdir}/BUILD/postgrespro-%{edition}-%{pgsql_full}
32 | mv %{_topdir}/SOURCES/pg_probackup-%{version} contrib/pg_probackup
33 |
34 | mkdir %{_topdir}/SOURCES/postgrespro-%{edition}-%{pgsql_full}
35 | mkdir %{_topdir}/SOURCES/pg_probackup-%{version}
36 |
37 | %build
38 | #cd %{_topdir}/SOURCES/postgrespro-%{edition}-%{pgsql_full}
39 | #mv %{_topdir}/SOURCES/postgrespro-%{edition}-%{pgsql_full} ./
40 | #cd postgrespro-%{edition}-%{pgsql_full}
41 | #mv %{_topdir}/SOURCES/pg_probackup-%{version} contrib/pg_probackup
42 | cd %{_topdir}/BUILD/postgrespro-%{edition}-%{pgsql_full}
43 |
44 | %if "%{pgsql_major}" == "9.6"
45 | ./configure --enable-debug --without-readline
46 | %else
47 | ./configure --enable-debug --without-readline --prefix=%{prefix}
48 | %endif
49 | make -C 'src/common'
50 | make -C 'src/port'
51 | make -C 'src/interfaces'
52 | cd contrib/pg_probackup && make
53 |
54 | %install
55 | cd %{_topdir}/BUILD/postgrespro-%{edition}-%{pgsql_full}
56 | %{__mkdir} -p %{buildroot}%{_bindir}
57 | %{__install} -p -m 755 contrib/pg_probackup/pg_probackup %{buildroot}%{_bindir}/%{name}
58 |
59 | %files
60 | %{_bindir}/%{name}
61 |
62 | %clean
63 | rm -rf $RPM_BUILD_ROOT
64 |
65 |
66 | %changelog
67 | * Wed Feb 9 2018 Grigory Smolkin - %{version}-%{release}.%{hash}
68 | - @PKG_VERSION@
69 |
70 | * Fri Jan 29 2018 Grigory Smolkin - 2.0.14-1
71 | - Initial release.
72 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SPECS/pg_probackup-repo-forks.spec:
--------------------------------------------------------------------------------
1 | %global version @PKG_VERSION@
2 | %global release @PKG_RELEASE@
3 |
4 | Summary: pg_probackup repo RPM
5 | Name: pg_probackup-repo-forks
6 | Version: %{version}
7 | Release: %{release}
8 | Group: Applications/Databases
9 | License: BSD
10 | Url: http://postgrespro.ru/
11 |
12 | Source0: http://repo.postgrespro.ru/pg_probackup-forks/keys/GPG-KEY-PG_PROBACKUP
13 | Source1: pg_probackup-forks.repo
14 |
15 | BuildArch: noarch
16 |
17 | %description
18 | This package contains yum configuration for @SHORT_CODENAME@, and also the GPG key
19 | for pg_probackup RPMs for PostgresPro Standard and Enterprise.
20 |
21 | %prep
22 | %setup -q -c -T
23 | install -pm 644 %{SOURCE0} .
24 | install -pm 644 %{SOURCE1} .
25 |
26 | %build
27 |
28 | %install
29 | rm -rf $RPM_BUILD_ROOT
30 |
31 | #GPG Key
32 | install -Dpm 644 %{SOURCE0} \
33 | $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg/GPG-KEY-PG_PROBACKUP
34 |
35 | # yum
36 | install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
37 | install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
38 |
39 | %clean
40 | rm -rf $RPM_BUILD_ROOT
41 |
42 | %files
43 | %defattr(-,root,root,-)
44 | %config(noreplace) /etc/yum.repos.d/*
45 | /etc/pki/rpm-gpg/*
46 |
47 | %changelog
48 | * Fri Oct 26 2019 Grigory Smolkin
49 | - Initial package
50 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SPECS/pg_probackup-repo.spec:
--------------------------------------------------------------------------------
1 | %global version @PKG_VERSION@
2 | %global release @PKG_RELEASE@
3 |
4 | Summary: PG_PROBACKUP RPMs
5 | Name: pg_probackup-repo
6 | Version: %{version}
7 | Release: %{release}
8 | Group: Applications/Databases
9 | License: BSD
10 | Url: http://postgrespro.ru/
11 |
12 | Source0: http://repo.postgrespro.ru/pg_probackup/keys/GPG-KEY-PG_PROBACKUP
13 | Source1: pg_probackup.repo
14 |
15 | BuildArch: noarch
16 |
17 | %description
18 | This package contains yum configuration for Centos, and also the GPG key for PG_PROBACKUP RPMs.
19 |
20 | %prep
21 | %setup -q -c -T
22 | install -pm 644 %{SOURCE0} .
23 | install -pm 644 %{SOURCE1} .
24 |
25 | %build
26 |
27 | %install
28 | rm -rf $RPM_BUILD_ROOT
29 |
30 | #GPG Key
31 | install -Dpm 644 %{SOURCE0} \
32 | $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg/GPG-KEY-PG_PROBACKUP
33 |
34 | # yum /etc/zypp/repos.d/repo-update.repo
35 |
36 | %if 0%{?suse_version}
37 | install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
38 | install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
39 | %else
40 | install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
41 | install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
42 | %endif
43 |
44 | %clean
45 | rm -rf $RPM_BUILD_ROOT
46 |
47 | %files
48 | %defattr(-,root,root,-)
49 | %if 0%{?suse_version}
50 | %config(noreplace) /etc/zypp/repos.d/*
51 | %else
52 | %config(noreplace) /etc/yum.repos.d/*
53 | %endif
54 | /etc/pki/rpm-gpg/*
55 |
56 | %changelog
57 | * Mon Jun 29 2020 Grigory Smolkin
58 | - release update
59 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SPECS/pg_probackup.alt.forks.spec:
--------------------------------------------------------------------------------
1 | %global version @PKG_VERSION@
2 | %global release @PKG_RELEASE@
3 | %global hash @PKG_HASH@
4 | %global pgsql_major @PG_VERSION@
5 | %global pgsql_full @PG_FULL_VERSION@
6 | %global edition @EDITION@
7 | %global edition_full @EDITION_FULL@
8 | %global prefix @PREFIX@
9 |
10 | #%set_verify_elf_method unresolved=relaxed, rpath=relaxed
11 | %set_verify_elf_method rpath=relaxed,unresolved=relaxed
12 |
13 | Name: pg_probackup-%{edition}-%{pgsql_major}
14 | Version: %{version}
15 | Release: %{release}.%{hash}
16 | Summary: Backup utility for PostgresPro %{edition_full}
17 | Group: Applications/Databases
18 | License: BSD
19 | Url: http://postgrespro.ru/
20 | #Source0: postgrespro-%{edition}-%{pgsql_full}.tar.bz2
21 | #Source1: pg_probackup-%{edition}-%{version}.tar.bz2
22 | Source0: postgrespro-%{edition}-%{pgsql_full}
23 | Source1: pg_probackup-%{version}
24 | BuildRequires: gcc make perl glibc-devel bison flex
25 | BuildRequires: readline-devel openssl-devel gettext zlib-devel
26 |
27 |
28 | %description
29 | Backup tool for PostgresPro %{edition_full}.
30 |
31 | %prep
32 | #%setup -q -b1 -n postgrespro-%{edition}-%{pgsql_full}
33 | mv %{_topdir}/SOURCES/postgrespro-%{edition}-%{pgsql_full} %{_topdir}/BUILD
34 | cd %{_topdir}/BUILD/postgrespro-%{edition}-%{pgsql_full}
35 | mv %{_topdir}/SOURCES/pg_probackup-%{version} contrib/pg_probackup
36 |
37 | mkdir %{_topdir}/SOURCES/postgrespro-%{edition}-%{pgsql_full}
38 | mkdir %{_topdir}/SOURCES/pg_probackup-%{edition}-%{version}
39 | mkdir %{_topdir}/SOURCES/pg_probackup-%{version}
40 |
41 | %build
42 | cd %{_topdir}/BUILD/postgrespro-%{edition}-%{pgsql_full}
43 | %if "%{pgsql_major}" == "9.6"
44 | ./configure --enable-debug
45 | %else
46 | ./configure --enable-debug --disable-online-upgrade --prefix=%{prefix}
47 | %endif
48 | make -C 'src/common'
49 | make -C 'src/port'
50 | make -C 'src/interfaces'
51 | cd contrib/pg_probackup && make
52 |
53 | %install
54 | cd %{_topdir}/BUILD/postgrespro-%{edition}-%{pgsql_full}
55 | %{__mkdir} -p %{buildroot}%{_bindir}
56 | %{__install} -p -m 755 contrib/pg_probackup/pg_probackup %{buildroot}%{_bindir}/%{name}
57 |
58 | %files
59 | %{_bindir}/%{name}
60 |
61 | %clean
62 | rm -rf $RPM_BUILD_ROOT
63 |
64 |
65 | %changelog
66 | * Mon Nov 17 2019 Grigory Smolkin - 2.2.6-1
67 | - Initial release.
68 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SPECS/pg_probackup.alt.spec:
--------------------------------------------------------------------------------
1 | %global version @PKG_VERSION@
2 | %global release @PKG_RELEASE@
3 | %global hash @PKG_HASH@
4 | %global pgsql_major @PG_VERSION@
5 | %global pgsql_full @PG_FULL_VERSION@
6 | %set_verify_elf_method rpath=relaxed
7 |
8 | Name: pg_probackup-%{pgsql_major}
9 | Version: %{version}
10 | Release: %{release}.%{hash}
11 | Summary: Backup utility for PostgreSQL
12 | Group: Applications/Databases
13 | License: BSD
14 | Url: http://postgrespro.ru/
15 | Source0: http://ftp.postgresql.org/pub/source/v%{pgsql_full}/postgresql-%{pgsql_major}.tar.bz2
16 | Source1: pg_probackup-%{version}.tar.bz2
17 | BuildRequires: gcc make perl glibc-devel bison flex
18 | BuildRequires: readline-devel openssl-devel gettext zlib-devel
19 |
20 |
21 | %description
22 | Backup tool for PostgreSQL.
23 |
24 | %prep
25 | %setup -q -b1 -n postgresql-%{pgsql_full}
26 |
27 | %build
28 | mv %{_builddir}/pg_probackup-%{version} contrib/pg_probackup
29 | ./configure --enable-debug --without-readline
30 | make -C 'src/common'
31 | make -C 'src/port'
32 | make -C 'src/interfaces'
33 | cd contrib/pg_probackup && make
34 |
35 | %install
36 | %{__mkdir} -p %{buildroot}%{_bindir}
37 | %{__install} -p -m 755 contrib/pg_probackup/pg_probackup %{buildroot}%{_bindir}/%{name}
38 |
39 | %files
40 | %{_bindir}/%{name}
41 |
42 | %clean
43 | rm -rf $RPM_BUILD_ROOT
44 |
45 |
46 | %changelog
47 | * Mon Nov 17 2019 Grigory Smolkin - 2.2.6-1
48 | - Initial release.
49 |
--------------------------------------------------------------------------------
/packaging/pkg/specs/rpm/rpmbuild/SPECS/pg_probackup.spec:
--------------------------------------------------------------------------------
1 | %global version @PKG_VERSION@
2 | %global release @PKG_RELEASE@
3 | %global hash @PKG_HASH@
4 | %global pgsql_major @PG_VERSION@
5 | %global pgsql_full @PG_FULL_VERSION@
6 |
7 | Name: pg_probackup-%{pgsql_major}
8 | Version: %{version}
9 | Release: %{release}.%{hash}
10 | Summary: Backup utility for PostgreSQL
11 | Group: Applications/Databases
12 | License: BSD
13 | Url: http://postgrespro.ru/
14 | Source0: http://ftp.postgresql.org/pub/source/v%{pgsql_full}/postgresql-%{pgsql_major}.tar.bz2
15 | Source1: pg_probackup-%{version}.tar.bz2
16 | BuildRequires: gcc make perl glibc-devel openssl-devel gettext zlib-devel
17 |
18 | %description
19 | Backup tool for PostgreSQL.
20 |
21 | %prep
22 | %setup -q -b1 -n postgresql-%{pgsql_full}
23 |
24 | %build
25 | mv %{_builddir}/pg_probackup-%{version} contrib/pg_probackup
26 | ./configure --enable-debug --without-readline
27 | make -C 'src/common'
28 | make -C 'src/port'
29 | make -C 'src/interfaces'
30 | cd contrib/pg_probackup && make
31 |
32 | %install
33 | %{__mkdir} -p %{buildroot}%{_bindir}
34 | %{__install} -p -m 755 contrib/pg_probackup/pg_probackup %{buildroot}%{_bindir}/%{name}
35 |
36 | %files
37 | %{_bindir}/%{name}
38 |
39 | %clean
40 | rm -rf $RPM_BUILD_ROOT
41 |
42 |
43 | %changelog
44 | * Wed Feb 9 2018 Grigory Smolkin - %{version}-%{release}.%{hash}
45 | - @PKG_VERSION@
46 |
47 | * Fri Jan 29 2018 Grigory Smolkin - 2.0.14-1
48 | - Initial release.
49 |
--------------------------------------------------------------------------------
/packaging/pkg/tarballs/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postgrespro/pg_probackup/a2510f5fa1845305db5aab0e5476f403fc7a5499/packaging/pkg/tarballs/.gitkeep
--------------------------------------------------------------------------------
/packaging/repo/reprepro-conf/distributions:
--------------------------------------------------------------------------------
1 | Origin: repo.postgrespro.ru
2 | Label: PostgreSQL backup utility pg_probackup
3 | Codename: squeeze
4 | Architectures: amd64 i386 source
5 | Components: main-squeeze
6 | Description: PostgresPro pg_probackup repo
7 | SignWith: yes
8 | Log:
9 | --type=dsc changelog.script
10 |
11 | Origin: repo.postgrespro.ru
12 | Label: PostgreSQL backup utility pg_probackup
13 | Codename: wheezy
14 | Architectures: amd64 i386 source
15 | Components: main-wheezy
16 | Description: PostgresPro pg_probackup repo
17 | SignWith: yes
18 | Log:
19 | --type=dsc changelog.script
20 |
21 | Origin: repo.postgrespro.ru
22 | Label: PostgreSQL backup utility pg_probackup
23 | Codename: jessie
24 | Architectures: amd64 i386 source
25 | Components: main-jessie
26 | Description: PostgresPro pg_probackup repo
27 | SignWith: yes
28 | Log:
29 | --type=dsc changelog.script
30 |
31 | Origin: repo.postgrespro.ru
32 | Label: PostgreSQL backup utility pg_probackup
33 | Codename: bullseye
34 | Architectures: amd64 i386 source
35 | Components: main-bullseye
36 | Description: PostgresPro pg_probackup repo
37 | SignWith: yes
38 | Log:
39 | --type=dsc changelog.script
40 |
41 | Origin: repo.postgrespro.ru
42 | Label: PostgreSQL backup utility pg_probackup
43 | Codename: wily
44 | Architectures: amd64 i386 source
45 | Components: main-wily
46 | Description: PostgresPro pg_probackup repo
47 | SignWith: yes
48 | Log:
49 | --type=dsc changelog.script
50 |
51 | Origin: repo.postgrespro.ru
52 | Label: PostgreSQL backup utility pg_probackup
53 | Codename: precise
54 | Architectures: amd64 i386 source
55 | Components: main-precise
56 | Description: PostgresPro pg_probackup repo
57 | SignWith: yes
58 | Log:
59 | --type=dsc changelog.script
60 |
61 | Origin: repo.postgrespro.ru
62 | Label: PostgreSQL backup utility pg_probackup
63 | Codename: vivid
64 | Architectures: amd64 i386 source
65 | Components: main-vivid
66 | Description: PostgresPro pg_probackup repo
67 | SignWith: yes
68 | Log:
69 | --type=dsc changelog.script
70 |
71 | Origin: repo.postgrespro.ru
72 | Label: PostgreSQL backup utility pg_probackup
73 | Codename: trusty
74 | Architectures: amd64 i386 source
75 | Components: main-trusty
76 | Description: PostgresPro pg_probackup repo
77 | SignWith: yes
78 | Log:
79 | --type=dsc changelog.script
80 |
81 | Origin: repo.postgrespro.ru
82 | Label: PostgreSQL backup utility pg_probackup
83 | Codename: lucid
84 | Architectures: amd64 i386 source
85 | Components: main-lucid
86 | Description: PostgresPro pg_probackup repo
87 | SignWith: yes
88 | Log:
89 | --type=dsc changelog.script
90 |
91 | Origin: repo.postgrespro.ru
92 | Label: PostgreSQL backup utility pg_probackup
93 | Codename: cosmic
94 | Architectures: amd64 i386 source
95 | Components: main-cosmic
96 | Description: PostgresPro pg_probackup repo
97 | SignWith: yes
98 | Log:
99 | --type=dsc changelog.script
100 |
101 | Origin: repo.postgrespro.ru
102 | Label: PostgreSQL backup utility pg_probackup
103 | Codename: xenial
104 | Architectures: amd64 i386 source
105 | Components: main-xenial
106 | Description: PostgresPro pg_probackup repo
107 | SignWith: yes
108 | Log:
109 | --type=dsc changelog.script
110 |
111 | Origin: repo.postgrespro.ru
112 | Label: PostgreSQL backup utility pg_probackup
113 | Codename: yakkety
114 | Architectures: amd64 i386 source
115 | Components: main-yakkety
116 | Description: PostgresPro pg_probackup repo
117 | SignWith: yes
118 | Log:
119 | --type=dsc changelog.script
120 |
121 | Origin: repo.postgrespro.ru
122 | Label: PostgreSQL backup utility pg_probackup
123 | Codename: zesty
124 | Architectures: amd64 i386 source
125 | Components: main-zesty
126 | Description: PostgresPro pg_probackup repo
127 | SignWith: yes
128 | Log:
129 | --type=dsc changelog.script
130 |
131 | Origin: repo.postgrespro.ru
132 | Label: PostgreSQL backup utility pg_probackup
133 | Codename: stretch
134 | Architectures: amd64 i386 source
135 | Components: main-stretch
136 | Description: PostgresPro pg_probackup repo
137 | SignWith: yes
138 | Log:
139 | --type=dsc changelog.script
140 |
141 | Origin: repo.postgrespro.ru
142 | Label: PostgreSQL backup utility pg_probackup
143 | Codename: buster
144 | Architectures: amd64 i386 source
145 | Components: main-buster
146 | Description: PostgresPro pg_probackup repo
147 | SignWith: yes
148 | Log:
149 | --type=dsc changelog.script
150 |
151 | Origin: repo.postgrespro.ru
152 | Label: PostgreSQL backup utility pg_probackup
153 | Codename: artful
154 | Architectures: amd64 i386 source
155 | Components: main-artful
156 | Description: PostgresPro pg_probackup repo
157 | SignWith: yes
158 | Log:
159 | --type=dsc changelog.script
160 |
161 | Origin: repo.postgrespro.ru
162 | Label: PostgreSQL backup utility pg_probackup
163 | Codename: bionic
164 | Architectures: amd64 i386 source
165 | Components: main-bionic
166 | Description: PostgresPro pg_probackup repo
167 | SignWith: yes
168 | Log:
169 | --type=dsc changelog.script
170 |
171 | Origin: repo.postgrespro.ru
172 | Label: PostgreSQL backup utility pg_probackup
173 | Codename: focal
174 | Architectures: amd64 i386 source
175 | Components: main-focal
176 | Description: PostgresPro pg_probackup repo
177 | SignWith: yes
178 | Log:
179 | --type=dsc changelog.script
180 |
--------------------------------------------------------------------------------
/packaging/repo/rpm-conf/rpmmacros:
--------------------------------------------------------------------------------
1 | %_signature gpg
2 | %_gpg_path /root/.gnupg
3 | %_gpg_name PostgreSQL Professional
4 | %_gpgbin /usr/bin/gpg
5 | %_gpg_check_password_cmd /bin/true
6 |
--------------------------------------------------------------------------------
/packaging/repo/scripts/alt.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -exu
9 | set -o errexit
10 | set -o pipefail
11 |
12 | # fix https://github.com/moby/moby/issues/23137
13 | ulimit -n 1024
14 |
15 | export INPUT_DIR=/app/in #dir with builded rpm
16 | export OUT_DIR=/app/www/${PBK_PKG_REPO}
17 |
18 | apt-get update -y
19 | apt-get install -qq -y apt-repo-tools gnupg rsync perl less wget
20 |
21 | if [[ ${PBK_EDITION} == '' ]] ; then
22 | REPO_SUFFIX='vanilla'
23 | FORK='PostgreSQL'
24 | else
25 | REPO_SUFFIX='forks'
26 | FORK='PostgresPro'
27 | fi
28 |
29 | cd $INPUT_DIR
30 |
31 | cp -arv /app/repo/$PBK_PKG_REPO/gnupg /root/.gnupg
32 | chmod -R 0600 /root/.gnupg
33 | for pkg in $(ls); do
34 | for pkg_full_version in $(ls ./$pkg); do
35 |
36 | # THere is no std/ent packages for PG 9.5
37 | if [[ ${pkg} == 'pg_probackup-std-9.5' ]] || [[ ${pkg} == 'pg_probackup-ent-9.5' ]] ; then
38 | continue;
39 | fi
40 |
41 | RPM_DIR=${OUT_DIR}/rpm/${pkg_full_version}/altlinux-p${DISTRIB_VERSION}/x86_64/RPMS.${REPO_SUFFIX}
42 | mkdir -p "$RPM_DIR"
43 | cp -arv $INPUT_DIR/$pkg/$pkg_full_version/RPMS/x86_64/* $RPM_DIR/
44 |
45 | genbasedir --architecture=x86_64 --architectures=x86_64 --origin=repo.postgrespro.ru \
46 | --label="${FORK} backup utility pg_probackup" --description "${FORK} pg_probackup repo" \
47 | --version=$pkg_full_version --bloat --progress --create \
48 | --topdir=${OUT_DIR}/rpm/${pkg_full_version}/altlinux-p${DISTRIB_VERSION} x86_64 ${REPO_SUFFIX}
49 |
50 | # SRPM is available only for vanilla
51 | if [[ ${PBK_EDITION} == '' ]] ; then
52 | SRPM_DIR=${OUT_DIR}/srpm/${pkg_full_version}/altlinux-p${DISTRIB_VERSION}/x86_64/SRPMS.${REPO_SUFFIX}
53 | mkdir -p "$SRPM_DIR"
54 | cp -arv $INPUT_DIR/$pkg/$pkg_full_version/SRPMS/* $SRPM_DIR/
55 |
56 | genbasedir --architecture=x86_64 --architectures=x86_64 --origin=repo.postgrespro.ru \
57 | --label="${FORK} backup utility pg_probackup sources" --description "${FORK} pg_probackup repo" \
58 | --version=$pkg_full_version --bloat --progress --create \
59 | --topdir=${OUT_DIR}/srpm/${pkg_full_version}/altlinux-p${DISTRIB_VERSION} x86_64 ${REPO_SUFFIX}
60 | fi
61 | done
62 | done
63 |
--------------------------------------------------------------------------------
/packaging/repo/scripts/deb.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -exu
9 | set -o errexit
10 | set -o pipefail
11 |
12 | # fix https://github.com/moby/moby/issues/23137
13 | ulimit -n 1024
14 |
15 | export INPUT_DIR=/app/in # dir with builded deb
16 | export OUT_DIR=/app/www/${PBK_PKG_REPO}
17 | #export REPO_DIR=/app/repo
18 |
19 | cd $INPUT_DIR
20 |
21 | export DEB_DIR=$OUT_DIR/deb
22 | export KEYS_DIR=$OUT_DIR/keys
23 | export CONF=/app/repo/reprepro-conf
24 | mkdir -p "$KEYS_DIR"
25 | cp -av /app/repo/${PBK_PKG_REPO}/gnupg /root/.gnupg
26 |
27 | rsync /app/repo/${PBK_PKG_REPO}/gnupg/key.public $KEYS_DIR/GPG-KEY-PG_PROBACKUP
28 | echo -e 'User-agent: *\nDisallow: /' > $OUT_DIR/robots.txt
29 |
30 | mkdir -p $DEB_DIR
31 | cd $DEB_DIR
32 | cp -av $CONF ./conf
33 |
34 | # make remove-debpkg tool
35 | echo -n "#!" > remove-debpkg
36 | echo "/bin/sh" >> remove-debpkg
37 | echo "CODENAME=\$1" >> remove-debpkg
38 | echo "DEBFILE=\$2" >> remove-debpkg
39 | echo "DEBNAME=\`basename \$DEBFILE | sed -e 's/_.*//g'\`" >> remove-debpkg
40 | echo "reprepro --waitforlock 5 remove \$CODENAME \$DEBNAME" >> remove-debpkg
41 | chmod +x remove-debpkg
42 |
43 | #find $INPUT_DIR/ -name '*.changes' -exec reprepro -P optional -Vb . include ${CODENAME} {} \;
44 | find $INPUT_DIR -name "*${CODENAME}*.deb" -exec ./remove-debpkg $CODENAME {} \;
45 | find $INPUT_DIR -name "*${CODENAME}*.dsc" -exec reprepro --waitforlock 5 -i undefinedtarget --ignore=missingfile -P optional -S main -Vb . includedsc $CODENAME {} \;
46 | find $INPUT_DIR -name "*${CODENAME}*.deb" -exec reprepro --waitforlock 5 -i undefinedtarget --ignore=missingfile -P optional -Vb . includedeb $CODENAME {} \;
47 | reprepro export $CODENAME
48 |
49 | rm -f remove-debpkg
50 | rm -rf ./conf
51 | rm -rf /root/.gnupg
52 |
--------------------------------------------------------------------------------
/packaging/repo/scripts/rpm.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -ex
9 | set -o errexit
10 | set -o pipefail
11 |
12 | # fix https://github.com/moby/moby/issues/23137
13 | ulimit -n 1024
14 |
15 | export INPUT_DIR=/app/in #dir with builded rpm
16 | export OUT_DIR=/app/www/${PBK_PKG_REPO}
17 | export KEYS_DIR=$OUT_DIR/keys
18 |
19 | # deploy keys
20 | mkdir -p "$KEYS_DIR"
21 | rsync /app/repo/$PBK_PKG_REPO/gnupg/key.public $KEYS_DIR/GPG-KEY-PG_PROBACKUP
22 | chmod 755 $KEYS_DIR
23 | echo -e 'User-agent: *\nDisallow: /' > $OUT_DIR/robots.txt
24 |
25 | cd $INPUT_DIR
26 |
27 | cp -arv /app/repo/rpm-conf/rpmmacros /root/.rpmmacros
28 | cp -arv /app/repo/$PBK_PKG_REPO/gnupg /root/.gnupg
29 | chmod -R 0600 /root/.gnupg
30 | chown -R root:root /root/.gnupg
31 |
32 | for pkg in $(ls ${INPUT_DIR}); do
33 | for pkg_full_version in $(ls ${INPUT_DIR}/$pkg); do
34 | if [[ ${PBK_EDITION} == '' ]] ; then
35 | cp $INPUT_DIR/$pkg/$pkg_full_version/RPMS/noarch/pg_probackup-repo-*.noarch.rpm \
36 | $KEYS_DIR/pg_probackup-repo-$DISTRIB.noarch.rpm
37 | else
38 | cp $INPUT_DIR/$pkg/$pkg_full_version/RPMS/noarch/pg_probackup-repo-*.noarch.rpm \
39 | $KEYS_DIR/pg_probackup-repo-forks-$DISTRIB.noarch.rpm
40 | fi
41 |
42 | [ ! -z "$CODENAME" ] && export DISTRIB_VERSION=$CODENAME
43 | RPM_DIR=$OUT_DIR/rpm/$pkg_full_version/${DISTRIB}-${DISTRIB_VERSION}-x86_64
44 | mkdir -p "$RPM_DIR"
45 | cp -arv $INPUT_DIR/$pkg/$pkg_full_version/RPMS/x86_64/* $RPM_DIR/
46 | for f in $(ls $RPM_DIR/*.rpm); do rpm --addsign $f || exit 1; done
47 | createrepo $RPM_DIR/
48 |
49 | if [[ ${PBK_EDITION} == '' ]] ; then
50 | SRPM_DIR=$OUT_DIR/srpm/$pkg_full_version/${DISTRIB}-${DISTRIB_VERSION}-x86_64
51 | mkdir -p "$SRPM_DIR"
52 | cp -arv $INPUT_DIR/$pkg/$pkg_full_version/SRPMS/* $SRPM_DIR/
53 | for f in $(ls $SRPM_DIR/*.rpm); do rpm --addsign $f || exit 1; done
54 | createrepo $SRPM_DIR/
55 | fi
56 |
57 | done
58 | done
59 |
--------------------------------------------------------------------------------
/packaging/repo/scripts/suse.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -ex
9 | set -o errexit
10 | set -o pipefail
11 |
12 | # fix https://github.com/moby/moby/issues/23137
13 | ulimit -n 1024
14 |
15 | # currenctly we do not build std|ent packages for Suse
16 | if [[ ${PBK_EDITION} != '' ]] ; then
17 | exit 0
18 | fi
19 |
20 | export INPUT_DIR=/app/in #dir with builded rpm
21 | export OUT_DIR=/app/www/${PBK_PKG_REPO}
22 | export KEYS_DIR=$OUT_DIR/keys
23 | # deploy keys
24 |
25 | zypper install -y createrepo
26 | rm -rf /root/.gnupg
27 |
28 | cd $INPUT_DIR
29 |
30 | mkdir -p $KEYS_DIR
31 | chmod 755 $KEYS_DIR
32 | rsync /app/repo/$PBK_PKG_REPO/gnupg/key.public $KEYS_DIR/GPG-KEY-PG_PROBACKUP
33 |
34 | echo -e 'User-agent: *\nDisallow: /' > $OUT_DIR/robots.txt
35 |
36 | cp -arv /app/repo/rpm-conf/rpmmacros /root/.rpmmacros
37 | cp -arv /app/repo/$PBK_PKG_REPO/gnupg /root/.gnupg
38 | chmod -R 0600 /root/.gnupg
39 |
40 | for pkg in $(ls); do
41 | for pkg_full_version in $(ls ./$pkg); do
42 |
43 | cp $INPUT_DIR/$pkg/$pkg_full_version/RPMS/noarch/pg_probackup-repo-*.noarch.rpm \
44 | $KEYS_DIR/pg_probackup-repo-$DISTRIB.noarch.rpm
45 | [ ! -z "$CODENAME" ] && export DISTRIB_VERSION=$CODENAME
46 | RPM_DIR=$OUT_DIR/rpm/$pkg_full_version/${DISTRIB}-${DISTRIB_VERSION}-x86_64
47 | SRPM_DIR=$OUT_DIR/srpm/$pkg_full_version/${DISTRIB}-${DISTRIB_VERSION}-x86_64
48 |
49 | # rm -rf "$RPM_DIR" && mkdir -p "$RPM_DIR"
50 | # rm -rf "$SRPM_DIR" && mkdir -p "$SRPM_DIR"
51 | mkdir -p "$RPM_DIR"
52 | mkdir -p "$SRPM_DIR"
53 |
54 | cp -arv $INPUT_DIR/$pkg/$pkg_full_version/RPMS/x86_64/* $RPM_DIR/
55 | cp -arv $INPUT_DIR/$pkg/$pkg_full_version/SRPMS/* $SRPM_DIR/
56 |
57 | for f in $(ls $RPM_DIR/*.rpm); do rpm --addsign $f || exit 1; done
58 | for f in $(ls $SRPM_DIR/*.rpm); do rpm --addsign $f || exit 1; done
59 |
60 | createrepo $RPM_DIR/
61 | createrepo $SRPM_DIR/
62 |
63 | # rpm --addsign $RPM_DIR/repodata/repomd.xml
64 | # rpm --addsign $SRPM_DIR/repodata/repomd.xml
65 |
66 | gpg --batch --yes -a --detach-sign $RPM_DIR/repodata/repomd.xml
67 | gpg --batch --yes -a --detach-sign $SRPM_DIR/repodata/repomd.xml
68 |
69 | cp -a /root/.gnupg/key.public $RPM_DIR/repodata/repomd.xml.key
70 | cp -a /root/.gnupg/key.public $SRPM_DIR/repodata/repomd.xml.key
71 | done
72 | done
73 |
--------------------------------------------------------------------------------
/packaging/test/Makefile.alt:
--------------------------------------------------------------------------------
1 | # ALT 9
2 | build/test_alt_9_9.6:
3 | $(call test_alt,alt,9,,9.6,9.6.24)
4 | touch build/test_alt_9_9.6
5 |
6 | build/test_alt_9_10:
7 | $(call test_alt,alt,9,,10,10.19)
8 | touch build/test_alt_9_10
9 |
10 | build/test_alt_9_11:
11 | $(call test_alt,alt,9,,11,11.14)
12 | touch build/test_alt_9_11
13 |
14 | build/test_alt_9_12:
15 | $(call test_alt,alt,9,,12,12.9)
16 | touch build/test_alt_9_12
17 |
18 | build/test_alt_9_13:
19 | $(call test_alt,alt,9,,13,13.5)
20 | touch build/test_alt_9_13
21 |
22 | build/test_alt_9_14:
23 | $(call test_alt,alt,9,,14,14.1)
24 | touch build/test_alt_9_14
25 |
26 | # ALT 8
27 | build/test_alt_8_9.6:
28 | $(call test_alt,alt,8,,9.6,9.6.24)
29 | touch build/test_alt_8_9.6
30 |
31 | build/test_alt_8_10:
32 | $(call test_alt,alt,8,,10,10.19)
33 | touch build/test_alt_8_10
34 |
35 | build/test_alt_8_11:
36 | $(call test_alt,alt,8,,11,11.14)
37 | touch build/test_alt_8_11
38 |
39 | build/test_alt_8_12:
40 | $(call test_alt,alt,8,,12,12.9)
41 | touch build/test_alt_8_12
42 |
43 | build/test_alt_8_13:
44 | $(call test_alt,alt,8,,13,13.5)
45 | touch build/test_alt_8_13
46 |
47 | build/test_alt_8_14:
48 | $(call test_alt,alt,8,,14,14.1)
49 | touch build/test_alt_8_14
50 |
51 |
--------------------------------------------------------------------------------
/packaging/test/Makefile.centos:
--------------------------------------------------------------------------------
1 | # CENTOS 7
2 | build/test_centos_7_9.6:
3 | $(call test_rpm,centos,7,,9.6,9.6.24)
4 | touch build/test_centos_7_9.6
5 |
6 | build/test_centos_7_10:
7 | $(call test_rpm,centos,7,,10,10.19)
8 | touch build/test_centos_7_10
9 |
10 | build/test_centos_7_11:
11 | $(call test_rpm,centos,7,,11,11.14)
12 | touch build/test_centos_7_11
13 |
14 | build/test_centos_7_12:
15 | $(call test_rpm,centos,7,,12,12.9)
16 | touch build/test_centos_7_12
17 |
18 | build/test_centos_7_13:
19 | $(call test_rpm,centos,7,,13,13.5)
20 | touch build/test_centos_7_13
21 |
22 | build/test_centos_7_14:
23 | $(call test_rpm,centos,7,,14,14.1)
24 | touch build/test_centos_7_14
25 |
26 | # CENTOS 8
27 | build/test_centos_8_9.6:
28 | $(call test_rpm,centos,8,,9.6,9.6.24)
29 | touch build/test_centos_8_9.6
30 |
31 | build/test_centos_8_10:
32 | $(call test_rpm,centos,8,,10,10.19)
33 | touch build/test_centos_8_10
34 |
35 | build/test_centos_8_11:
36 | $(call test_rpm,centos,8,,11,11.14)
37 | touch build/test_centos_8_11
38 |
39 | build/test_centos_8_12:
40 | $(call test_rpm,centos,8,,12,12.9)
41 | touch build/test_centos_8_12
42 |
43 | build/test_centos_8_13:
44 | $(call test_rpm,centos,8,,13,13.5)
45 | touch build/test_centos_8_13
46 |
47 | build/test_centos_8_14:
48 | $(call test_rpm,centos,8,,14,14.1)
49 | touch build/test_centos_8_14
50 |
--------------------------------------------------------------------------------
/packaging/test/Makefile.debian:
--------------------------------------------------------------------------------
1 | # DEBIAN 9
2 | build/test_debian_9_9.6:
3 | $(call test_deb,debian,9,stretch,9.6,9.6.24)
4 | touch build/test_debian_9_9.6
5 |
6 | build/test_debian_9_10:
7 | $(call test_deb,debian,9,stretch,10,10.19)
8 | touch build/test_debian_9_10
9 |
10 | build/test_debian_9_11:
11 | $(call test_deb,debian,9,stretch,11,11.14)
12 | touch build/test_debian_9_11
13 |
14 | build/test_debian_9_12:
15 | $(call test_deb,debian,9,stretch,12,12.9)
16 | touch build/test_debian_9_12
17 |
18 | build/test_debian_9_13:
19 | $(call test_deb,debian,9,stretch,13,13.5)
20 | touch build/test_debian_9_13
21 |
22 | build/test_debian_9_14:
23 | $(call test_deb,debian,9,stretch,14,14.1)
24 | touch build/test_debian_9_14
25 |
26 | # DEBIAN 10
27 | build/test_debian_10_9.6:
28 | $(call test_deb,debian,10,buster,9.6,9.6.24)
29 | touch build/test_debian_10_9.6
30 |
31 | build/test_debian_10_10:
32 | $(call test_deb,debian,10,buster,10,10.19)
33 | touch build/test_debian_10_10
34 |
35 | build/test_debian_10_11:
36 | $(call test_deb,debian,10,buster,11,11.14)
37 | touch build/test_debian_10_11
38 |
39 | build/test_debian_10_12:
40 | $(call test_deb,debian,10,buster,12,12.9)
41 | touch build/test_debian_10_12
42 |
43 | build/test_debian_10_13:
44 | $(call test_deb,debian,10,buster,13,13.5)
45 | touch build/test_debian_10_13
46 |
47 | build/test_debian_10_14:
48 | $(call test_deb,debian,10,buster,14,14.1)
49 | touch build/test_debian_10_14
50 |
51 | # DEBIAN 11
52 | build/test_debian_11_9.6:
53 | $(call test_deb,debian,11,bullseye,9.6,9.6.24)
54 | touch build/test_debian_11_9.6
55 |
56 | build/test_debian_11_10:
57 | $(call test_deb,debian,11,bullseye,10,10.19)
58 | touch build/test_debian_11_10
59 |
60 | build/test_debian_11_11:
61 | $(call test_deb,debian,11,bullseye,11,11.14)
62 | touch build/test_debian_11_11
63 |
64 | build/test_debian_11_12:
65 | $(call test_deb,debian,11,bullseye,12,12.9)
66 | touch build/test_debian_11_12
67 |
68 | build/test_debian_11_13:
69 | $(call test_deb,debian,11,bullseye,13,13.5)
70 | touch build/test_debian_11_13
71 |
72 | build/test_debian_11_14:
73 | $(call test_deb,debian,11,bullseye,14,14.1)
74 | touch build/test_debian_11_14
75 |
--------------------------------------------------------------------------------
/packaging/test/Makefile.oraclelinux:
--------------------------------------------------------------------------------
1 | # ORACLE LINUX 7
2 | build/test_oraclelinux_7_9.6:
3 | $(call test_rpm,oraclelinux,7,,9.6,9.6.24)
4 | touch build/test_oraclelinux_7_9.6
5 |
6 | build/test_oraclelinux_7_10:
7 | $(call test_rpm,oraclelinux,7,,10,10.19)
8 | touch build/test_oraclelinux_7_10
9 |
10 | build/test_oraclelinux_7_11:
11 | $(call test_rpm,oraclelinux,7,,11,11.14)
12 | touch build/test_oraclelinux_7_11
13 |
14 | build/test_oraclelinux_7_12:
15 | $(call test_rpm,oraclelinux,7,,12,12.9)
16 | touch build/test_oraclelinux_7_12
17 |
18 | build/test_oraclelinux_7_13:
19 | $(call test_rpm,oraclelinux,7,,13,13.5)
20 | touch build/test_oraclelinux_7_13
21 |
22 | build/test_oraclelinux_7_14:
23 | $(call test_rpm,oraclelinux,7,,14,14.1)
24 | touch build/test_oraclelinux_7_14
25 |
26 | # ORACLE LINUX 8
27 | build/test_oraclelinux_8_9.6:
28 | $(call test_rpm,oraclelinux,8,,9.6,9.6.24)
29 | touch build/test_oraclelinux_8_9.6
30 |
31 | build/test_oraclelinux_8_10:
32 | $(call test_rpm,oraclelinux,8,,10,10.19)
33 | touch build/test_oraclelinux_8_10
34 |
35 | build/test_oraclelinux_8_11:
36 | $(call test_rpm,oraclelinux,8,,11,11.14)
37 | touch build/test_oraclelinux_8_11
38 |
39 | build/test_oraclelinux_8_12:
40 | $(call test_rpm,oraclelinux,8,,12,12.9)
41 | touch build/test_oraclelinux_8_12
42 |
43 | build/test_oraclelinux_8_13:
44 | $(call test_rpm,oraclelinux,8,,13,13.5)
45 | touch build/test_oraclelinux_8_13
46 |
47 | build/test_oraclelinux_8_14:
48 | $(call test_rpm,oraclelinux,8,,14,14.1)
49 | touch build/test_oraclelinux_8_14
50 |
--------------------------------------------------------------------------------
/packaging/test/Makefile.rhel:
--------------------------------------------------------------------------------
1 | # RHEL 7
2 | build/test_rhel_7_9.6:
3 | $(call test_rpm,rhel,7,7Server,9.6,9.6.24)
4 | touch build/test_rhel_7_9.6
5 |
6 | build/test_rhel_7_10:
7 | $(call test_rpm,rhel,7,7Server,10,10.19)
8 | touch build/test_rhel_7_10
9 |
10 | build/test_rhel_7_11:
11 | $(call test_rpm,rhel,7,7Server,11,11.14)
12 | touch build/test_rhel_7_11
13 |
14 | build/test_rhel_7_12:
15 | $(call test_rpm,rhel,7,7Server,12,12.9)
16 | touch build/test_rhel_7_12
17 |
18 | build/test_rhel_7_13:
19 | $(call test_rpm,rhel,7,7Server,13,13.5)
20 | touch build/test_rhel_7_13
21 |
22 | build/test_rhel_7_14:
23 | $(call test_rpm,rhel,7,7Server,14,14.1)
24 | touch build/test_rhel_7_14
25 |
26 | # RHEL 8
27 | build/test_rhel_8_9.6:
28 | $(call test_rpm,rhel,8,8Server,9.6,9.6.24)
29 | touch build/test_rhel_8_9.6
30 |
31 | build/test_rhel_8_10:
32 | $(call test_rpm,rhel,8,8Server,10,10.19)
33 | touch build/test_rhel_8_10
34 |
35 | build/test_rhel_8_11:
36 | $(call test_rpm,rhel,8,8Server,11,11.14)
37 | touch build/test_rhel_8_11
38 |
39 | build/test_rhel_8_12:
40 | $(call test_rpm,rhel,8,8Server,12,12.9)
41 | touch build/test_rhel_8_12
42 |
43 | build/test_rhel_8_13:
44 | $(call test_rpm,rhel,8,8Server,13,13.5)
45 | touch build/test_rhel_8_13
46 |
47 | build/test_rhel_8_14:
48 | $(call test_rpm,rhel,8,8Server,14,14.1)
49 | touch build/test_rhel_8_14
50 |
--------------------------------------------------------------------------------
/packaging/test/Makefile.suse:
--------------------------------------------------------------------------------
1 | # Suse 15.1
2 | build/test_suse_15.1_9.6:
3 | $(call test_suse,suse,15.1,,9.6,9.6.24)
4 | touch build/test_suse_15.1_9.6
5 |
6 | build/test_suse_15.1_10:
7 | $(call test_suse,suse,15.1,,10,10.19)
8 | touch build/test_suse_15.1_10
9 |
10 | build/test_suse_15.1_11:
11 | $(call test_suse,suse,15.1,,11,11.14)
12 | touch build/test_suse_15.1_11
13 |
14 | build/test_suse_15.1_12:
15 | $(call test_suse,suse,15.1,,12,12.9)
16 | touch build/test_suse_15.1_12
17 |
18 | build/test_suse_15.1_13:
19 | $(call test_suse,suse,15.1,,13,13.5)
20 | touch build/test_suse_15.1_13
21 |
22 | build/test_suse_15.1_14:
23 | $(call test_suse,suse,15.1,,14,14.1)
24 | touch build/test_suse_15.1_14
25 |
26 | # Suse 15.2
27 | build/test_suse_15.2_9.6:
28 | $(call test_suse,suse,15.2,,9.6,9.6.24)
29 | touch build/test_suse_15.2_9.6
30 |
31 | build/test_suse_15.2_10:
32 | $(call test_suse,suse,15.2,,10,10.19)
33 | touch build/test_suse_15.2_10
34 |
35 | build/test_suse_15.2_11:
36 | $(call test_suse,suse,15.2,,11,11.14)
37 | touch build/test_suse_15.2_11
38 |
39 | build/test_suse_15.2_12:
40 | $(call test_suse,suse,15.2,,12,12.9)
41 | touch build/test_suse_15.2_12
42 |
43 | build/test_suse_15.2_13:
44 | $(call test_suse,suse,15.2,,13,13.5)
45 | touch build/test_suse_15.2_13
46 |
47 | build/test_suse_15.2_14:
48 | $(call test_suse,suse,15.2,,14,14.1)
49 | touch build/test_suse_15.2_14
50 |
--------------------------------------------------------------------------------
/packaging/test/Makefile.ubuntu:
--------------------------------------------------------------------------------
1 | # UBUNTU 18.04
2 | build/test_ubuntu_18.04_9.6:
3 | $(call test_deb,ubuntu,18.04,bionic,9.6,9.6.24)
4 | touch build/test_ubuntu_18.04_9.6
5 |
6 | build/test_ubuntu_18.04_10:
7 | $(call test_deb,ubuntu,18.04,bionic,10,10.19)
8 | touch build/test_ubuntu_18.04_10
9 |
10 | build/test_ubuntu_18.04_11:
11 | $(call test_deb,ubuntu,18.04,bionic,11,11.14)
12 | touch build/test_ubuntu_18.04_11
13 |
14 | build/test_ubuntu_18.04_12:
15 | $(call test_deb,ubuntu,18.04,bionic,12,12.9)
16 | touch build/test_ubuntu_18.04_12
17 |
18 | build/test_ubuntu_18.04_13:
19 | $(call test_deb,ubuntu,18.04,bionic,13,13.5)
20 | touch build/test_ubuntu_18.04_13
21 |
22 | build/test_ubuntu_18.04_14:
23 | $(call test_deb,ubuntu,18.04,bionic,14,14.1)
24 | touch build/test_ubuntu_18.04_14
25 |
26 | # UBUNTU 20.04
27 | build/test_ubuntu_20.04_9.6:
28 | $(call test_deb,ubuntu,20.04,focal,9.6,9.6.24)
29 | touch build/test_ubuntu_20.04_9.6
30 |
31 | build/test_ubuntu_20.04_10:
32 | $(call test_deb,ubuntu,20.04,focal,10,10.19)
33 | touch build/test_ubuntu_20.04_10
34 |
35 | build/test_ubuntu_20.04_11:
36 | $(call test_deb,ubuntu,20.04,focal,11,11.14)
37 | touch build/test_ubuntu_20.04_11
38 |
39 | build/test_ubuntu_20.04_12:
40 | $(call test_deb,ubuntu,20.04,focal,12,12.9)
41 | touch build/test_ubuntu_20.04_12
42 |
43 | build/test_ubuntu_20.04_13:
44 | $(call test_deb,ubuntu,20.04,focal,13,13.5)
45 | touch build/test_ubuntu_20.04_13
46 |
47 | build/test_ubuntu_20.04_14:
48 | $(call test_deb,ubuntu,20.04,focal,14,14.1)
49 | touch build/test_ubuntu_20.04_14
50 |
--------------------------------------------------------------------------------
/packaging/test/scripts/alt.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -xe
4 | set -o pipefail
5 |
6 | ulimit -n 1024
7 |
8 | apt-get clean -y
9 | apt-get update -y
10 | apt-get install nginx su -y
11 |
12 | adduser nginx
13 |
14 | cat < /etc/nginx/nginx.conf
15 | user nginx;
16 | worker_processes 1;
17 | error_log /var/log/nginx/error.log;
18 | events {
19 | worker_connections 1024;
20 | }
21 | http {
22 | server {
23 | listen 80 default;
24 | root /app/www;
25 | }
26 | }
27 | EOF
28 |
29 | /etc/init.d/nginx start
30 |
31 | # install POSTGRESQL
32 |
33 | export PGDATA=/var/lib/pgsql/${PG_VERSION}/data
34 |
35 | # install old packages
36 | echo "rpm http://repo.postgrespro.ru/pg_probackup/rpm/latest/altlinux-p7 x86_64 vanilla" > /etc/apt/sources.list.d/pg_probackup.list
37 | apt-get update
38 | apt-get install ${PKG_NAME} -y
39 | ${PKG_NAME} --help
40 | ${PKG_NAME} --version
41 |
42 | # install new packages
43 | echo "127.0.0.1 repo.postgrespro.ru" >> /etc/hosts
44 | echo "rpm http://repo.postgrespro.ru/pg_probackup/rpm/latest/altlinux-p${DISTRIB_VERSION} x86_64 vanilla" > /etc/apt/sources.list.d/pg_probackup.list
45 | echo "rpm [p${DISTRIB_VERSION}] http://mirror.yandex.ru/altlinux p${DISTRIB_VERSION}/branch/x86_64 debuginfo" > /etc/apt/sources.list.d/debug.list
46 |
47 | apt-get update -y
48 | apt-get install ${PKG_NAME} -y
49 | ${PKG_NAME} --help
50 | ${PKG_NAME} --version
51 |
52 | exit 0
53 |
54 | # TODO: run init, add-instance, backup and restore
55 | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/pgbench --no-vacuum -t 1000 -c 1"
56 | su postgres -c "${PKG_NAME} backup --instance=node -b page -B /tmp/backup -D ${PGDATA} --no-sync --compress"
57 | su postgres -c "${PKG_NAME} show --instance=node -B /tmp/backup -D ${PGDATA}"
58 |
59 | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/pg_ctl stop -D ${PGDATA}"
60 | rm -rf ${PGDATA}
61 |
62 | su postgres -c "${PKG_NAME} restore --instance=node -B /tmp/backup -D ${PGDATA} --no-sync"
63 | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/pg_ctl start -w -D ${PGDATA}"
64 |
65 | sleep 5
66 |
67 | echo "select count(*) from pgbench_accounts;" | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/psql" || exit 1
68 |
69 | exit 0 # while PG12 is not working
70 |
71 | # SRC PACKAGE
72 | cd /mnt
73 |
--------------------------------------------------------------------------------
/packaging/test/scripts/alt_forks.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -xe
9 | set -o pipefail
10 |
11 | ulimit -n 1024
12 |
13 | if [ ${PBK_EDITION} == 'ent' ]; then
14 | exit 0
15 | fi
16 |
17 | apt-get clean -y
18 | apt-get update -y
19 | apt-get install nginx su -y
20 |
21 | adduser nginx
22 |
23 | cat < /etc/nginx/nginx.conf
24 | user nginx;
25 | worker_processes 1;
26 | error_log /var/log/nginx/error.log;
27 | events {
28 | worker_connections 1024;
29 | }
30 | http {
31 | server {
32 | listen 80 default;
33 | root /app/www;
34 | }
35 | }
36 | EOF
37 |
38 | /etc/init.d/nginx start
39 |
40 | # install POSTGRESQL
41 |
42 | export PGDATA=/var/lib/pgsql/${PG_VERSION}/data
43 |
44 | # install old packages
45 |
46 | # install new packages
47 | echo "127.0.0.1 repo.postgrespro.ru" >> /etc/hosts
48 | echo "rpm http://repo.postgrespro.ru/pg_probackup-forks/rpm/latest/altlinux-p${DISTRIB_VERSION} x86_64 forks" > /etc/apt/sources.list.d/pg_probackup.list
49 | echo "rpm [p${DISTRIB_VERSION}] http://mirror.yandex.ru/altlinux p${DISTRIB_VERSION}/branch/x86_64 debuginfo" > /etc/apt/sources.list.d/debug.list
50 |
51 | apt-get update -y
52 | apt-get install ${PKG_NAME} ${PKG_NAME}-debuginfo -y
53 | ${PKG_NAME} --help
54 | ${PKG_NAME} --version
55 |
56 | exit 0
57 |
58 | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/pgbench --no-vacuum -t 1000 -c 1"
59 | su postgres -c "${PKG_NAME} backup --instance=node -b page -B /tmp/backup -D ${PGDATA}"
60 | su postgres -c "${PKG_NAME} show --instance=node -B /tmp/backup -D ${PGDATA}"
61 |
62 | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/pg_ctl stop -D ${PGDATA}"
63 | rm -rf ${PGDATA}
64 |
65 | su postgres -c "${PKG_NAME} restore --instance=node -B /tmp/backup -D ${PGDATA}"
66 | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/pg_ctl start -w -D ${PGDATA}"
67 |
68 | sleep 5
69 |
70 | echo "select count(*) from pgbench_accounts;" | su postgres -c "/usr/pgsql-${PG_VERSION}/bin/psql" || exit 1
71 |
72 | exit 0 # while PG12 is not working
73 |
74 | # SRC PACKAGE
75 | cd /mnt
76 |
--------------------------------------------------------------------------------
/packaging/test/scripts/suse.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright Notice:
4 | # © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5 | # Distributed under Apache License 2.0
6 | # Распространяется по лицензии Apache 2.0
7 |
8 | set -xe
9 | set -o pipefail
10 |
11 | # fix https://github.com/moby/moby/issues/23137
12 | ulimit -n 1024
13 |
14 | # currenctly we do not build std|ent packages for Suse
15 | if [[ ${PBK_EDITION} != '' ]] ; then
16 | exit 0
17 | fi
18 |
19 | PG_TOG=$(echo $PG_VERSION | sed 's|\.||g')
20 |
21 | if [ ${PG_TOG} == '13' ]; then # no packages for PG13
22 | exit 0
23 | fi
24 |
25 | if [ ${PG_TOG} == '11' ]; then # no packages for PG11
26 | exit 0
27 | fi
28 |
29 | if [ ${PG_TOG} == '95' ]; then # no packages for PG95
30 | exit 0
31 | fi
32 |
33 | zypper install -y nginx
34 | if ! getent group nginx > /dev/null 2>&1 ; then
35 | addgroup --system --quiet nginx
36 | fi
37 | if ! getent passwd nginx > /dev/null 2>&1 ; then
38 | adduser --quiet \
39 | --system --disabled-login --ingroup nginx \
40 | --home /var/run/nginx/ --no-create-home \
41 | nginx
42 | fi
43 |
44 | useradd postgres
45 |
46 | cat < /etc/nginx/nginx.conf
47 | user nginx;
48 | worker_processes 1;
49 | error_log /var/log/nginx/error.log;
50 | events {
51 | worker_connections 1024;
52 | }
53 | http {
54 | server {
55 | listen 80 default;
56 | root /app/www;
57 | }
58 | }
59 | EOF
60 | nginx -s reload || (pkill -9 nginx || nginx -c /etc/nginx/nginx.conf &)
61 |
62 | # install POSTGRESQL
63 | zypper install -y postgresql${PG_TOG} postgresql${PG_TOG}-server postgresql${PG_TOG}-contrib
64 | export PGDATA=/tmp/data
65 |
66 | # install old packages
67 | zypper install --allow-unsigned-rpm -y http://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-${DISTRIB}.noarch.rpm
68 | zypper --gpg-auto-import-keys install -y ${PKG_NAME}
69 | ${PKG_NAME} --help
70 | ${PKG_NAME} --version
71 |
72 | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/initdb -k -D ${PGDATA}"
73 | echo "fsync=off" >> ${PGDATA}/postgresql.auto.conf
74 | echo "wal_level=hot_standby" >> ${PGDATA}/postgresql.auto.conf
75 | echo "archive_mode=on" >> ${PGDATA}/postgresql.auto.conf
76 | echo "archive_command='${PKG_NAME} archive-push --no-sync -B /tmp/backup --instance=node --wal-file-path %p --wal-file-name %f'" >> ${PGDATA}/postgresql.auto.conf
77 | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/pg_ctl start -D ${PGDATA}"
78 | sleep 5
79 |
80 | su postgres -c "${PKG_NAME} init -B /tmp/backup"
81 | su postgres -c "${PKG_NAME} add-instance --instance=node -B /tmp/backup -D ${PGDATA}"
82 | su postgres -c "${PKG_NAME} backup --instance=node --compress -b full -B /tmp/backup -D ${PGDATA} --no-sync"
83 | su postgres -c "${PKG_NAME} show --instance=node -B /tmp/backup -D ${PGDATA} --archive"
84 |
85 | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/pgbench --no-vacuum -i -s 5"
86 | su postgres -c "${PKG_NAME} backup --instance=node -b page -B /tmp/backup -D ${PGDATA} --no-sync"
87 |
88 | # install new packages
89 | echo "127.0.0.1 repo.postgrespro.ru" >> /etc/hosts
90 | zypper clean all -y
91 |
92 | sed -i "s/https/http/g" /etc/zypp/repos.d/pg_probackup.repo
93 |
94 | zypper update -y ${PKG_NAME}
95 | ${PKG_NAME} --help
96 | ${PKG_NAME} --version
97 |
98 | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/pgbench --no-vacuum -t 1000 -c 1"
99 | su postgres -c "${PKG_NAME} backup --instance=node -b page -B /tmp/backup -D ${PGDATA} --no-sync"
100 |
101 | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/pgbench --no-vacuum -t 1000 -c 1"
102 | su postgres -c "${PKG_NAME} backup --instance=node -b page -B /tmp/backup -D ${PGDATA} --no-sync"
103 | su postgres -c "${PKG_NAME} show --instance=node -B /tmp/backup -D ${PGDATA}"
104 |
105 | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/pg_ctl stop -D ${PGDATA}"
106 | rm -rf ${PGDATA}
107 |
108 | su postgres -c "${PKG_NAME} restore --instance=node -B /tmp/backup -D ${PGDATA} --no-sync"
109 | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/pg_ctl start -w -D ${PGDATA}"
110 |
111 | sleep 5
112 |
113 | echo "select count(*) from pgbench_accounts;" | su postgres -c "/usr/lib/postgresql${PG_TOG}/bin/psql" || exit 1
114 |
115 | exit 0
116 |
117 | # SRC PACKAGE
118 | cd /mnt
119 | yum install yum-utils rpm-build -y
120 | yumdownloader --source ${PKG_NAME}
121 | rpm -ivh ./*.rpm
122 | cd /root/rpmbuild/SPECS
123 | exit 0
124 |
125 | # build pg_probackup
126 | yum-builddep -y pg_probackup.spec
127 | rpmbuild -bs pg_probackup.spec
128 | rpmbuild -ba pg_probackup.spec #2>&1 | tee -ai /app/out/build.log
129 |
--------------------------------------------------------------------------------
/packaging/test/scripts/suse_forks.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -xe
4 | set -o pipefail
5 | exit 0
6 |
--------------------------------------------------------------------------------
/po/LINGUAS:
--------------------------------------------------------------------------------
1 | ru
2 |
--------------------------------------------------------------------------------
/src/datapagemap.c:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * datapagemap.c
4 | * A data structure for keeping track of data pages that have changed.
5 | *
6 | * This is a fairly simple bitmap.
7 | *
8 | * Copyright (c) 2013-2019, PostgreSQL Global Development Group
9 | *
10 | *-------------------------------------------------------------------------
11 | */
12 |
13 | #include "postgres_fe.h"
14 |
15 | #include "datapagemap.h"
16 |
17 | struct datapagemap_iterator
18 | {
19 | datapagemap_t *map;
20 | BlockNumber nextblkno;
21 | };
22 |
23 | /*****
24 | * Public functions
25 | */
26 |
27 | /*
28 | * Add a block to the bitmap.
29 | */
30 | void
31 | datapagemap_add(datapagemap_t *map, BlockNumber blkno)
32 | {
33 | int offset;
34 | int bitno;
35 | int oldsize = map->bitmapsize;
36 |
37 | offset = blkno / 8;
38 | bitno = blkno % 8;
39 |
40 | /* enlarge or create bitmap if needed */
41 | if (oldsize <= offset)
42 | {
43 | int newsize;
44 |
45 | /*
46 | * The minimum to hold the new bit is offset + 1. But add some
47 | * headroom, so that we don't need to repeatedly enlarge the bitmap in
48 | * the common case that blocks are modified in order, from beginning
49 | * of a relation to the end.
50 | */
51 | newsize = (oldsize == 0) ? 16 : oldsize;
52 | while (newsize <= offset) {
53 | newsize <<= 1;
54 | }
55 |
56 | map->bitmap = pg_realloc(map->bitmap, newsize);
57 |
58 | /* zero out the newly allocated region */
59 | memset(&map->bitmap[oldsize], 0, newsize - oldsize);
60 |
61 | map->bitmapsize = newsize;
62 | }
63 |
64 | /* Set the bit */
65 | map->bitmap[offset] |= (1 << bitno);
66 | }
67 |
68 | /*
69 | * Start iterating through all entries in the page map.
70 | *
71 | * After datapagemap_iterate, call datapagemap_next to return the entries,
72 | * until it returns false. After you're done, use pg_free() to destroy the
73 | * iterator.
74 | */
75 | datapagemap_iterator_t *
76 | datapagemap_iterate(datapagemap_t *map)
77 | {
78 | datapagemap_iterator_t *iter;
79 |
80 | iter = pg_malloc(sizeof(datapagemap_iterator_t));
81 | iter->map = map;
82 | iter->nextblkno = 0;
83 |
84 | return iter;
85 | }
86 |
87 | bool
88 | datapagemap_next(datapagemap_iterator_t *iter, BlockNumber *blkno)
89 | {
90 | datapagemap_t *map = iter->map;
91 |
92 | for (;;)
93 | {
94 | BlockNumber blk = iter->nextblkno;
95 | int nextoff = blk / 8;
96 | int bitno = blk % 8;
97 |
98 | if (nextoff >= map->bitmapsize)
99 | break;
100 |
101 | iter->nextblkno++;
102 |
103 | if (map->bitmap[nextoff] & (1 << bitno))
104 | {
105 | *blkno = blk;
106 | return true;
107 | }
108 | }
109 |
110 | /* no more set bits in this bitmap. */
111 | return false;
112 | }
113 |
114 |
--------------------------------------------------------------------------------
/src/datapagemap.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * datapagemap.h
4 | *
5 | * Copyright (c) 2013-2019, PostgreSQL Global Development Group
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 | #ifndef DATAPAGEMAP_H
10 | #define DATAPAGEMAP_H
11 |
12 | #if PG_VERSION_NUM < 160000
13 | #include "storage/relfilenode.h"
14 | #else
15 | #include "storage/relfilelocator.h"
16 | #define RelFileNode RelFileLocator
17 | #endif
18 | #include "storage/block.h"
19 |
20 |
21 | struct datapagemap
22 | {
23 | char *bitmap;
24 | int bitmapsize;
25 | };
26 |
27 | typedef struct datapagemap datapagemap_t;
28 | typedef struct datapagemap_iterator datapagemap_iterator_t;
29 |
30 | extern void datapagemap_add(datapagemap_t *map, BlockNumber blkno);
31 | extern datapagemap_iterator_t *datapagemap_iterate(datapagemap_t *map);
32 | extern bool datapagemap_next(datapagemap_iterator_t *iter, BlockNumber *blkno);
33 |
34 | #endif /* DATAPAGEMAP_H */
35 |
--------------------------------------------------------------------------------
/src/fetch.c:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * fetch.c
4 | * Functions for fetching files from PostgreSQL data directory
5 | *
6 | * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
7 | *
8 | *-------------------------------------------------------------------------
9 | */
10 |
11 | #include "pg_probackup.h"
12 |
13 | #include
14 | #include
15 |
16 | /*
17 | * Read a file into memory. The file to be read is /.
18 | * The file contents are returned in a malloc'd buffer, and *filesize
19 | * is set to the length of the file.
20 | *
21 | * The returned buffer is always zero-terminated; the size of the returned
22 | * buffer is actually *filesize + 1. That's handy when reading a text file.
23 | * This function can be used to read binary files as well, you can just
24 | * ignore the zero-terminator in that case.
25 | *
26 | */
27 | char *
28 | slurpFile(const char *datadir, const char *path, size_t *filesize, bool safe, fio_location location)
29 | {
30 | int fd;
31 | char *buffer;
32 | struct stat statbuf;
33 | char fullpath[MAXPGPATH];
34 | int len;
35 |
36 | join_path_components(fullpath, datadir, path);
37 |
38 | if ((fd = fio_open(fullpath, O_RDONLY | PG_BINARY, location)) == -1)
39 | {
40 | if (safe)
41 | return NULL;
42 | else
43 | elog(ERROR, "Could not open file \"%s\" for reading: %s",
44 | fullpath, strerror(errno));
45 | }
46 |
47 | if (fio_stat(fullpath, &statbuf, true, location) < 0)
48 | {
49 | if (safe)
50 | return NULL;
51 | else
52 | elog(ERROR, "Could not stat file \"%s\": %s",
53 | fullpath, strerror(errno));
54 | }
55 |
56 | len = statbuf.st_size;
57 | buffer = pg_malloc(len + 1);
58 |
59 | if (fio_read(fd, buffer, len) != len)
60 | {
61 | if (safe)
62 | return NULL;
63 | else
64 | elog(ERROR, "Could not read file \"%s\": %s\n",
65 | fullpath, strerror(errno));
66 | }
67 |
68 | fio_close(fd);
69 |
70 | /* Zero-terminate the buffer. */
71 | buffer[len] = '\0';
72 |
73 | if (filesize)
74 | *filesize = len;
75 | return buffer;
76 | }
77 |
78 | /*
79 | * Receive a single file as a malloc'd buffer.
80 | */
81 | char *
82 | fetchFile(PGconn *conn, const char *filename, size_t *filesize)
83 | {
84 | PGresult *res;
85 | char *result;
86 | const char *params[1];
87 | int len;
88 |
89 | params[0] = filename;
90 | res = pgut_execute_extended(conn, "SELECT pg_catalog.pg_read_binary_file($1)",
91 | 1, params, false, false);
92 |
93 | /* sanity check the result set */
94 | if (PQntuples(res) != 1 || PQgetisnull(res, 0, 0))
95 | elog(ERROR, "Unexpected result set while fetching remote file \"%s\"",
96 | filename);
97 |
98 | /* Read result to local variables */
99 | len = PQgetlength(res, 0, 0);
100 | result = pg_malloc(len + 1);
101 | memcpy(result, PQgetvalue(res, 0, 0), len);
102 | result[len] = '\0';
103 |
104 | PQclear(res);
105 | *filesize = len;
106 |
107 | return result;
108 | }
109 |
--------------------------------------------------------------------------------
/src/init.c:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * init.c: - initialize backup catalog.
4 | *
5 | * Portions Copyright (c) 2009-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6 | * Portions Copyright (c) 2015-2019, Postgres Professional
7 | *
8 | *-------------------------------------------------------------------------
9 | */
10 |
11 | #include "pg_probackup.h"
12 |
13 | #include
14 | #include
15 |
16 | /*
17 | * Initialize backup catalog.
18 | */
19 | int
20 | do_init(CatalogState *catalogState)
21 | {
22 | int results;
23 |
24 | results = pg_check_dir(catalogState->catalog_path);
25 |
26 | if (results == 4) /* exists and not empty*/
27 | elog(ERROR, "The backup catalog already exists and is not empty");
28 | else if (results == -1) /*trouble accessing directory*/
29 | {
30 | int errno_tmp = errno;
31 | elog(ERROR, "Cannot open backup catalog directory \"%s\": %s",
32 | catalogState->catalog_path, strerror(errno_tmp));
33 | }
34 |
35 | /* create backup catalog root directory */
36 | dir_create_dir(catalogState->catalog_path, DIR_PERMISSION, false);
37 |
38 | /* create backup catalog data directory */
39 | dir_create_dir(catalogState->backup_subdir_path, DIR_PERMISSION, false);
40 |
41 | /* create backup catalog wal directory */
42 | dir_create_dir(catalogState->wal_subdir_path, DIR_PERMISSION, false);
43 |
44 | elog(INFO, "Backup catalog '%s' successfully initialized", catalogState->catalog_path);
45 | return 0;
46 | }
47 |
48 | int
49 | do_add_instance(InstanceState *instanceState, InstanceConfig *instance)
50 | {
51 | struct stat st;
52 | CatalogState *catalogState = instanceState->catalog_state;
53 |
54 | /* PGDATA is always required */
55 | if (instance->pgdata == NULL)
56 | elog(ERROR, "No postgres data directory specified.\n"
57 | "Please specify it either using environment variable PGDATA or\n"
58 | "command line option --pgdata (-D)");
59 |
60 | /* Read system_identifier from PGDATA */
61 | instance->system_identifier = get_system_identifier(instance->pgdata, FIO_DB_HOST, false);
62 | /* Starting from PostgreSQL 11 read WAL segment size from PGDATA */
63 | instance->xlog_seg_size = get_xlog_seg_size(instance->pgdata);
64 |
65 | /* Ensure that all root directories already exist */
66 | /* TODO maybe call do_init() here instead of error?*/
67 | if (access(catalogState->catalog_path, F_OK) != 0)
68 | elog(ERROR, "Directory does not exist: '%s'", catalogState->catalog_path);
69 |
70 | if (access(catalogState->backup_subdir_path, F_OK) != 0)
71 | elog(ERROR, "Directory does not exist: '%s'", catalogState->backup_subdir_path);
72 |
73 | if (access(catalogState->wal_subdir_path, F_OK) != 0)
74 | elog(ERROR, "Directory does not exist: '%s'", catalogState->wal_subdir_path);
75 |
76 | if (stat(instanceState->instance_backup_subdir_path, &st) == 0 && S_ISDIR(st.st_mode))
77 | elog(ERROR, "Instance '%s' backup directory already exists: '%s'",
78 | instanceState->instance_name, instanceState->instance_backup_subdir_path);
79 |
80 | /*
81 | * Create directory for wal files of this specific instance.
82 | * Existence check is extra paranoid because if we don't have such a
83 | * directory in data dir, we shouldn't have it in wal as well.
84 | */
85 | if (stat(instanceState->instance_wal_subdir_path, &st) == 0 && S_ISDIR(st.st_mode))
86 | elog(ERROR, "Instance '%s' WAL archive directory already exists: '%s'",
87 | instanceState->instance_name, instanceState->instance_wal_subdir_path);
88 |
89 | /* Create directory for data files of this specific instance */
90 | dir_create_dir(instanceState->instance_backup_subdir_path, DIR_PERMISSION, false);
91 | dir_create_dir(instanceState->instance_wal_subdir_path, DIR_PERMISSION, false);
92 |
93 | /*
94 | * Write initial configuration file.
95 | * system-identifier, xlog-seg-size and pgdata are set in init subcommand
96 | * and will never be updated.
97 | *
98 | * We need to manually set options source to save them to the configuration
99 | * file.
100 | */
101 | config_set_opt(instance_options, &instance->system_identifier,
102 | SOURCE_FILE);
103 | config_set_opt(instance_options, &instance->xlog_seg_size,
104 | SOURCE_FILE);
105 |
106 | /* Kludge: do not save remote options into config */
107 | config_set_opt(instance_options, &instance_config.remote.host,
108 | SOURCE_DEFAULT);
109 | config_set_opt(instance_options, &instance_config.remote.proto,
110 | SOURCE_DEFAULT);
111 | config_set_opt(instance_options, &instance_config.remote.port,
112 | SOURCE_DEFAULT);
113 | config_set_opt(instance_options, &instance_config.remote.path,
114 | SOURCE_DEFAULT);
115 | config_set_opt(instance_options, &instance_config.remote.user,
116 | SOURCE_DEFAULT);
117 | config_set_opt(instance_options, &instance_config.remote.ssh_options,
118 | SOURCE_DEFAULT);
119 | config_set_opt(instance_options, &instance_config.remote.ssh_config,
120 | SOURCE_DEFAULT);
121 |
122 | /* pgdata was set through command line */
123 | do_set_config(instanceState, true);
124 |
125 | elog(INFO, "Instance '%s' successfully initialized", instanceState->instance_name);
126 | return 0;
127 | }
128 |
--------------------------------------------------------------------------------
/src/pg_probackup_state.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * pg_probackup_state.h: Definitions of internal pg_probackup states
4 | *
5 | * Portions Copyright (c) 2021, Postgres Professional
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 | #ifndef PG_PROBACKUP_STATE_H
10 | #define PG_PROBACKUP_STATE_H
11 |
12 | /* ====== CatalogState ======= */
13 |
14 | typedef struct CatalogState
15 | {
16 | /* $BACKUP_PATH */
17 | char catalog_path[MAXPGPATH]; //previously global var backup_path
18 | /* $BACKUP_PATH/backups */
19 | char backup_subdir_path[MAXPGPATH];
20 | /* $BACKUP_PATH/wal */
21 | char wal_subdir_path[MAXPGPATH]; // previously global var arclog_path
22 | } CatalogState;
23 |
24 | /* ====== CatalogState (END) ======= */
25 |
26 |
27 | /* ===== instanceState ===== */
28 |
29 | /* ===== instanceState (END) ===== */
30 |
31 | #endif /* PG_PROBACKUP_STATE_H */
32 |
--------------------------------------------------------------------------------
/src/utils/configuration.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * configuration.h: - prototypes of functions and structures for
4 | * configuration.
5 | *
6 | * Copyright (c) 2018-2019, Postgres Professional
7 | *
8 | *-------------------------------------------------------------------------
9 | */
10 |
11 | #ifndef CONFIGURATION_H
12 | #define CONFIGURATION_H
13 |
14 | #include "postgres_fe.h"
15 | #include "access/xlogdefs.h"
16 |
17 | #define INFINITE_STR "INFINITE"
18 |
19 | /* Order is important, keep it in sync with configuration.c:subcmd_names[] and help.c:help_command() */
20 | typedef enum ProbackupSubcmd
21 | {
22 | NO_CMD = 0,
23 | INIT_CMD,
24 | ADD_INSTANCE_CMD,
25 | DELETE_INSTANCE_CMD,
26 | ARCHIVE_PUSH_CMD,
27 | ARCHIVE_GET_CMD,
28 | BACKUP_CMD,
29 | RESTORE_CMD,
30 | VALIDATE_CMD,
31 | DELETE_CMD,
32 | MERGE_CMD,
33 | SHOW_CMD,
34 | SET_CONFIG_CMD,
35 | SET_BACKUP_CMD,
36 | SHOW_CONFIG_CMD,
37 | CHECKDB_CMD,
38 | SSH_CMD,
39 | AGENT_CMD,
40 | HELP_CMD,
41 | VERSION_CMD,
42 | CATCHUP_CMD,
43 | } ProbackupSubcmd;
44 |
45 | typedef enum OptionSource
46 | {
47 | SOURCE_DEFAULT,
48 | SOURCE_FILE_STRICT,
49 | SOURCE_CMD_STRICT,
50 | SOURCE_ENV,
51 | SOURCE_FILE,
52 | SOURCE_CMD,
53 | SOURCE_CONST
54 | } OptionSource;
55 |
56 | typedef struct ConfigOption ConfigOption;
57 |
58 | typedef void (*option_assign_fn) (ConfigOption *opt, const char *arg);
59 | /* Returns allocated string value */
60 | typedef char *(*option_get_fn) (ConfigOption *opt);
61 |
62 | /*
63 | * type:
64 | * b: bool (true)
65 | * B: bool (false)
66 | * f: option_fn
67 | * i: 32bit signed integer
68 | * u: 32bit unsigned integer
69 | * I: 64bit signed integer
70 | * U: 64bit unsigned integer
71 | * s: string
72 | * t: time_t
73 | */
74 | struct ConfigOption
75 | {
76 | char type;
77 | uint8 sname; /* short name */
78 | const char *lname; /* long name */
79 | void *var; /* pointer to variable */
80 | OptionSource allowed; /* allowed source */
81 | OptionSource source; /* actual source */
82 | const char *group; /* option group name */
83 | int flags; /* option unit */
84 | option_get_fn get_value; /* function to get the value as a string,
85 | should return allocated string*/
86 | };
87 |
88 | /*
89 | * bit values in "flags" of an option
90 | */
91 | #define OPTION_UNIT_KB 0x1000 /* value is in kilobytes */
92 | #define OPTION_UNIT_BLOCKS 0x2000 /* value is in blocks */
93 | #define OPTION_UNIT_XBLOCKS 0x3000 /* value is in xlog blocks */
94 | #define OPTION_UNIT_XSEGS 0x4000 /* value is in xlog segments */
95 | #define OPTION_UNIT_MEMORY 0xF000 /* mask for size-related units */
96 |
97 | #define OPTION_UNIT_MS 0x10000 /* value is in milliseconds */
98 | #define OPTION_UNIT_S 0x20000 /* value is in seconds */
99 | #define OPTION_UNIT_MIN 0x30000 /* value is in minutes */
100 | #define OPTION_UNIT_TIME 0xF0000 /* mask for time-related units */
101 |
102 | #define OPTION_UNIT (OPTION_UNIT_MEMORY | OPTION_UNIT_TIME)
103 | #define GET_VAL_IN_BASE_UNITS 0x80000000 /* bitflag to get memory and time values in default units*/
104 |
105 | extern ProbackupSubcmd parse_subcmd(char const * const subcmd_str);
106 | extern char const *get_subcmd_name(ProbackupSubcmd const subcmd);
107 | extern int config_get_opt(int argc, char **argv, ConfigOption cmd_options[],
108 | ConfigOption options[]);
109 | extern int config_read_opt(const char *path, ConfigOption options[], int elevel,
110 | bool strict, bool missing_ok);
111 | extern void config_get_opt_env(ConfigOption options[]);
112 | extern void config_set_opt(ConfigOption options[], void *var,
113 | OptionSource source);
114 |
115 | extern char *option_get_value(ConfigOption *opt);
116 |
117 | extern bool parse_bool(const char *value, bool *result);
118 | extern bool parse_bool_with_len(const char *value, size_t len, bool *result);
119 | extern bool parse_int32(const char *value, int32 *result, int flags);
120 | extern bool parse_uint32(const char *value, uint32 *result, int flags);
121 | extern bool parse_int64(const char *value, int64 *result, int flags);
122 | extern bool parse_uint64(const char *value, uint64 *result, int flags);
123 | extern bool parse_time(const char *value, time_t *result, bool utc_default);
124 | extern bool parse_int(const char *value, int *result, int flags,
125 | const char **hintmsg);
126 | extern bool parse_lsn(const char *value, XLogRecPtr *result);
127 |
128 | extern void time2iso(char *buf, size_t len, time_t time, bool utc);
129 |
130 | extern void convert_from_base_unit(int64 base_value, int base_unit,
131 | int64 *value, const char **unit);
132 | extern void convert_from_base_unit_u(uint64 base_value, int base_unit,
133 | uint64 *value, const char **unit);
134 |
135 | #endif /* CONFIGURATION_H */
136 |
--------------------------------------------------------------------------------
/src/utils/file.h:
--------------------------------------------------------------------------------
1 | #ifndef __FILE__H__
2 | #define __FILE__H__
3 |
4 | #include "storage/bufpage.h"
5 | #include
6 | #include
7 | #include
8 |
9 | #ifdef HAVE_LIBZ
10 | #include
11 | #endif
12 |
13 | typedef enum
14 | {
15 | /* message for compatibility check */
16 | FIO_AGENT_VERSION, /* never move this */
17 | FIO_OPEN,
18 | FIO_CLOSE,
19 | FIO_WRITE,
20 | FIO_SYNC,
21 | FIO_RENAME,
22 | FIO_SYMLINK,
23 | FIO_UNLINK,
24 | FIO_MKDIR,
25 | FIO_CHMOD,
26 | FIO_SEEK,
27 | FIO_TRUNCATE,
28 | FIO_DELETE,
29 | FIO_PREAD,
30 | FIO_READ,
31 | FIO_LOAD,
32 | FIO_STAT,
33 | FIO_SEND,
34 | FIO_ACCESS,
35 | FIO_OPENDIR,
36 | FIO_READDIR,
37 | FIO_CLOSEDIR,
38 | FIO_PAGE,
39 | FIO_WRITE_COMPRESSED_ASYNC,
40 | FIO_GET_CRC32,
41 | /* used for incremental restore */
42 | FIO_GET_CHECKSUM_MAP,
43 | FIO_GET_LSN_MAP,
44 | /* used in fio_send_pages */
45 | FIO_SEND_PAGES,
46 | FIO_ERROR,
47 | FIO_SEND_FILE,
48 | // FIO_CHUNK,
49 | FIO_SEND_FILE_EOF,
50 | FIO_SEND_FILE_CORRUPTION,
51 | FIO_SEND_FILE_HEADERS,
52 | /* messages for closing connection */
53 | FIO_DISCONNECT,
54 | FIO_DISCONNECTED,
55 | FIO_LIST_DIR,
56 | FIO_CHECK_POSTMASTER,
57 | FIO_GET_ASYNC_ERROR,
58 | FIO_WRITE_ASYNC,
59 | FIO_READLINK,
60 | FIO_PAGE_ZERO
61 | } fio_operations;
62 |
63 | typedef enum
64 | {
65 | FIO_LOCAL_HOST, /* data is locate at local host */
66 | FIO_DB_HOST, /* data is located at Postgres server host */
67 | FIO_BACKUP_HOST, /* data is located at backup host */
68 | FIO_REMOTE_HOST /* date is located at remote host */
69 | } fio_location;
70 |
71 | #define FIO_FDMAX 64
72 | #define FIO_PIPE_MARKER 0x40000000
73 |
74 | #define SYS_CHECK(cmd) do if ((cmd) < 0) { fprintf(stderr, "%s:%d: (%s) %s\n", __FILE__, __LINE__, #cmd, strerror(errno)); exit(EXIT_FAILURE); } while (0)
75 | #define IO_CHECK(cmd, size) do { int _rc = (cmd); if (_rc != (size)) fio_error(_rc, size, __FILE__, __LINE__); } while (0)
76 |
77 | typedef struct
78 | {
79 | // fio_operations cop;
80 | // 16
81 | unsigned cop : 32;
82 | unsigned handle : 32;
83 | unsigned size : 32;
84 | unsigned arg;
85 | } fio_header;
86 |
87 | extern fio_location MyLocation;
88 |
89 | /* Check if FILE handle is local or remote (created by FIO) */
90 | #define fio_is_remote_file(file) ((size_t)(file) <= FIO_FDMAX)
91 |
92 | extern void fio_redirect(int in, int out, int err);
93 | extern void fio_communicate(int in, int out);
94 |
95 | extern void fio_get_agent_version(int* protocol, char* payload_buf, size_t payload_buf_size);
96 | extern FILE* fio_fopen(char const* name, char const* mode, fio_location location);
97 | extern size_t fio_fwrite(FILE* f, void const* buf, size_t size);
98 | extern ssize_t fio_fwrite_async_compressed(FILE* f, void const* buf, size_t size, int compress_alg);
99 | extern size_t fio_fwrite_async(FILE* f, void const* buf, size_t size);
100 | extern int fio_check_error_file(FILE* f, char **errmsg);
101 | extern int fio_check_error_fd(int fd, char **errmsg);
102 | extern int fio_check_error_fd_gz(gzFile f, char **errmsg);
103 | extern ssize_t fio_fread(FILE* f, void* buf, size_t size);
104 | extern int fio_pread(FILE* f, void* buf, off_t offs);
105 | extern int fio_fprintf(FILE* f, char const* arg, ...) pg_attribute_printf(2, 3);
106 | extern int fio_fflush(FILE* f);
107 | extern int fio_fseek(FILE* f, off_t offs);
108 | extern int fio_ftruncate(FILE* f, off_t size);
109 | extern int fio_fclose(FILE* f);
110 | extern int fio_ffstat(FILE* f, struct stat* st);
111 | extern void fio_error(int rc, int size, char const* file, int line);
112 |
113 | extern int fio_open(char const* name, int mode, fio_location location);
114 | extern ssize_t fio_write(int fd, void const* buf, size_t size);
115 | extern ssize_t fio_write_async(int fd, void const* buf, size_t size);
116 | extern ssize_t fio_read(int fd, void* buf, size_t size);
117 | extern int fio_flush(int fd);
118 | extern int fio_seek(int fd, off_t offs);
119 | extern int fio_fstat(int fd, struct stat* st);
120 | extern int fio_truncate(int fd, off_t size);
121 | extern int fio_close(int fd);
122 | extern void fio_disconnect(void);
123 | extern int fio_sync(char const* path, fio_location location);
124 | extern pg_crc32 fio_get_crc32(const char *file_path, fio_location location,
125 | bool decompress, bool missing_ok);
126 | extern pg_crc32 fio_get_crc32_truncated(const char *file_path, fio_location location,
127 | bool missing_ok);
128 |
129 | extern int fio_rename(char const* old_path, char const* new_path, fio_location location);
130 | extern int fio_symlink(char const* target, char const* link_path, bool overwrite, fio_location location);
131 | extern int fio_unlink(char const* path, fio_location location);
132 | extern int fio_mkdir(char const* path, int mode, fio_location location);
133 | extern int fio_chmod(char const* path, int mode, fio_location location);
134 | extern int fio_access(char const* path, int mode, fio_location location);
135 | extern int fio_stat(char const* path, struct stat* st, bool follow_symlinks, fio_location location);
136 | extern bool fio_is_same_file(char const* filename1, char const* filename2, bool follow_symlink, fio_location location);
137 | extern ssize_t fio_readlink(const char *path, char *value, size_t valsiz, fio_location location);
138 | extern DIR* fio_opendir(char const* path, fio_location location);
139 | extern struct dirent * fio_readdir(DIR *dirp);
140 | extern int fio_closedir(DIR *dirp);
141 | extern FILE* fio_open_stream(char const* name, fio_location location);
142 | extern int fio_close_stream(FILE* f);
143 |
144 | #ifdef HAVE_LIBZ
145 | extern gzFile fio_gzopen(char const* path, char const* mode, int level, fio_location location);
146 | extern int fio_gzclose(gzFile file);
147 | extern int fio_gzread(gzFile f, void *buf, unsigned size);
148 | extern int fio_gzwrite(gzFile f, void const* buf, unsigned size);
149 | extern int fio_gzeof(gzFile f);
150 | extern z_off_t fio_gzseek(gzFile f, z_off_t offset, int whence);
151 | extern const char* fio_gzerror(gzFile file, int *errnum);
152 | #endif
153 |
154 | #endif
155 |
--------------------------------------------------------------------------------
/src/utils/json.c:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * json.c: - make json document.
4 | *
5 | * Copyright (c) 2018-2019, Postgres Professional
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #include "json.h"
11 |
12 | static void json_add_indent(PQExpBuffer buf, int32 level);
13 | static void json_add_escaped(PQExpBuffer buf, const char *str);
14 |
15 | static bool add_comma = false;
16 |
17 | /*
18 | * Start or end json token. Currently it is a json object or array.
19 | *
20 | * Function modifies level value and adds indent if it appropriate.
21 | */
22 | void
23 | json_add(PQExpBuffer buf, JsonToken type, int32 *level)
24 | {
25 | switch (type)
26 | {
27 | case JT_BEGIN_ARRAY:
28 | appendPQExpBufferChar(buf, '[');
29 | *level += 1;
30 | add_comma = false;
31 | break;
32 | case JT_END_ARRAY:
33 | *level -= 1;
34 | if (*level == 0)
35 | appendPQExpBufferChar(buf, '\n');
36 | else
37 | json_add_indent(buf, *level);
38 | appendPQExpBufferChar(buf, ']');
39 | add_comma = true;
40 | break;
41 | case JT_BEGIN_OBJECT:
42 | json_add_indent(buf, *level);
43 | appendPQExpBufferChar(buf, '{');
44 | *level += 1;
45 | add_comma = false;
46 | break;
47 | case JT_END_OBJECT:
48 | *level -= 1;
49 | if (*level == 0)
50 | appendPQExpBufferChar(buf, '\n');
51 | else
52 | json_add_indent(buf, *level);
53 | appendPQExpBufferChar(buf, '}');
54 | add_comma = true;
55 | break;
56 | default:
57 | break;
58 | }
59 | }
60 |
61 | /*
62 | * Add json object's key. If it isn't first key we need to add a comma.
63 | */
64 | void
65 | json_add_key(PQExpBuffer buf, const char *name, int32 level)
66 | {
67 | if (add_comma)
68 | appendPQExpBufferChar(buf, ',');
69 | json_add_indent(buf, level);
70 |
71 | json_add_escaped(buf, name);
72 | appendPQExpBufferStr(buf, ": ");
73 |
74 | add_comma = true;
75 | }
76 |
77 | /*
78 | * Add json object's key and value. If it isn't first key we need to add a
79 | * comma.
80 | */
81 | void
82 | json_add_value(PQExpBuffer buf, const char *name, const char *value,
83 | int32 level, bool escaped)
84 | {
85 | json_add_key(buf, name, level);
86 |
87 | if (escaped)
88 | json_add_escaped(buf, value);
89 | else
90 | appendPQExpBufferStr(buf, value);
91 | }
92 |
93 | static void
94 | json_add_indent(PQExpBuffer buf, int32 level)
95 | {
96 | uint16 i;
97 |
98 | if (level == 0)
99 | return;
100 |
101 | appendPQExpBufferChar(buf, '\n');
102 | for (i = 0; i < level; i++)
103 | appendPQExpBufferStr(buf, " ");
104 | }
105 |
106 | static void
107 | json_add_escaped(PQExpBuffer buf, const char *str)
108 | {
109 | const char *p;
110 |
111 | appendPQExpBufferChar(buf, '"');
112 | for (p = str; *p; p++)
113 | {
114 | switch (*p)
115 | {
116 | case '\b':
117 | appendPQExpBufferStr(buf, "\\b");
118 | break;
119 | case '\f':
120 | appendPQExpBufferStr(buf, "\\f");
121 | break;
122 | case '\n':
123 | appendPQExpBufferStr(buf, "\\n");
124 | break;
125 | case '\r':
126 | appendPQExpBufferStr(buf, "\\r");
127 | break;
128 | case '\t':
129 | appendPQExpBufferStr(buf, "\\t");
130 | break;
131 | case '"':
132 | appendPQExpBufferStr(buf, "\\\"");
133 | break;
134 | case '\\':
135 | appendPQExpBufferStr(buf, "\\\\");
136 | break;
137 | default:
138 | if ((unsigned char) *p < ' ')
139 | appendPQExpBuffer(buf, "\\u%04x", (int) *p);
140 | else
141 | appendPQExpBufferChar(buf, *p);
142 | break;
143 | }
144 | }
145 | appendPQExpBufferChar(buf, '"');
146 | }
147 |
148 | void
149 | json_add_min(PQExpBuffer buf, JsonToken type)
150 | {
151 | switch (type)
152 | {
153 | case JT_BEGIN_OBJECT:
154 | appendPQExpBufferChar(buf, '{');
155 | add_comma = false;
156 | break;
157 | case JT_END_OBJECT:
158 | appendPQExpBufferStr(buf, "}\n");
159 | add_comma = true;
160 | break;
161 | default:
162 | break;
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/src/utils/json.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * json.h: - prototypes of json output functions.
4 | *
5 | * Copyright (c) 2018-2019, Postgres Professional
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #ifndef PROBACKUP_JSON_H
11 | #define PROBACKUP_JSON_H
12 |
13 | #include "postgres_fe.h"
14 | #include "pqexpbuffer.h"
15 |
16 | /*
17 | * Json document tokens.
18 | */
19 | typedef enum
20 | {
21 | JT_BEGIN_ARRAY,
22 | JT_END_ARRAY,
23 | JT_BEGIN_OBJECT,
24 | JT_END_OBJECT
25 | } JsonToken;
26 |
27 | extern void json_add(PQExpBuffer buf, JsonToken type, int32 *level);
28 | extern void json_add_min(PQExpBuffer buf, JsonToken type);
29 | extern void json_add_key(PQExpBuffer buf, const char *name, int32 level);
30 | extern void json_add_value(PQExpBuffer buf, const char *name, const char *value,
31 | int32 level, bool escaped);
32 |
33 | #endif /* PROBACKUP_JSON_H */
34 |
--------------------------------------------------------------------------------
/src/utils/logger.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * logger.h: - prototypes of logger functions.
4 | *
5 | * Copyright (c) 2017-2019, Postgres Professional
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #ifndef LOGGER_H
11 | #define LOGGER_H
12 |
13 | #define LOG_NONE (-10)
14 |
15 | /* Log level */
16 | #define VERBOSE (-5)
17 | #define LOG (-4)
18 | #define INFO (-3)
19 | #define NOTICE (-2)
20 | #define WARNING (-1)
21 | #define ERROR 1
22 | #define LOG_OFF 10
23 |
24 | #define PLAIN 0
25 | #define JSON 1
26 |
27 | typedef struct LoggerConfig
28 | {
29 | int log_level_console;
30 | int log_level_file;
31 | char *log_filename;
32 | char *error_log_filename;
33 | char *log_directory;
34 | /* Maximum size of an individual log file in kilobytes */
35 | uint64 log_rotation_size;
36 | /* Maximum lifetime of an individual log file in minutes */
37 | uint64 log_rotation_age;
38 | int8 log_format_console;
39 | int8 log_format_file;
40 | } LoggerConfig;
41 |
42 | /* Logger parameters */
43 | extern LoggerConfig logger_config;
44 |
45 | #define LOG_ROTATION_SIZE_DEFAULT 0
46 | #define LOG_ROTATION_AGE_DEFAULT 0
47 |
48 | #define LOG_LEVEL_CONSOLE_DEFAULT INFO
49 | #define LOG_LEVEL_FILE_DEFAULT LOG_OFF
50 |
51 | #define LOG_FORMAT_CONSOLE_DEFAULT PLAIN
52 | #define LOG_FORMAT_FILE_DEFAULT PLAIN
53 |
54 | #define LOG_FILENAME_DEFAULT "pg_probackup.log"
55 | #define LOG_DIRECTORY_DEFAULT "log"
56 |
57 | #undef elog
58 | extern void elog(int elevel, const char *fmt, ...) pg_attribute_printf(2, 3);
59 | extern void elog_file(int elevel, const char *fmt, ...) pg_attribute_printf(2, 3);
60 |
61 | extern void init_logger(const char *root_path, LoggerConfig *config);
62 | extern void init_console(void);
63 |
64 | extern int parse_log_level(const char *level);
65 | extern const char *deparse_log_level(int level);
66 |
67 | extern int parse_log_format(const char *format);
68 | extern const char *deparse_log_format(int format);
69 | #endif /* LOGGER_H */
70 |
--------------------------------------------------------------------------------
/src/utils/parray.c:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * parray.c: pointer array collection.
4 | *
5 | * Copyright (c) 2009-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #include "postgres_fe.h"
11 |
12 | #include "parray.h"
13 | #include "pgut.h"
14 |
15 | /* members of struct parray are hidden from client. */
16 | struct parray
17 | {
18 | void **data; /* pointer array, expanded if necessary */
19 | size_t alloced; /* number of elements allocated */
20 | size_t used; /* number of elements in use */
21 | };
22 |
23 | /*
24 | * Create new parray object.
25 | * Never returns NULL.
26 | */
27 | parray *
28 | parray_new(void)
29 | {
30 | parray *a = pgut_new(parray);
31 |
32 | a->data = NULL;
33 | a->used = 0;
34 | a->alloced = 0;
35 |
36 | parray_expand(a, 1024);
37 |
38 | return a;
39 | }
40 |
41 | /*
42 | * Expand array pointed by data to newsize.
43 | * Elements in expanded area are initialized to NULL.
44 | * Note: never returns NULL.
45 | */
46 | void
47 | parray_expand(parray *array, size_t newsize)
48 | {
49 | void **p;
50 |
51 | /* already allocated */
52 | if (newsize <= array->alloced)
53 | return;
54 |
55 | p = pgut_realloc(array->data, sizeof(void *) * newsize);
56 |
57 | /* initialize expanded area to NULL */
58 | memset(p + array->alloced, 0, (newsize - array->alloced) * sizeof(void *));
59 |
60 | array->alloced = newsize;
61 | array->data = p;
62 | }
63 |
64 | void
65 | parray_free(parray *array)
66 | {
67 | if (array == NULL)
68 | return;
69 | free(array->data);
70 | free(array);
71 | }
72 |
73 | void
74 | parray_append(parray *array, void *elem)
75 | {
76 | if (array->used + 1 > array->alloced)
77 | parray_expand(array, array->alloced * 2);
78 |
79 | array->data[array->used++] = elem;
80 | }
81 |
82 | void
83 | parray_insert(parray *array, size_t index, void *elem)
84 | {
85 | if (array->used + 1 > array->alloced)
86 | parray_expand(array, array->alloced * 2);
87 |
88 | memmove(array->data + index + 1, array->data + index,
89 | (array->alloced - index - 1) * sizeof(void *));
90 | array->data[index] = elem;
91 |
92 | /* adjust used count */
93 | if (array->used < index + 1)
94 | array->used = index + 1;
95 | else
96 | array->used++;
97 | }
98 |
99 | /*
100 | * Concatenate two parray.
101 | * parray_concat() appends the copy of the content of src to the end of dest.
102 | */
103 | parray *
104 | parray_concat(parray *dest, const parray *src)
105 | {
106 | /* expand head array */
107 | parray_expand(dest, dest->used + src->used);
108 |
109 | /* copy content of src after content of dest */
110 | memcpy(dest->data + dest->used, src->data, src->used * sizeof(void *));
111 | dest->used += parray_num(src);
112 |
113 | return dest;
114 | }
115 |
116 | void
117 | parray_set(parray *array, size_t index, void *elem)
118 | {
119 | if (index > array->alloced - 1)
120 | parray_expand(array, index + 1);
121 |
122 | array->data[index] = elem;
123 |
124 | /* adjust used count */
125 | if (array->used < index + 1)
126 | array->used = index + 1;
127 | }
128 |
129 | void *
130 | parray_get(const parray *array, size_t index)
131 | {
132 | if (index > array->alloced - 1)
133 | return NULL;
134 | return array->data[index];
135 | }
136 |
137 | void *
138 | parray_remove(parray *array, size_t index)
139 | {
140 | void *val;
141 |
142 | /* removing unused element */
143 | if (index > array->used)
144 | return NULL;
145 |
146 | val = array->data[index];
147 |
148 | /* Do not move if the last element was removed. */
149 | if (index < array->alloced - 1)
150 | memmove(array->data + index, array->data + index + 1,
151 | (array->alloced - index - 1) * sizeof(void *));
152 |
153 | /* adjust used count */
154 | array->used--;
155 |
156 | return val;
157 | }
158 |
159 | bool
160 | parray_rm(parray *array, const void *key, int(*compare)(const void *, const void *))
161 | {
162 | int i;
163 |
164 | for (i = 0; i < array->used; i++)
165 | {
166 | if (compare(&key, &array->data[i]) == 0)
167 | {
168 | parray_remove(array, i);
169 | return true;
170 | }
171 | }
172 | return false;
173 | }
174 |
175 | size_t
176 | parray_num(const parray *array)
177 | {
178 | return array!= NULL ? array->used : (size_t) 0;
179 | }
180 |
181 | void
182 | parray_qsort(parray *array, int(*compare)(const void *, const void *))
183 | {
184 | qsort(array->data, array->used, sizeof(void *), compare);
185 | }
186 |
187 | void
188 | parray_walk(parray *array, void (*action)(void *))
189 | {
190 | int i;
191 | for (i = 0; i < array->used; i++)
192 | action(array->data[i]);
193 | }
194 |
195 | void *
196 | parray_bsearch(parray *array, const void *key, int(*compare)(const void *, const void *))
197 | {
198 | return bsearch(&key, array->data, array->used, sizeof(void *), compare);
199 | }
200 |
201 | int
202 | parray_bsearch_index(parray *array, const void *key, int(*compare)(const void *, const void *))
203 | {
204 | void **elem = parray_bsearch(array, key, compare);
205 | return elem != NULL ? elem - array->data : -1;
206 | }
207 |
208 | /* checks that parray contains element */
209 | bool parray_contains(parray *array, void *elem)
210 | {
211 | int i;
212 |
213 | for (i = 0; i < parray_num(array); i++)
214 | {
215 | if (parray_get(array, i) == elem)
216 | return true;
217 | }
218 | return false;
219 | }
220 |
221 | /* effectively remove elements that satisfy certain criterion */
222 | void
223 | parray_remove_if(parray *array, criterion_fn criterion, void *args, cleanup_fn clean) {
224 | int i = 0;
225 | int j = 0;
226 |
227 | /* removing certain elements */
228 | while(j < parray_num(array)) {
229 | void *value = array->data[j];
230 | // if the value satisfies the criterion, clean it up
231 | if(criterion(value, args)) {
232 | clean(value);
233 | j++;
234 | continue;
235 | }
236 |
237 | if(i != j)
238 | array->data[i] = array->data[j];
239 |
240 | i++;
241 | j++;
242 | }
243 |
244 | /* adjust the number of used elements */
245 | array->used -= j - i;
246 | }
247 |
--------------------------------------------------------------------------------
/src/utils/parray.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * parray.h: pointer array collection.
4 | *
5 | * Copyright (c) 2009-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #ifndef PARRAY_H
11 | #define PARRAY_H
12 |
13 | /*
14 | * "parray" hold pointers to objects in a linear memory area.
15 | * Client use "parray *" to access parray object.
16 | */
17 | typedef struct parray parray;
18 |
19 | typedef bool (*criterion_fn)(void *value, void *args);
20 | typedef void (*cleanup_fn)(void *ref);
21 |
22 | extern parray *parray_new(void);
23 | extern void parray_expand(parray *array, size_t newnum);
24 | extern void parray_free(parray *array);
25 | extern void parray_append(parray *array, void *val);
26 | extern void parray_insert(parray *array, size_t index, void *val);
27 | extern parray *parray_concat(parray *head, const parray *tail);
28 | extern void parray_set(parray *array, size_t index, void *val);
29 | extern void *parray_get(const parray *array, size_t index);
30 | extern void *parray_remove(parray *array, size_t index);
31 | extern bool parray_rm(parray *array, const void *key, int(*compare)(const void *, const void *));
32 | extern size_t parray_num(const parray *array);
33 | extern void parray_qsort(parray *array, int(*compare)(const void *, const void *));
34 | extern void *parray_bsearch(parray *array, const void *key, int(*compare)(const void *, const void *));
35 | extern int parray_bsearch_index(parray *array, const void *key, int(*compare)(const void *, const void *));
36 | extern void parray_walk(parray *array, void (*action)(void *));
37 | extern bool parray_contains(parray *array, void *elem);
38 | extern void parray_remove_if(parray *array, criterion_fn criterion, void *args, cleanup_fn clean);
39 |
40 | #endif /* PARRAY_H */
41 |
42 |
--------------------------------------------------------------------------------
/src/utils/pgut.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * pgut.h
4 | *
5 | * Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6 | * Portions Copyright (c) 2017-2021, Postgres Professional
7 | *
8 | *-------------------------------------------------------------------------
9 | */
10 |
11 | #ifndef PGUT_H
12 | #define PGUT_H
13 |
14 | #include "postgres_fe.h"
15 | #include "libpq-fe.h"
16 |
17 | typedef void (*pgut_atexit_callback)(bool fatal, void *userdata);
18 |
19 | extern void pgut_help(bool details);
20 |
21 | /*
22 | * pgut framework variables and functions
23 | */
24 | extern bool prompt_password;
25 | extern bool force_password;
26 |
27 | extern bool interrupted;
28 | extern bool in_cleanup;
29 | extern bool in_password; /* User prompts password */
30 |
31 | extern void pgut_atexit_push(pgut_atexit_callback callback, void *userdata);
32 | extern void pgut_atexit_pop(pgut_atexit_callback callback, void *userdata);
33 |
34 | extern void pgut_init(void);
35 |
36 | /*
37 | * Database connections
38 | */
39 | extern char *pgut_get_conninfo_string(PGconn *conn);
40 | extern PGconn *pgut_connect(const char *host, const char *port,
41 | const char *dbname, const char *username);
42 | extern PGconn *pgut_connect_replication(const char *host, const char *port,
43 | const char *dbname, const char *username,
44 | bool strict);
45 | extern void pgut_disconnect(PGconn *conn);
46 | extern void pgut_disconnect_callback(bool fatal, void *userdata);
47 | extern PGresult *pgut_execute(PGconn* conn, const char *query, int nParams,
48 | const char **params);
49 | extern PGresult *pgut_execute_extended(PGconn* conn, const char *query, int nParams,
50 | const char **params, bool text_result, bool ok_error);
51 | extern PGresult *pgut_execute_parallel(PGconn* conn, PGcancel* thread_cancel_conn,
52 | const char *query, int nParams,
53 | const char **params, bool text_result, bool ok_error, bool async);
54 | extern bool pgut_send(PGconn* conn, const char *query, int nParams, const char **params, int elevel);
55 | extern void pgut_cancel(PGconn* conn);
56 | extern int pgut_wait(int num, PGconn *connections[], struct timeval *timeout);
57 |
58 | /*
59 | * memory allocators
60 | */
61 | extern void *pgut_malloc(size_t size);
62 | extern void *pgut_malloc0(size_t size);
63 | extern void *pgut_realloc(void *p, size_t size);
64 | extern char *pgut_strdup(const char *str);
65 | extern char *pgut_strndup(const char *str, size_t n);
66 | extern char *pgut_str_strip_trailing_filename(const char *filepath, const char *filename);
67 | extern void pgut_free(void *p);
68 |
69 | #define pgut_new(type) ((type *) pgut_malloc(sizeof(type)))
70 | #define pgut_new0(type) ((type *) pgut_malloc0(sizeof(type)))
71 | #define pgut_newarray(type, n) ((type *) pgut_malloc(sizeof(type) * (n)))
72 |
73 | /*
74 | * file operations
75 | */
76 | extern FILE *pgut_fopen(const char *path, const char *mode, bool missing_ok);
77 |
78 | /*
79 | * Assert
80 | */
81 | #undef Assert
82 | #undef AssertArg
83 | #undef AssertMacro
84 |
85 | #ifdef USE_ASSERT_CHECKING
86 | #define Assert(x) assert(x)
87 | #define AssertArg(x) assert(x)
88 | #define AssertMacro(x) assert(x)
89 | #else
90 | #define Assert(x) ((void) 0)
91 | #define AssertArg(x) ((void) 0)
92 | #define AssertMacro(x) ((void) 0)
93 | #endif
94 |
95 | #define IsSpace(c) (isspace((unsigned char)(c)))
96 | #define IsAlpha(c) (isalpha((unsigned char)(c)))
97 | #define IsAlnum(c) (isalnum((unsigned char)(c)))
98 | #define ToLower(c) (tolower((unsigned char)(c)))
99 | #define ToUpper(c) (toupper((unsigned char)(c)))
100 |
101 | /*
102 | * socket operations
103 | */
104 | extern int wait_for_socket(int sock, struct timeval *timeout);
105 | extern int wait_for_sockets(int nfds, fd_set *fds, struct timeval *timeout);
106 |
107 | #ifdef WIN32
108 | extern int sleep(unsigned int seconds);
109 | extern int usleep(unsigned int usec);
110 | #endif
111 |
112 | #ifdef _MSC_VER
113 | #define ARG_SIZE_HINT
114 | #else
115 | #define ARG_SIZE_HINT static
116 | #endif
117 |
118 | static inline uint32 hash_mix32_2(uint32 a, uint32 b)
119 | {
120 | b ^= (a<<7)|(a>>25);
121 | a *= 0xdeadbeef;
122 | b *= 0xcafeabed;
123 | a ^= a >> 16;
124 | b ^= b >> 15;
125 | return a^b;
126 | }
127 |
128 | #endif /* PGUT_H */
129 |
--------------------------------------------------------------------------------
/src/utils/remote.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * remote.h: - prototypes of remote functions.
4 | *
5 | * Copyright (c) 2017-2019, Postgres Professional
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #ifndef REMOTE_H
11 | #define REMOTE_H
12 |
13 | typedef struct RemoteConfig
14 | {
15 | char* proto;
16 | char* host;
17 | char* port;
18 | char* path;
19 | char* user;
20 | char *ssh_config;
21 | char *ssh_options;
22 | } RemoteConfig;
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/src/utils/thread.c:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * thread.c: - multi-platform pthread implementations.
4 | *
5 | * Copyright (c) 2018-2019, Postgres Professional
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #include "postgres_fe.h"
11 |
12 | #include "thread.h"
13 |
14 | /*
15 | * Global var used to detect error condition (not signal interrupt!) in threads,
16 | * so if one thread errored out, then others may abort
17 | */
18 | bool thread_interrupted = false;
19 |
20 | #ifdef WIN32
21 | DWORD main_tid = 0;
22 | #else
23 | pthread_t main_tid = 0;
24 | #endif
25 | #ifdef WIN32
26 | #include
27 |
28 | typedef struct win32_pthread
29 | {
30 | HANDLE handle;
31 | void *(*routine) (void *);
32 | void *arg;
33 | void *result;
34 | } win32_pthread;
35 |
36 | static long mutex_initlock = 0;
37 |
38 | static unsigned __stdcall
39 | win32_pthread_run(void *arg)
40 | {
41 | win32_pthread *th = (win32_pthread *)arg;
42 |
43 | th->result = th->routine(th->arg);
44 |
45 | return 0;
46 | }
47 |
48 | int
49 | pthread_create(pthread_t *thread,
50 | pthread_attr_t *attr,
51 | void *(*start_routine) (void *),
52 | void *arg)
53 | {
54 | int save_errno;
55 | win32_pthread *th;
56 |
57 | th = (win32_pthread *)pg_malloc(sizeof(win32_pthread));
58 | th->routine = start_routine;
59 | th->arg = arg;
60 | th->result = NULL;
61 |
62 | th->handle = (HANDLE)_beginthreadex(NULL, 0, win32_pthread_run, th, 0, NULL);
63 | if (th->handle == NULL)
64 | {
65 | save_errno = errno;
66 | free(th);
67 | return save_errno;
68 | }
69 |
70 | *thread = th;
71 | return 0;
72 | }
73 |
74 | int
75 | pthread_join(pthread_t th, void **thread_return)
76 | {
77 | if (th == NULL || th->handle == NULL)
78 | return errno = EINVAL;
79 |
80 | if (WaitForSingleObject(th->handle, INFINITE) != WAIT_OBJECT_0)
81 | {
82 | _dosmaperr(GetLastError());
83 | return errno;
84 | }
85 |
86 | if (thread_return)
87 | *thread_return = th->result;
88 |
89 | CloseHandle(th->handle);
90 | free(th);
91 | return 0;
92 | }
93 |
94 | #endif /* WIN32 */
95 |
96 | int
97 | pthread_lock(pthread_mutex_t *mp)
98 | {
99 | #ifdef WIN32
100 | if (*mp == NULL)
101 | {
102 | while (InterlockedExchange(&mutex_initlock, 1) == 1)
103 | /* loop, another thread own the lock */ ;
104 | if (*mp == NULL)
105 | {
106 | if (pthread_mutex_init(mp, NULL))
107 | return -1;
108 | }
109 | InterlockedExchange(&mutex_initlock, 0);
110 | }
111 | #endif
112 | return pthread_mutex_lock(mp);
113 | }
114 |
--------------------------------------------------------------------------------
/src/utils/thread.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------------------------------------
2 | *
3 | * thread.h: - multi-platform pthread implementations.
4 | *
5 | * Copyright (c) 2018-2019, Postgres Professional
6 | *
7 | *-------------------------------------------------------------------------
8 | */
9 |
10 | #ifndef PROBACKUP_THREAD_H
11 | #define PROBACKUP_THREAD_H
12 |
13 | #ifdef WIN32
14 | #include "postgres_fe.h"
15 | #include "port/pthread-win32.h"
16 |
17 | /* Use native win32 threads on Windows */
18 | typedef struct win32_pthread *pthread_t;
19 | typedef int pthread_attr_t;
20 |
21 | #define PTHREAD_MUTEX_INITIALIZER NULL //{ NULL, 0 }
22 | #define PTHREAD_ONCE_INIT false
23 |
24 | extern int pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
25 | extern int pthread_join(pthread_t th, void **thread_return);
26 | #else
27 | /* Use platform-dependent pthread capability */
28 | #include
29 | #endif
30 |
31 | #ifdef WIN32
32 | extern DWORD main_tid;
33 | #else
34 | extern pthread_t main_tid;
35 | #endif
36 |
37 | extern bool thread_interrupted;
38 |
39 | extern int pthread_lock(pthread_mutex_t *mp);
40 |
41 | #endif /* PROBACKUP_THREAD_H */
42 |
--------------------------------------------------------------------------------
/tests/CVE_2018_1058_test.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest
3 | from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
4 |
5 | class CVE_2018_1058(ProbackupTest, unittest.TestCase):
6 |
7 | # @unittest.skip("skip")
8 | def test_basic_default_search_path(self):
9 | """"""
10 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
11 | node = self.make_simple_node(
12 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
13 | set_replication=True)
14 |
15 | self.init_pb(backup_dir)
16 | self.add_instance(backup_dir, 'node', node)
17 | node.slow_start()
18 |
19 | node.safe_psql(
20 | 'postgres',
21 | "CREATE FUNCTION public.pgpro_edition() "
22 | "RETURNS text "
23 | "AS $$ "
24 | "BEGIN "
25 | " RAISE 'pg_probackup vulnerable!'; "
26 | "END "
27 | "$$ LANGUAGE plpgsql")
28 |
29 | self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
30 |
31 | # @unittest.skip("skip")
32 | def test_basic_backup_modified_search_path(self):
33 | """"""
34 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
35 | node = self.make_simple_node(
36 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
37 | set_replication=True)
38 | self.set_auto_conf(node, options={'search_path': 'public,pg_catalog'})
39 |
40 | self.init_pb(backup_dir)
41 | self.add_instance(backup_dir, 'node', node)
42 | node.slow_start()
43 |
44 | node.safe_psql(
45 | 'postgres',
46 | "CREATE FUNCTION public.pg_control_checkpoint(OUT timeline_id integer, OUT dummy integer) "
47 | "RETURNS record "
48 | "AS $$ "
49 | "BEGIN "
50 | " RAISE '% vulnerable!', 'pg_probackup'; "
51 | "END "
52 | "$$ LANGUAGE plpgsql")
53 |
54 | node.safe_psql(
55 | 'postgres',
56 | "CREATE FUNCTION public.pg_proc(OUT proname name, OUT dummy integer) "
57 | "RETURNS record "
58 | "AS $$ "
59 | "BEGIN "
60 | " RAISE '% vulnerable!', 'pg_probackup'; "
61 | "END "
62 | "$$ LANGUAGE plpgsql; "
63 | "CREATE VIEW public.pg_proc AS SELECT proname FROM public.pg_proc()")
64 |
65 | self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
66 |
67 | log_file = os.path.join(node.logs_dir, 'postgresql.log')
68 | with open(log_file, 'r') as f:
69 | log_content = f.read()
70 | self.assertFalse(
71 | 'pg_probackup vulnerable!' in log_content)
72 |
73 | # @unittest.skip("skip")
74 | def test_basic_checkdb_modified_search_path(self):
75 | """"""
76 | node = self.make_simple_node(
77 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
78 | initdb_params=['--data-checksums'])
79 | self.set_auto_conf(node, options={'search_path': 'public,pg_catalog'})
80 | node.slow_start()
81 |
82 | node.safe_psql(
83 | 'postgres',
84 | "CREATE FUNCTION public.pg_database(OUT datname name, OUT oid oid, OUT dattablespace oid) "
85 | "RETURNS record "
86 | "AS $$ "
87 | "BEGIN "
88 | " RAISE 'pg_probackup vulnerable!'; "
89 | "END "
90 | "$$ LANGUAGE plpgsql; "
91 | "CREATE VIEW public.pg_database AS SELECT * FROM public.pg_database()")
92 |
93 | node.safe_psql(
94 | 'postgres',
95 | "CREATE FUNCTION public.pg_extension(OUT extname name, OUT extnamespace oid, OUT extversion text) "
96 | "RETURNS record "
97 | "AS $$ "
98 | "BEGIN "
99 | " RAISE 'pg_probackup vulnerable!'; "
100 | "END "
101 | "$$ LANGUAGE plpgsql; "
102 | "CREATE FUNCTION public.pg_namespace(OUT oid oid, OUT nspname name) "
103 | "RETURNS record "
104 | "AS $$ "
105 | "BEGIN "
106 | " RAISE 'pg_probackup vulnerable!'; "
107 | "END "
108 | "$$ LANGUAGE plpgsql; "
109 | "CREATE VIEW public.pg_extension AS SELECT * FROM public.pg_extension();"
110 | "CREATE VIEW public.pg_namespace AS SELECT * FROM public.pg_namespace();"
111 | )
112 |
113 | try:
114 | self.checkdb_node(
115 | options=[
116 | '--amcheck',
117 | '--skip-block-validation',
118 | '-d', 'postgres', '-p', str(node.port)])
119 | self.assertEqual(
120 | 1, 0,
121 | "Expecting Error because amcheck{,_next} not installed\n"
122 | " Output: {0} \n CMD: {1}".format(
123 | repr(self.output), self.cmd))
124 | except ProbackupException as e:
125 | self.assertIn(
126 | "WARNING: Extension 'amcheck' or 'amcheck_next' are not installed in database postgres",
127 | e.message,
128 | "\n Unexpected Error Message: {0}\n CMD: {1}".format(
129 | repr(e.message), self.cmd))
130 |
--------------------------------------------------------------------------------
/tests/Readme.md:
--------------------------------------------------------------------------------
1 | ****[see wiki](https://confluence.postgrespro.ru/display/DEV/pg_probackup)
2 |
3 | ```
4 | Note: For now these tests work on Linux and "kinda" work on Windows
5 | ```
6 |
7 | ```
8 | Note: tests require python3 to work properly.
9 | ```
10 |
11 | ```
12 | Windows Note: For tablespaces tests to work on Windows, you should explicitly(!) grant current user full access to tmp_dirs
13 | ```
14 |
15 |
16 | ```
17 | Check physical correctness of restored instances:
18 | Apply this patch to disable HINT BITS: https://gist.github.com/gsmol/2bb34fd3ba31984369a72cc1c27a36b6
19 | export PG_PROBACKUP_PARANOIA=ON
20 |
21 | Check archive compression:
22 | export ARCHIVE_COMPRESSION=ON
23 |
24 | Enable compatibility tests:
25 | export PGPROBACKUPBIN_OLD=/path/to/previous_version_pg_probackup_binary
26 |
27 | Specify path to pg_probackup binary file. By default tests use /pg_probackup/
28 | export PGPROBACKUPBIN=
29 |
30 | Remote backup depends on key authentication to local machine via ssh as current user.
31 | export PGPROBACKUP_SSH_REMOTE=ON
32 |
33 | Run tests that are relied on advanced debugging features. For this mode, pg_probackup should be compiled without optimizations. For example:
34 | CFLAGS="-O0" ./configure --prefix=/path/to/prefix --enable-debug --enable-cassert --enable-depend --enable-tap-tests --enable-nls
35 |
36 | export PGPROBACKUP_GDB=ON
37 |
38 | Run suit of basic simple tests:
39 | export PG_PROBACKUP_TEST_BASIC=ON
40 |
41 | Run ptrack tests:
42 | export PG_PROBACKUP_PTRACK=ON
43 |
44 | Run long (time consuming) tests:
45 | export PG_PROBACKUP_LONG=ON
46 |
47 | Usage:
48 | sudo echo 0 > /proc/sys/kernel/yama/ptrace_scope
49 | pip install testgres
50 | export PG_CONFIG=/path/to/pg_config
51 | python -m unittest [-v] tests[.specific_module][.class.test]
52 | ```
53 |
54 | # Troubleshooting FAQ
55 |
56 | ## Python tests failure
57 | ### 1. Could not open extension "..."
58 | ```
59 | testgres.exceptions.QueryException ERROR: could not open extension control file "/share/extension/amcheck.control": No such file or directory
60 | ```
61 |
62 | #### Solution:
63 |
64 | You have no `/contrib/...` extension installed, please do
65 |
66 | ```commandline
67 | cd
68 | make install-world
69 | ```
70 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | import unittest
2 | import os
3 |
4 | from . import init_test, merge_test, option_test, show_test, compatibility_test, \
5 | backup_test, delete_test, delta_test, restore_test, validate_test, \
6 | retention_test, pgpro560_test, pgpro589_test, pgpro2068_test, false_positive_test, replica_test, \
7 | compression_test, page_test, ptrack_test, archive_test, exclude_test, cfs_backup_test, cfs_restore_test, \
8 | cfs_validate_backup_test, auth_test, time_stamp_test, logging_test, \
9 | locking_test, remote_test, external_test, config_test, checkdb_test, set_backup_test, incr_restore_test, \
10 | catchup_test, CVE_2018_1058_test, time_consuming_test
11 |
12 |
13 | def load_tests(loader, tests, pattern):
14 | suite = unittest.TestSuite()
15 |
16 | if 'PG_PROBACKUP_TEST_BASIC' in os.environ:
17 | if os.environ['PG_PROBACKUP_TEST_BASIC'] == 'ON':
18 | loader.testMethodPrefix = 'test_basic'
19 |
20 | if 'PG_PROBACKUP_PTRACK' in os.environ:
21 | if os.environ['PG_PROBACKUP_PTRACK'] == 'ON':
22 | suite.addTests(loader.loadTestsFromModule(ptrack_test))
23 |
24 | # PG_PROBACKUP_LONG section for tests that are long
25 | # by design e.g. they contain loops, sleeps and so on
26 | if 'PG_PROBACKUP_LONG' in os.environ:
27 | if os.environ['PG_PROBACKUP_LONG'] == 'ON':
28 | suite.addTests(loader.loadTestsFromModule(time_consuming_test))
29 |
30 | suite.addTests(loader.loadTestsFromModule(auth_test))
31 | suite.addTests(loader.loadTestsFromModule(archive_test))
32 | suite.addTests(loader.loadTestsFromModule(backup_test))
33 | suite.addTests(loader.loadTestsFromModule(catchup_test))
34 | if 'PGPROBACKUPBIN_OLD' in os.environ and os.environ['PGPROBACKUPBIN_OLD']:
35 | suite.addTests(loader.loadTestsFromModule(compatibility_test))
36 | suite.addTests(loader.loadTestsFromModule(checkdb_test))
37 | suite.addTests(loader.loadTestsFromModule(config_test))
38 | suite.addTests(loader.loadTestsFromModule(cfs_backup_test))
39 | suite.addTests(loader.loadTestsFromModule(cfs_restore_test))
40 | suite.addTests(loader.loadTestsFromModule(cfs_validate_backup_test))
41 | suite.addTests(loader.loadTestsFromModule(compression_test))
42 | suite.addTests(loader.loadTestsFromModule(delete_test))
43 | suite.addTests(loader.loadTestsFromModule(delta_test))
44 | suite.addTests(loader.loadTestsFromModule(exclude_test))
45 | suite.addTests(loader.loadTestsFromModule(external_test))
46 | suite.addTests(loader.loadTestsFromModule(false_positive_test))
47 | suite.addTests(loader.loadTestsFromModule(init_test))
48 | suite.addTests(loader.loadTestsFromModule(incr_restore_test))
49 | suite.addTests(loader.loadTestsFromModule(locking_test))
50 | suite.addTests(loader.loadTestsFromModule(logging_test))
51 | suite.addTests(loader.loadTestsFromModule(merge_test))
52 | suite.addTests(loader.loadTestsFromModule(option_test))
53 | suite.addTests(loader.loadTestsFromModule(page_test))
54 | suite.addTests(loader.loadTestsFromModule(pgpro560_test))
55 | suite.addTests(loader.loadTestsFromModule(pgpro589_test))
56 | suite.addTests(loader.loadTestsFromModule(pgpro2068_test))
57 | suite.addTests(loader.loadTestsFromModule(remote_test))
58 | suite.addTests(loader.loadTestsFromModule(replica_test))
59 | suite.addTests(loader.loadTestsFromModule(restore_test))
60 | suite.addTests(loader.loadTestsFromModule(retention_test))
61 | suite.addTests(loader.loadTestsFromModule(set_backup_test))
62 | suite.addTests(loader.loadTestsFromModule(show_test))
63 | suite.addTests(loader.loadTestsFromModule(time_stamp_test))
64 | suite.addTests(loader.loadTestsFromModule(validate_test))
65 | suite.addTests(loader.loadTestsFromModule(CVE_2018_1058_test))
66 |
67 | return suite
68 |
69 | # test_pgpro434_2 unexpected success
70 | # ToDo:
71 | # logging:
72 | # https://jira.postgrespro.ru/secure/attachment/20420/20420_doc_logging.md
73 | # archive:
74 | # immediate recovery and full recovery
75 |
--------------------------------------------------------------------------------
/tests/cfs_catchup_test.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest
3 | import random
4 | import shutil
5 |
6 | from .helpers.cfs_helpers import find_by_extensions, find_by_name, find_by_pattern, corrupt_file
7 | from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
8 |
9 |
10 | class CfsCatchupNoEncTest(ProbackupTest, unittest.TestCase):
11 |
12 | @unittest.skipUnless(ProbackupTest.enterprise, 'skip')
13 | def test_full_catchup_with_tablespace(self):
14 | """
15 | Test tablespace transfers
16 | """
17 | # preparation
18 | src_pg = self.make_simple_node(
19 | base_dir = os.path.join(self.module_name, self.fname, 'src'),
20 | set_replication = True
21 | )
22 | src_pg.slow_start()
23 | tblspace1_old_path = self.get_tblspace_path(src_pg, 'tblspace1_old')
24 | self.create_tblspace_in_node(src_pg, 'tblspace1', tblspc_path = tblspace1_old_path, cfs=True)
25 | src_pg.safe_psql(
26 | "postgres",
27 | "CREATE TABLE ultimate_question TABLESPACE tblspace1 AS SELECT 42 AS answer")
28 | src_query_result = src_pg.table_checksum("ultimate_question")
29 | src_pg.safe_psql(
30 | "postgres",
31 | "CHECKPOINT")
32 |
33 | # do full catchup with tablespace mapping
34 | dst_pg = self.make_empty_node(os.path.join(self.module_name, self.fname, 'dst'))
35 | tblspace1_new_path = self.get_tblspace_path(dst_pg, 'tblspace1_new')
36 | self.catchup_node(
37 | backup_mode = 'FULL',
38 | source_pgdata = src_pg.data_dir,
39 | destination_node = dst_pg,
40 | options = [
41 | '-d', 'postgres',
42 | '-p', str(src_pg.port),
43 | '--stream',
44 | '-T', '{0}={1}'.format(tblspace1_old_path, tblspace1_new_path)
45 | ]
46 | )
47 |
48 | # 1st check: compare data directories
49 | self.compare_pgdata(
50 | self.pgdata_content(src_pg.data_dir),
51 | self.pgdata_content(dst_pg.data_dir)
52 | )
53 |
54 | # check cfm size
55 | cfms = find_by_extensions([os.path.join(dst_pg.data_dir)], ['.cfm'])
56 | self.assertTrue(cfms, "ERROR: .cfm files not found in backup dir")
57 | for cfm in cfms:
58 | size = os.stat(cfm).st_size
59 | self.assertLessEqual(size, 4096,
60 | "ERROR: {0} is not truncated (has size {1} > 4096)".format(
61 | cfm, size
62 | ))
63 |
64 | # make changes in master tablespace
65 | src_pg.safe_psql(
66 | "postgres",
67 | "UPDATE ultimate_question SET answer = -1")
68 | src_pg.safe_psql(
69 | "postgres",
70 | "CHECKPOINT")
71 |
72 | # run&recover catchup'ed instance
73 | dst_options = {}
74 | dst_options['port'] = str(dst_pg.port)
75 | self.set_auto_conf(dst_pg, dst_options)
76 | dst_pg.slow_start()
77 |
78 | # 2nd check: run verification query
79 | dst_query_result = dst_pg.table_checksum("ultimate_question")
80 | self.assertEqual(src_query_result, dst_query_result, 'Different answer from copy')
81 |
82 | # and now delta backup
83 | dst_pg.stop()
84 |
85 | self.catchup_node(
86 | backup_mode = 'DELTA',
87 | source_pgdata = src_pg.data_dir,
88 | destination_node = dst_pg,
89 | options = [
90 | '-d', 'postgres',
91 | '-p', str(src_pg.port),
92 | '--stream',
93 | '-T', '{0}={1}'.format(tblspace1_old_path, tblspace1_new_path)
94 | ]
95 | )
96 |
97 | # check cfm size again
98 | cfms = find_by_extensions([os.path.join(dst_pg.data_dir)], ['.cfm'])
99 | self.assertTrue(cfms, "ERROR: .cfm files not found in backup dir")
100 | for cfm in cfms:
101 | size = os.stat(cfm).st_size
102 | self.assertLessEqual(size, 4096,
103 | "ERROR: {0} is not truncated (has size {1} > 4096)".format(
104 | cfm, size
105 | ))
106 |
107 | # run&recover catchup'ed instance
108 | dst_options = {}
109 | dst_options['port'] = str(dst_pg.port)
110 | self.set_auto_conf(dst_pg, dst_options)
111 | dst_pg.slow_start()
112 |
113 |
114 | # 3rd check: run verification query
115 | src_query_result = src_pg.table_checksum("ultimate_question")
116 | dst_query_result = dst_pg.table_checksum("ultimate_question")
117 | self.assertEqual(src_query_result, dst_query_result, 'Different answer from copy')
118 |
--------------------------------------------------------------------------------
/tests/cfs_validate_backup_test.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest
3 | import random
4 |
5 | from .helpers.cfs_helpers import find_by_extensions, find_by_name, find_by_pattern, corrupt_file
6 | from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
7 |
8 | tblspace_name = 'cfs_tblspace'
9 |
10 |
11 | class CfsValidateBackupNoenc(ProbackupTest,unittest.TestCase):
12 | def setUp(self):
13 | pass
14 |
15 | def test_validate_fullbackup_empty_tablespace_after_delete_pg_compression(self):
16 | pass
17 |
18 | def tearDown(self):
19 | pass
20 |
21 |
22 | #class CfsValidateBackupNoenc(CfsValidateBackupNoenc):
23 | # os.environ["PG_CIPHER_KEY"] = "super_secret_cipher_key"
24 | # super(CfsValidateBackupNoenc).setUp()
25 |
--------------------------------------------------------------------------------
/tests/config_test.py:
--------------------------------------------------------------------------------
1 | import unittest
2 | import subprocess
3 | import os
4 | from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
5 | from sys import exit
6 | from shutil import copyfile
7 |
8 |
9 | class ConfigTest(ProbackupTest, unittest.TestCase):
10 |
11 | # @unittest.expectedFailure
12 | # @unittest.skip("skip")
13 | def test_remove_instance_config(self):
14 | """remove pg_probackup.conself.f"""
15 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
16 | node = self.make_simple_node(
17 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
18 | set_replication=True,
19 | initdb_params=['--data-checksums'])
20 |
21 | self.init_pb(backup_dir)
22 | self.add_instance(backup_dir, 'node', node)
23 | self.show_pb(backup_dir)
24 | self.set_archiving(backup_dir, 'node', node)
25 | node.slow_start()
26 |
27 | self.backup_node(backup_dir, 'node', node)
28 |
29 | self.backup_node(
30 | backup_dir, 'node', node, backup_type='page')
31 |
32 | conf_file = os.path.join(
33 | backup_dir, 'backups','node', 'pg_probackup.conf')
34 |
35 | os.unlink(os.path.join(backup_dir, 'backups','node', 'pg_probackup.conf'))
36 |
37 | try:
38 | self.backup_node(
39 | backup_dir, 'node', node, backup_type='page')
40 | self.assertEqual(
41 | 1, 0,
42 | "Expecting Error because pg_probackup.conf is missing. "
43 | ".\n Output: {0} \n CMD: {1}".format(
44 | repr(self.output), self.cmd))
45 | except ProbackupException as e:
46 | self.assertIn(
47 | 'ERROR: could not open file "{0}": '
48 | 'No such file or directory'.format(conf_file),
49 | e.message,
50 | "\n Unexpected Error Message: {0}\n CMD: {1}".format(
51 | repr(e.message), self.cmd))
52 |
53 | # @unittest.expectedFailure
54 | # @unittest.skip("skip")
55 | def test_corrupt_backup_content(self):
56 | """corrupt backup_content.control"""
57 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
58 | node = self.make_simple_node(
59 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
60 | set_replication=True,
61 | initdb_params=['--data-checksums'])
62 |
63 | self.init_pb(backup_dir)
64 | self.add_instance(backup_dir, 'node', node)
65 | self.set_archiving(backup_dir, 'node', node)
66 | node.slow_start()
67 |
68 | full1_id = self.backup_node(backup_dir, 'node', node)
69 |
70 | node.safe_psql(
71 | 'postgres',
72 | 'create table t1()')
73 |
74 | fulle2_id = self.backup_node(backup_dir, 'node', node)
75 |
76 | fulle1_conf_file = os.path.join(
77 | backup_dir, 'backups','node', full1_id, 'backup_content.control')
78 |
79 | fulle2_conf_file = os.path.join(
80 | backup_dir, 'backups','node', fulle2_id, 'backup_content.control')
81 |
82 | copyfile(fulle2_conf_file, fulle1_conf_file)
83 |
84 | try:
85 | self.validate_pb(backup_dir, 'node')
86 | self.assertEqual(
87 | 1, 0,
88 | "Expecting Error because pg_probackup.conf is missing. "
89 | ".\n Output: {0} \n CMD: {1}".format(
90 | repr(self.output), self.cmd))
91 | except ProbackupException as e:
92 | self.assertIn(
93 | "WARNING: Invalid CRC of backup control file '{0}':".format(fulle1_conf_file),
94 | e.message,
95 | "\n Unexpected Error Message: {0}\n CMD: {1}".format(
96 | repr(e.message), self.cmd))
97 |
98 | self.assertIn(
99 | "WARNING: Failed to get file list for backup {0}".format(full1_id),
100 | e.message,
101 | "\n Unexpected Error Message: {0}\n CMD: {1}".format(
102 | repr(e.message), self.cmd))
103 |
104 | self.assertIn(
105 | "WARNING: Backup {0} file list is corrupted".format(full1_id),
106 | e.message,
107 | "\n Unexpected Error Message: {0}\n CMD: {1}".format(
108 | repr(e.message), self.cmd))
109 |
110 | self.show_pb(backup_dir, 'node', full1_id)['status']
111 |
112 | self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], 'CORRUPT')
113 | self.assertEqual(self.show_pb(backup_dir, 'node')[1]['status'], 'OK')
114 |
--------------------------------------------------------------------------------
/tests/helpers/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['ptrack_helpers', 'cfs_helpers', 'data_helpers']
2 |
3 | import unittest
4 |
5 | # python 2.7 compatibility
6 | if not hasattr(unittest.TestCase, "skipTest"):
7 | def skipTest(self, reason):
8 | raise unittest.SkipTest(reason)
9 | unittest.TestCase.skipTest = skipTest
--------------------------------------------------------------------------------
/tests/helpers/cfs_helpers.py:
--------------------------------------------------------------------------------
1 | import os
2 | import re
3 | import random
4 | import string
5 |
6 |
7 | def find_by_extensions(dirs=None, extensions=None):
8 | """
9 | find_by_extensions(['path1','path2'],['.txt','.log'])
10 | :return:
11 | Return list of files include full path by file extensions
12 | """
13 | files = []
14 | new_dirs = []
15 |
16 | if dirs is not None and extensions is not None:
17 | for d in dirs:
18 | try:
19 | new_dirs += [os.path.join(d, f) for f in os.listdir(d)]
20 | except OSError:
21 | if os.path.splitext(d)[1] in extensions:
22 | files.append(d)
23 |
24 | if new_dirs:
25 | files.extend(find_by_extensions(new_dirs, extensions))
26 |
27 | return files
28 |
29 |
30 | def find_by_pattern(dirs=None, pattern=None):
31 | """
32 | find_by_pattern(['path1','path2'],'^.*/*.txt')
33 | :return:
34 | Return list of files include full path by pattern
35 | """
36 | files = []
37 | new_dirs = []
38 |
39 | if dirs is not None and pattern is not None:
40 | for d in dirs:
41 | try:
42 | new_dirs += [os.path.join(d, f) for f in os.listdir(d)]
43 | except OSError:
44 | if re.match(pattern,d):
45 | files.append(d)
46 |
47 | if new_dirs:
48 | files.extend(find_by_pattern(new_dirs, pattern))
49 |
50 | return files
51 |
52 |
53 | def find_by_name(dirs=None, filename=None):
54 | files = []
55 | new_dirs = []
56 |
57 | if dirs is not None and filename is not None:
58 | for d in dirs:
59 | try:
60 | new_dirs += [os.path.join(d, f) for f in os.listdir(d)]
61 | except OSError:
62 | if os.path.basename(d) in filename:
63 | files.append(d)
64 |
65 | if new_dirs:
66 | files.extend(find_by_name(new_dirs, filename))
67 |
68 | return files
69 |
70 |
71 | def corrupt_file(filename):
72 | file_size = None
73 | try:
74 | file_size = os.path.getsize(filename)
75 | except OSError:
76 | return False
77 |
78 | try:
79 | with open(filename, "rb+") as f:
80 | f.seek(random.randint(int(0.1*file_size),int(0.8*file_size)))
81 | f.write(random_string(0.1*file_size))
82 | f.close()
83 | except OSError:
84 | return False
85 |
86 | return True
87 |
88 |
89 | def random_string(n):
90 | a = string.ascii_letters + string.digits
91 | random_str = ''.join([random.choice(a) for i in range(int(n)+1)])
92 | return str.encode(random_str)
93 | # return ''.join([random.choice(a) for i in range(int(n)+1)])
94 |
--------------------------------------------------------------------------------
/tests/helpers/data_helpers.py:
--------------------------------------------------------------------------------
1 | import re
2 | import unittest
3 | import functools
4 | import time
5 |
6 | def _tail_file(file, linetimeout, totaltimeout):
7 | start = time.time()
8 | with open(file, 'r') as f:
9 | waits = 0
10 | while waits < linetimeout:
11 | line = f.readline()
12 | if line == '':
13 | waits += 1
14 | time.sleep(1)
15 | continue
16 | waits = 0
17 | yield line
18 | if time.time() - start > totaltimeout:
19 | raise TimeoutError("total timeout tailing %s" % (file,))
20 | else:
21 | raise TimeoutError("line timeout tailing %s" % (file,))
22 |
23 |
24 | class tail_file(object): # snake case to immitate function
25 | def __init__(self, filename, *, linetimeout=10, totaltimeout=60, collect=False):
26 | self.filename = filename
27 | self.tailer = _tail_file(filename, linetimeout, totaltimeout)
28 | self.collect = collect
29 | self.lines = []
30 | self._content = None
31 |
32 | def __iter__(self):
33 | return self
34 |
35 | def __next__(self):
36 | line = next(self.tailer)
37 | if self.collect:
38 | self.lines.append(line)
39 | self._content = None
40 | return line
41 |
42 | @property
43 | def content(self):
44 | if not self.collect:
45 | raise AttributeError("content collection is not enabled",
46 | name="content", obj=self)
47 | if not self._content:
48 | self._content = "".join(self.lines)
49 | return self._content
50 |
51 | def drop_content(self):
52 | self.lines.clear()
53 | self._content = None
54 |
55 | def stop_collect(self):
56 | self.drop_content()
57 | self.collect = False
58 |
59 | def wait(self, *, contains:str = None, regex:str = None):
60 | assert contains != None or regex != None
61 | assert contains == None or regex == None
62 | try:
63 | for line in self:
64 | if contains is not None and contains in line:
65 | break
66 | if regex is not None and re.search(regex, line):
67 | break
68 | except TimeoutError:
69 | msg = "Didn't found expected "
70 | if contains is not None:
71 | msg += repr(contains)
72 | elif regex is not None:
73 | msg += f"/{regex}/"
74 | msg += f" in {self.filename}"
75 | raise unittest.TestCase.failureException(msg)
76 |
77 | def wait_shutdown(self):
78 | self.wait(contains='database system is shut down')
79 |
--------------------------------------------------------------------------------
/tests/pgpro560_test.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest
3 | from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
4 | from datetime import datetime, timedelta
5 | import subprocess
6 | from time import sleep
7 |
8 |
9 | class CheckSystemID(ProbackupTest, unittest.TestCase):
10 |
11 | # @unittest.skip("skip")
12 | # @unittest.expectedFailure
13 | def test_pgpro560_control_file_loss(self):
14 | """
15 | https://jira.postgrespro.ru/browse/PGPRO-560
16 | make node with stream support, delete control file
17 | make backup
18 | check that backup failed
19 | """
20 | node = self.make_simple_node(
21 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
22 | set_replication=True,
23 | initdb_params=['--data-checksums'])
24 |
25 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
26 | self.init_pb(backup_dir)
27 | self.add_instance(backup_dir, 'node', node)
28 | node.slow_start()
29 |
30 | file = os.path.join(node.base_dir, 'data', 'global', 'pg_control')
31 | # Not delete this file permanently
32 | os.rename(file, os.path.join(node.base_dir, 'data', 'global', 'pg_control_copy'))
33 |
34 | try:
35 | self.backup_node(backup_dir, 'node', node, options=['--stream'])
36 | # we should die here because exception is what we expect to happen
37 | self.assertEqual(
38 | 1, 0,
39 | "Expecting Error because pg_control was deleted.\n "
40 | "Output: {0} \n CMD: {1}".format(repr(self.output), self.cmd))
41 | except ProbackupException as e:
42 | self.assertTrue(
43 | 'ERROR: Could not open file' in e.message and
44 | 'pg_control' in e.message,
45 | '\n Unexpected Error Message: {0}\n CMD: {1}'.format(
46 | repr(e.message), self.cmd))
47 |
48 | # Return this file to avoid Postger fail
49 | os.rename(os.path.join(node.base_dir, 'data', 'global', 'pg_control_copy'), file)
50 |
51 | def test_pgpro560_systemid_mismatch(self):
52 | """
53 | https://jira.postgrespro.ru/browse/PGPRO-560
54 | make node1 and node2
55 | feed to backup PGDATA from node1 and PGPORT from node2
56 | check that backup failed
57 | """
58 | node1 = self.make_simple_node(
59 | base_dir=os.path.join(self.module_name, self.fname, 'node1'),
60 | set_replication=True,
61 | initdb_params=['--data-checksums'])
62 |
63 | node1.slow_start()
64 | node2 = self.make_simple_node(
65 | base_dir=os.path.join(self.module_name, self.fname, 'node2'),
66 | set_replication=True,
67 | initdb_params=['--data-checksums'])
68 |
69 | node2.slow_start()
70 |
71 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
72 | self.init_pb(backup_dir)
73 | self.add_instance(backup_dir, 'node1', node1)
74 |
75 | try:
76 | self.backup_node(backup_dir, 'node1', node2, options=['--stream'])
77 | # we should die here because exception is what we expect to happen
78 | self.assertEqual(
79 | 1, 0,
80 | "Expecting Error because of SYSTEM ID mismatch.\n "
81 | "Output: {0} \n CMD: {1}".format(repr(self.output), self.cmd))
82 | except ProbackupException as e:
83 | if self.get_version(node1) > 90600:
84 | self.assertTrue(
85 | 'ERROR: Backup data directory was '
86 | 'initialized for system id' in e.message and
87 | 'but connected instance system id is' in e.message,
88 | '\n Unexpected Error Message: {0}\n CMD: {1}'.format(
89 | repr(e.message), self.cmd))
90 | else:
91 | self.assertIn(
92 | 'ERROR: System identifier mismatch. '
93 | 'Connected PostgreSQL instance has system id',
94 | e.message,
95 | '\n Unexpected Error Message: {0}\n CMD: {1}'.format(
96 | repr(e.message), self.cmd))
97 |
98 | sleep(1)
99 |
100 | try:
101 | self.backup_node(
102 | backup_dir, 'node1', node2,
103 | data_dir=node1.data_dir, options=['--stream'])
104 | # we should die here because exception is what we expect to happen
105 | self.assertEqual(
106 | 1, 0,
107 | "Expecting Error because of of SYSTEM ID mismatch.\n "
108 | "Output: {0} \n CMD: {1}".format(repr(self.output), self.cmd))
109 | except ProbackupException as e:
110 | if self.get_version(node1) > 90600:
111 | self.assertTrue(
112 | 'ERROR: Backup data directory was initialized '
113 | 'for system id' in e.message and
114 | 'but connected instance system id is' in e.message,
115 | '\n Unexpected Error Message: {0}\n CMD: {1}'.format(
116 | repr(e.message), self.cmd))
117 | else:
118 | self.assertIn(
119 | 'ERROR: System identifier mismatch. '
120 | 'Connected PostgreSQL instance has system id',
121 | e.message,
122 | '\n Unexpected Error Message: {0}\n CMD: {1}'.format(
123 | repr(e.message), self.cmd))
124 |
--------------------------------------------------------------------------------
/tests/pgpro589_test.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest
3 | from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack
4 | from datetime import datetime, timedelta
5 | import subprocess
6 |
7 |
8 | class ArchiveCheck(ProbackupTest, unittest.TestCase):
9 |
10 | def test_pgpro589(self):
11 | """
12 | https://jira.postgrespro.ru/browse/PGPRO-589
13 | make node without archive support, make backup which should fail
14 | check that backup status equal to ERROR
15 | check that no files where copied to backup catalogue
16 | """
17 | node = self.make_simple_node(
18 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
19 | initdb_params=['--data-checksums'])
20 |
21 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
22 | self.init_pb(backup_dir)
23 | self.add_instance(backup_dir, 'node', node)
24 | self.set_archiving(backup_dir, 'node', node)
25 |
26 | # make erroneous archive_command
27 | self.set_auto_conf(node, {'archive_command': 'exit 0'})
28 | node.slow_start()
29 |
30 | node.pgbench_init(scale=5)
31 | pgbench = node.pgbench(
32 | stdout=subprocess.PIPE,
33 | stderr=subprocess.STDOUT,
34 | options=["-c", "4", "-T", "10"]
35 | )
36 | pgbench.wait()
37 | pgbench.stdout.close()
38 | path = node.safe_psql(
39 | "postgres",
40 | "select pg_relation_filepath('pgbench_accounts')").rstrip().decode(
41 | "utf-8")
42 |
43 | try:
44 | self.backup_node(
45 | backup_dir, 'node', node,
46 | options=['--archive-timeout=10'])
47 | # we should die here because exception is what we expect to happen
48 | self.assertEqual(
49 | 1, 0,
50 | "Expecting Error because of missing archive wal "
51 | "segment with start_lsn.\n Output: {0} \n CMD: {1}".format(
52 | repr(self.output), self.cmd))
53 | except ProbackupException as e:
54 | self.assertTrue(
55 | 'INFO: Wait for WAL segment' in e.message and
56 | 'ERROR: WAL segment' in e.message and
57 | 'could not be archived in 10 seconds' in e.message,
58 | '\n Unexpected Error Message: {0}\n CMD: {1}'.format(
59 | repr(e.message), self.cmd))
60 |
61 | backup_id = self.show_pb(backup_dir, 'node')[0]['id']
62 | self.assertEqual(
63 | 'ERROR', self.show_pb(backup_dir, 'node', backup_id)['status'],
64 | 'Backup should have ERROR status')
65 | file = os.path.join(
66 | backup_dir, 'backups', 'node',
67 | backup_id, 'database', path)
68 | self.assertFalse(
69 | os.path.isfile(file),
70 | "\n Start LSN was not found in archive but datafiles where "
71 | "copied to backup catalogue.\n For example: {0}\n "
72 | "It is not optimal".format(file))
73 |
--------------------------------------------------------------------------------
/tests/remote_test.py:
--------------------------------------------------------------------------------
1 | import unittest
2 | import os
3 | from time import sleep
4 | from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
5 | from .helpers.cfs_helpers import find_by_name
6 |
7 |
8 | class RemoteTest(ProbackupTest, unittest.TestCase):
9 |
10 | # @unittest.skip("skip")
11 | # @unittest.expectedFailure
12 | def test_remote_sanity(self):
13 | node = self.make_simple_node(
14 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
15 | set_replication=True,
16 | initdb_params=['--data-checksums'])
17 |
18 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
19 | self.init_pb(backup_dir)
20 | self.add_instance(backup_dir, 'node', node)
21 | node.slow_start()
22 |
23 | output = self.backup_node(
24 | backup_dir, 'node', node,
25 | options=['--stream'], no_remote=True, return_id=False)
26 | self.assertIn('remote: false', output)
27 |
28 | # try:
29 | # self.backup_node(
30 | # backup_dir, 'node',
31 | # node, options=['--remote-proto=ssh', '--stream'], no_remote=True)
32 | # # we should die here because exception is what we expect to happen
33 | # self.assertEqual(
34 | # 1, 0,
35 | # "Expecting Error because remote-host option is missing."
36 | # "\n Output: {0} \n CMD: {1}".format(
37 | # repr(self.output), self.cmd))
38 | # except ProbackupException as e:
39 | # self.assertIn(
40 | # "Insert correct error",
41 | # e.message,
42 | # "\n Unexpected Error Message: {0}\n CMD: {1}".format(
43 | # repr(e.message), self.cmd))
44 |
--------------------------------------------------------------------------------
/tests/requirements.txt:
--------------------------------------------------------------------------------
1 | # Testgres can be installed in the following ways:
2 | # 1. From a pip package (recommended)
3 | # testgres==1.8.5
4 | # 2. From a specific Git branch, tag or commit
5 | # git+https://github.com/postgrespro/testgres.git@
6 | # 3. From a local directory
7 | # /path/to/local/directory/testgres
8 | git+https://github.com/postgrespro/testgres.git@archive-command-exec#egg=testgres-pg_probackup2&subdirectory=testgres/plugins/pg_probackup2
9 | allure-pytest
10 | deprecation
11 | pexpect
12 | pytest==7.4.3
13 | pytest-xdist
14 |
--------------------------------------------------------------------------------
/tests/time_consuming_test.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest
3 | from .helpers.ptrack_helpers import ProbackupTest
4 | import subprocess
5 | from time import sleep
6 |
7 |
8 | class TimeConsumingTests(ProbackupTest, unittest.TestCase):
9 | def test_pbckp150(self):
10 | """
11 | https://jira.postgrespro.ru/browse/PBCKP-150
12 | create a node filled with pgbench
13 | create FULL backup followed by PTRACK backup
14 | run pgbench, vacuum VERBOSE FULL and ptrack backups in parallel
15 | """
16 | # init node
17 | if self.pg_config_version < self.version_to_num('11.0'):
18 | self.skipTest('You need PostgreSQL >= 11 for this test')
19 | if not self.ptrack:
20 | self.skipTest('Skipped because ptrack support is disabled')
21 |
22 | node = self.make_simple_node(
23 | base_dir=os.path.join(self.module_name, self.fname, 'node'),
24 | set_replication=True,
25 | ptrack_enable=self.ptrack,
26 | initdb_params=['--data-checksums'],
27 | pg_options={
28 | 'max_connections': 100,
29 | 'log_statement': 'none',
30 | 'log_checkpoints': 'on',
31 | 'autovacuum': 'off',
32 | 'ptrack.map_size': 1})
33 |
34 | if node.major_version >= 13:
35 | self.set_auto_conf(node, {'wal_keep_size': '16000MB'})
36 | else:
37 | self.set_auto_conf(node, {'wal_keep_segments': '1000'})
38 |
39 | # init probackup and add an instance
40 | backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
41 | self.init_pb(backup_dir)
42 | self.add_instance(backup_dir, 'node', node)
43 |
44 | # run the node and init ptrack
45 | node.slow_start()
46 | node.safe_psql("postgres", "CREATE EXTENSION ptrack")
47 | # populate it with pgbench
48 | node.pgbench_init(scale=5)
49 |
50 | # FULL backup followed by PTRACK backup
51 | self.backup_node(backup_dir, 'node', node, options=['--stream'])
52 | self.backup_node(backup_dir, 'node', node, backup_type='ptrack', options=['--stream'])
53 |
54 | # run ordinary pgbench scenario to imitate some activity and another pgbench for vacuuming in parallel
55 | nBenchDuration = 30
56 | pgbench = node.pgbench(options=['-c', '20', '-j', '8', '-T', str(nBenchDuration)])
57 | with open('/tmp/pbckp150vacuum.sql', 'w') as f:
58 | f.write('VACUUM (FULL) pgbench_accounts, pgbench_tellers, pgbench_history; SELECT pg_sleep(1);\n')
59 | pgbenchval = node.pgbench(options=['-c', '1', '-f', '/tmp/pbckp150vacuum.sql', '-T', str(nBenchDuration)])
60 |
61 | # several PTRACK backups
62 | for i in range(nBenchDuration):
63 | print("[{}] backing up PTRACK diff...".format(i+1))
64 | self.backup_node(backup_dir, 'node', node, backup_type='ptrack', options=['--stream', '--log-level-console', 'VERBOSE'])
65 | sleep(0.1)
66 | # if the activity pgbench has finished, stop backing up
67 | if pgbench.poll() is not None:
68 | break
69 |
70 | pgbench.kill()
71 | pgbenchval.kill()
72 | pgbench.wait()
73 | pgbenchval.wait()
74 |
75 | backups = self.show_pb(backup_dir, 'node')
76 | for b in backups:
77 | self.assertEqual("OK", b['status'])
78 |
--------------------------------------------------------------------------------
/travis/before-install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -xe
4 |
5 | mkdir /pg
6 | chown travis /pg
--------------------------------------------------------------------------------
/travis/before-script-user.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -xe
4 |
5 | ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ""
6 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
7 | ssh-keyscan -H localhost >> ~/.ssh/known_hosts
8 |
--------------------------------------------------------------------------------
/travis/before-script.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -xe
4 |
5 | /etc/init.d/ssh start
6 |
7 | # Show pg_config path (just in case)
8 | echo "############### pg_config path:"
9 | which pg_config
10 |
11 | # Show pg_config just in case
12 | echo "############### pg_config:"
13 | pg_config
14 |
15 | # Show kernel parameters
16 | echo "############### kernel params:"
17 | cat /proc/sys/kernel/yama/ptrace_scope
18 | sudo sysctl kernel.yama.ptrace_scope=0
19 | cat /proc/sys/kernel/yama/ptrace_scope
20 |
--------------------------------------------------------------------------------
/travis/install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -xe
4 |
5 | if [ -z ${PG_VERSION+x} ]; then
6 | echo PG_VERSION is not set!
7 | exit 1
8 | fi
9 |
10 | if [ -z ${PG_BRANCH+x} ]; then
11 | echo PG_BRANCH is not set!
12 | exit 1
13 | fi
14 |
15 | if [ -z ${PTRACK_PATCH_PG_BRANCH+x} ]; then
16 | PTRACK_PATCH_PG_BRANCH=OFF
17 | fi
18 |
19 | # fix
20 | sudo chown -R travis /home/travis/.ccache
21 |
22 | export PGHOME=/pg
23 |
24 | # Clone Postgres
25 | echo "############### Getting Postgres sources:"
26 | git clone https://github.com/postgres/postgres.git -b $PG_BRANCH --depth=1
27 |
28 | # Clone ptrack
29 | if [ "$PTRACK_PATCH_PG_BRANCH" != "OFF" ]; then
30 | git clone https://github.com/postgrespro/ptrack.git -b master --depth=1 postgres/contrib/ptrack
31 | export PG_PROBACKUP_PTRACK=ON
32 | else
33 | export PG_PROBACKUP_PTRACK=OFF
34 | fi
35 |
36 | # Compile and install Postgres
37 | echo "############### Compiling Postgres:"
38 | cd postgres # Go to postgres dir
39 | if [ "$PG_PROBACKUP_PTRACK" = "ON" ]; then
40 | git apply -3 contrib/ptrack/patches/${PTRACK_PATCH_PG_BRANCH}-ptrack-core.diff
41 | fi
42 | CC='ccache gcc' CFLAGS="-Og" ./configure --prefix=$PGHOME \
43 | --cache-file=~/.ccache/configure-cache \
44 | --enable-debug --enable-cassert --enable-depend \
45 | --enable-tap-tests --enable-nls
46 | make -s -j$(nproc) install
47 | make -s -j$(nproc) -C contrib/ install
48 |
49 | # Override default Postgres instance
50 | export PATH=$PGHOME/bin:$PATH
51 | export LD_LIBRARY_PATH=$PGHOME/lib
52 | export PG_CONFIG=$(which pg_config)
53 |
54 | if [ "$PG_PROBACKUP_PTRACK" = "ON" ]; then
55 | echo "############### Compiling Ptrack:"
56 | make -C contrib/ptrack install
57 | fi
58 |
59 | # Get amcheck if missing
60 | if [ ! -d "contrib/amcheck" ]; then
61 | echo "############### Getting missing amcheck:"
62 | git clone https://github.com/petergeoghegan/amcheck.git --depth=1 contrib/amcheck
63 | make -C contrib/amcheck install
64 | fi
65 |
66 | pip3 install testgres
--------------------------------------------------------------------------------
/travis/script.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -xe
4 |
5 | export PGHOME=/pg
6 | export PG_SRC=$PWD/postgres
7 | export PATH=$PGHOME/bin:$PATH
8 | export LD_LIBRARY_PATH=$PGHOME/lib
9 | export PG_CONFIG=$(which pg_config)
10 |
11 | # Build and install pg_probackup (using PG_CPPFLAGS and SHLIB_LINK for gcov)
12 | echo "############### Compiling and installing pg_probackup:"
13 | # make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" top_srcdir=$CUSTOM_PG_SRC install
14 | make USE_PGXS=1 top_srcdir=$PG_SRC install
15 |
16 | if [ -z ${MODE+x} ]; then
17 | MODE=basic
18 | fi
19 |
20 | if [ -z ${PGPROBACKUP_GDB+x} ]; then
21 | PGPROBACKUP_GDB=ON
22 | fi
23 |
24 | echo "############### Testing:"
25 | echo PG_PROBACKUP_PARANOIA=${PG_PROBACKUP_PARANOIA}
26 | echo ARCHIVE_COMPRESSION=${ARCHIVE_COMPRESSION}
27 | echo PGPROBACKUPBIN_OLD=${PGPROBACKUPBIN_OLD}
28 | echo PGPROBACKUPBIN=${PGPROBACKUPBIN}
29 | echo PGPROBACKUP_SSH_REMOTE=${PGPROBACKUP_SSH_REMOTE}
30 | echo PGPROBACKUP_GDB=${PGPROBACKUP_GDB}
31 | echo PG_PROBACKUP_PTRACK=${PG_PROBACKUP_PTRACK}
32 |
33 | if [ "$MODE" = "basic" ]; then
34 | export PG_PROBACKUP_TEST_BASIC=ON
35 | echo PG_PROBACKUP_TEST_BASIC=${PG_PROBACKUP_TEST_BASIC}
36 | python3 -m unittest -v tests
37 | python3 -m unittest -v tests.init_test
38 | else
39 | echo PG_PROBACKUP_TEST_BASIC=${PG_PROBACKUP_TEST_BASIC}
40 | python3 -m unittest -v tests.$MODE
41 | fi
42 |
--------------------------------------------------------------------------------