-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OSS ONLY] Add RPM spec file and Makefile logic to build Babelfish du…
…mp utils (#218) This commit adds a spec file which can be used to create RPM containing Babelfish dump utilities (bbf_dump/bbf_dumpall). The commit also introduces few new Makefile targets described below: * **sources:** Bundles the repository source into a tarball. * **rpm-only:** creates an RPM using given RPM spec file. * **rpm:** Combines both of the above steps. Additionally, added a github action to verify the RPM build and utilites generated afterwards. Task: BABEL-4412 Signed-off-by: Rishabh Tanwar <[email protected]>
- Loading branch information
1 parent
a211b57
commit 3f3dc68
Showing
3 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: BabelfishDump RPM Test | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build-rpm: | ||
name: Build BabelfishDump RPM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
id: checkout | ||
|
||
- name: Install Dependencies | ||
id: install-dependencies | ||
if: always() | ||
run: | | ||
sudo apt clean && sudo apt-get update --fix-missing -y | ||
sudo apt-get install alien libossp-uuid-dev uuid-dev zlib1g-dev liblz4-dev libicu-dev libxml2-dev openssl libssl-dev libpq-dev pkg-config bison flex libkrb5-dev libpam-dev libreadline-dev | ||
- name: Run RPM command | ||
id: run-rpm-command | ||
if: always() && steps.install-dependencies.outcome == 'success' | ||
run: | | ||
make NODEPS=1 rpm | ||
- name: Install RPM | ||
id: install-rpm | ||
if: always() && steps.run-rpm-command.outcome == 'success' | ||
run: | | ||
cd build | ||
# Install RPM package | ||
sudo alien -i BabelfishDump-* | ||
# Verify that utilites installed correctly | ||
bbf_dumpall -V | ||
bbf_dump -V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# This spec file and ancillary files are licensed in accordance with | ||
# The PostgreSQL license. | ||
# This spec file bundles the Babelfish dump utilities (bbf_dump/bbf_dumpall) | ||
# into an RPM. | ||
|
||
# In this file you can find the default build package list macros. | ||
# These can be overridden by defining on the rpm command line: | ||
# rpm --define 'packagename 1' .... to force the package to build. | ||
# rpm --define 'packagename 0' .... to force the package NOT to build. | ||
|
||
%{!?external_libpq:%global external_libpq 0} | ||
%{!?ssl:%global ssl 1} | ||
%{!?icu:%global icu 1} | ||
%{!?kerberos:%global kerberos 1} | ||
%{!?uuid:%global uuid 1} | ||
%{!?xml:%global xml 1} | ||
%{!?pam:%global pam 1} | ||
|
||
# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_of_Additional_RPM_Macros | ||
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) | ||
|
||
%undefine _missing_build_ids_terminate_build | ||
|
||
Name: BabelfishDump | ||
Summary: Postgresql dump utilities modified for Babelfish | ||
Version: 15.latest | ||
Release: 1%{?dist} | ||
License: PostgreSQL Global Development Group | ||
Url: https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish | ||
|
||
BuildRequires: make | ||
BuildRequires: lz4-devel | ||
BuildRequires: gcc | ||
BuildRequires: glibc-devel bison flex | ||
BuildRequires: readline-devel zlib-devel | ||
%if %external_libpq | ||
BuildRequires: libpq-devel >= %version | ||
%endif | ||
|
||
%if %ssl | ||
BuildRequires: openssl-devel | ||
%endif | ||
|
||
%if %kerberos | ||
BuildRequires: krb5-devel | ||
%endif | ||
|
||
%if %uuid | ||
BuildRequires: uuid-devel | ||
%endif | ||
|
||
%if %xml | ||
BuildRequires: libxml2-devel | ||
%endif | ||
|
||
%if %icu | ||
BuildRequires: libicu-devel | ||
%endif | ||
|
||
%if %pam | ||
BuildRequires: pam-devel | ||
%endif | ||
|
||
Source: %{name}.tar.gz | ||
|
||
# https://bugzilla.redhat.com/1464368 | ||
# and do not provide pkgconfig RPM provides (RHBZ#1980992) and #2121696 | ||
%global __provides_exclude_from %{_libdir}/(pgsql|pkgconfig) | ||
|
||
%description | ||
This package provides utilities to dump a Babelfish database. | ||
|
||
%prep | ||
%setup -q -n %{name} | ||
|
||
# Update binary versions | ||
sed -i "s/pg_dump (PostgreSQL)/bbf_dump (pg_dump compatible with Babelfish for PostgreSQL)/g" src/bin/pg_dump/pg_dump.c | ||
sed -i "s/pg_dumpall (PostgreSQL)/bbf_dumpall (pg_dumpall compatible with Babelfish for PostgreSQL)/g" src/bin/pg_dump/pg_dumpall.c | ||
|
||
%build | ||
# Building BabelfishDump | ||
|
||
# Fiddling with CFLAGS. | ||
CFLAGS="${CFLAGS:-%optflags}" | ||
|
||
# Strip out -ffast-math from CFLAGS.... | ||
CFLAGS=`echo $CFLAGS|xargs -n 1|grep -v ffast-math|xargs -n 100` | ||
export CFLAGS | ||
|
||
common_configure_options=' | ||
--disable-rpath | ||
%if %ssl | ||
--with-openssl | ||
%endif | ||
%if %xml | ||
--with-libxml | ||
%endif | ||
%if %kerberos | ||
--with-gssapi | ||
%endif | ||
%if %uuid | ||
--with-ossp-uuid | ||
%endif | ||
%if %icu | ||
--with-icu | ||
%endif | ||
%if %pam | ||
--with-pam | ||
%endif | ||
--with-lz4 | ||
--with-readline | ||
' | ||
|
||
%configure $common_configure_options | ||
|
||
make -C src/backend generated-headers | ||
export NO_GENERATED_HEADERS=1 | ||
make -C src/bin/pg_dump pg_dump pg_dumpall | ||
|
||
%install | ||
make -C src/bin/pg_dump install DESTDIR=$RPM_BUILD_ROOT | ||
|
||
# We don't need pg_restore | ||
rm -f $RPM_BUILD_ROOT/usr/bin/pg_restore | ||
# Rename binaries to bbf_* equivalent | ||
mv $RPM_BUILD_ROOT/usr/bin/pg_dump $RPM_BUILD_ROOT/usr/bin/bbf_dump | ||
mv $RPM_BUILD_ROOT/usr/bin/pg_dumpall $RPM_BUILD_ROOT/usr/bin/bbf_dumpall | ||
|
||
%check | ||
LD_LIBRARY_PATH=%{_builddir}/%{name}/src/interfaces/libpq $RPM_BUILD_ROOT/usr/bin/bbf_dumpall -V | ||
LD_LIBRARY_PATH=%{_builddir}/%{name}/src/interfaces/libpq $RPM_BUILD_ROOT/usr/bin/bbf_dump -V | ||
|
||
# FILES sections. | ||
%files | ||
%{_bindir}/bbf_dump | ||
%{_bindir}/bbf_dumpall | ||
|
||
%changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters