Skip to content

Instantly share code, notes, and snippets.

@mkulik-rh
Last active September 14, 2021 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkulik-rh/0899b8f07bb6fabeee0c7a94e7b8d340 to your computer and use it in GitHub Desktop.
Save mkulik-rh/0899b8f07bb6fabeee0c7a94e7b8d340 to your computer and use it in GitHub Desktop.
pg_auto_failover spec file
%bcond_without docs
%bcond_without llvmjit
%global precise_version %{?epoch:%epoch:}%version-%release
Name: pg_auto_failover
Version: 1.6.2
Release: 1%{?dist}
Summary: Postgres extension and service for automated failover and high-availability
License: ASL 1.0
URL: https://github.com/citusdata/%{name}/
Source0: https://github.com/citusdata/%{name}/archive/refs/tags/v%{version}.tar.gz
# Reverting sphinx_rtd_theme fork
Patch0: sphinx_rtd_theme.patch
# Requirements for pg_auto_failover code
# openssl-devel provides necessary cryptography library
# build process require the same libraries that were used when PostgreSQL was built
# pg_config --libs
BuildRequires: gcc-c++ openssl-devel zlib-devel libxslt-devel readline-devel pam-devel
# PostgreSQL libraries and development headers (used by pg_auto_failover)
BuildRequires: postgresql-static postgresql-server-devel
# Requirements for doc and man files
BuildRequires: python3-sphinx
%if %{with docs}
# Requirements for doc files
BuildRequires: python3-sphinx_rtd_theme graphviz
%endif
# Fedora 35 include new dependency with postgresql-server-devel package:
# postgresql-private-devel. It conflicts with libpq-devel.
# postgresql-server-devel is required to compile server extension
%if 0%{?fedora} < 35
BuildRequires: libpq-devel
%endif
# openssl is required for ssl-self-signed option in pg_auto_failover
Recommends: openssl
Requires: postgresql-server postgresql-contrib
%if %{with docs}
%package docs
Summary: Extra documentation for pg_auto_failover
# Additional licenses for jQuery and other .js files
License: ASL 1.0 and MIT and BSD
Requires: %{name}%{?_isa} = %precise_version
BuildArch: noarch
%endif
%if %{with llvmjit}
%package llvmjit
Summary: Just-in-time compilation support for pg_auto_failover
License: ASL 1.0
Requires: %{name}%{?_isa} = %precise_version
Requires: postgresql-llvmjit
%endif
%description
pg_auto_failover is an extension and service for PostgreSQL that monitors and
manages automated failover for a Postgres cluster. It is optimized for
simplicity and correctness and supports Postgres 10 and newer.
We set up one PostgreSQL server as a monitor node as well as a primary and
secondary node for storing data. The monitor node tracks the health of the
data nodes and implements a failover state machine. On the PostgreSQL nodes,
the pg_autoctl program runs alongside PostgreSQL and runs the necessary
commands to configure synchronous streaming replication.
%if %{with docs}
%description docs
The pg_auto_failover-docs package contains some additional documentation for
pg_auto_failover. Currently, this includes the main documentation in HTML
format.
%endif
%if %{with llvmjit}
%description llvmjit
This packages provides JIT support for pg_auto_failover.
%endif
%prep
%setup -q
%patch0 -p1
%build
# Generate additionally man/doc files
%make_build man %{?with_docs: docs}
%install
%make_install
# man files are generated with white spaces in filenames
# brp-compress responsible for automatically compressing
# man pages won't detect them
for f in docs/_build/man/*\ *; do
%{__mv} "$f" "${f// /_}";
done
%if %{without llvmjit}
%{__rm} -r %{buildroot}/%{_libdir}/pgsql/bitcode
%endif
# Add man files
install -p -D -m 0644 docs/_build/man/*.1 -t %{buildroot}%{_mandir}/man1
install -p -D -m 0644 docs/_build/man/*.5 -t %{buildroot}%{_mandir}/man5
%files
%{_bindir}/pg_autoctl
%{_libdir}/pgsql/pgautofailover.so
%{_datadir}/pgsql/extension/pgautofailover*.{sql,control}
%{_mandir}/man{1,5}/pg_auto*.{1,5}*
%license LICENSE
%if %{with docs}
%files docs
%doc docs/_build/html/* {README,CHANGELOG}.md
%endif
%if %{with llvmjit}
%files llvmjit
%dir %{_libdir}/pgsql/bitcode/pgautofailover
%{_libdir}/pgsql/bitcode/pgautofailover/*.bc
%{_libdir}/pgsql/bitcode/pgautofailover.index.bc
%endif
%changelog
* Sun Aug 22 2021 Marek Kulik <mkulik@redhat.com> 1.6.2-1
- Initial build
@mkulik-rh
Copy link
Author

Edited 31-08-2021

  • Fixed manual pages compression
  • Fixed license name

@mkulik-rh
Copy link
Author

Edited 31-08-2021 (2)

  • move docs to separate package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment