Skip to content

Commit

Permalink
PKG-31 PG packages with Percona Telemetry Ph1 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhat1595 authored Sep 9, 2024
1 parent e6a88a0 commit 089a33b
Show file tree
Hide file tree
Showing 13 changed files with 759 additions and 0 deletions.
5 changes: 5 additions & 0 deletions percona-packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
percona-pg-telemetry (1.0.0-1) unstable; urgency=medium

* Initial build.

-- Surabhi Bhat <[email protected]> Fri, 26 Apr 2024 19:20:11 +0100
1 change: 1 addition & 0 deletions percona-packaging/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
15 changes: 15 additions & 0 deletions percona-packaging/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: percona-pg-telemetry
Section: database
Priority: optional
Maintainer: Percona Development Team <[email protected]>
Build-Depends:
debhelper (>= 9),
postgresql-server-dev-all (>= 153~) | percona-postgresql-server-dev-all (>= 153~),

Package: percona-pg-telemetryPGVERSION
Architecture: any
Depends:
percona-telemetry-agent,
${misc:Depends},
${shlibs:Depends},
Description:The percona_pg_telemetry is an extension for Percona telemetry data collection for PostgreSQL.
15 changes: 15 additions & 0 deletions percona-packaging/debian/control.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: percona-pg-telemetry
Section: database
Priority: optional
Maintainer: Percona Development Team <[email protected]>
Build-Depends:
debhelper (>= 9),
postgresql-server-dev-all (>= 153~) | percona-postgresql-server-dev-all (>= 153~),

Package: percona-pg-telemetryPGVERSION
Architecture: any
Depends:
percona-telemetry-agent,
${misc:Depends},
${shlibs:Depends},
Description:The percona_pg_telemetry is an extension for Percona telemetry data collection for PostgreSQL.
1 change: 1 addition & 0 deletions percona-packaging/debian/pgversions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9.3+
12 changes: 12 additions & 0 deletions percona-packaging/debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

#DEBHELPER#
usermod -a -G percona-telemetry postgres

mkdir /usr/local/percona/telemetry/pg
chown postgres:percona-telemetry /usr/local/percona/telemetry/pg
chmod 775 /usr/local/percona/telemetry/pg
chmod g+s /usr/local/percona/telemetry/pg
chmod u+s /usr/local/percona/telemetry/pg
exit 0

48 changes: 48 additions & 0 deletions percona-packaging/debian/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ];
then
. /usr/share/debconf/confmodule
fi

case "$1" in
remove | purge)
set -e
PG_TELEMETRY=/usr/local/percona/telemetry/pg
if [ -d ${PG_TELEMETRY} ];
then
rm -rf ${PG_TELEMETRY}
fi

set +e

;;

upgrade | failed-upgrade | abort-install | abort-upgrade | disappear)

;;

*)
echo "postrm called with unknown argument '$1'" 1>&2
exit 1
;;
esac

#DEBHELPER#

exit 0
11 changes: 11 additions & 0 deletions percona-packaging/debian/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# preinst script for percona-pg-telemetry
#
# see: dh_installdeb(1)

# create a postgres group and user
if ! getent passwd postgres > /dev/null 2>&1; then
groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
/usr/sbin/useradd -M -g postgres -s /bin/bash \
-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
fi
31 changes: 31 additions & 0 deletions percona-packaging/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Using pg_buildext
include /usr/share/postgresql-common/pgxs_debian_control.mk

export USE_PGXS=1

%:
dh $@

override_dh_builddeb:
dh_builddeb -- -Zgzip

override_dh_auto_build:
+pg_buildext clean . build-%v
+pg_buildext build . build-%v

override_dh_auto_test:
# nothing to do here

override_dh_auto_install:
+pg_buildext install . build-%v percona-pg-telemetry@@PG_REL@@

override_dh_installdocs:
dh_installdocs --all README.*

override_dh_auto_clean:
rm -rf results/* regression.*
1 change: 1 addition & 0 deletions percona-packaging/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
3 changes: 3 additions & 0 deletions percona-packaging/debian/source/lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# don't bug people uploading from @work
source: changelog-should-mention-nmu
source: source-nmu-has-incorrect-version-number
72 changes: 72 additions & 0 deletions percona-packaging/rpm/pg-percona-telemetry.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
%global sname percona-pg-telemetry
%global pgrel @@PG_REL@@
%global rpm_release @@RPM_RELEASE@@
%global pginstdir /usr/pgsql-@@PG_REL@@/

Summary: Statistics collector for PostgreSQL
Name: %{sname}%{pgrel}
Version: @@VERSION@@
Release: %{rpm_release}%{?dist}
License: PostgreSQL
Source0: percona-pg-telemetry%{pgrel}-%{version}.tar.gz
URL: https://github.com/Percona-Lab/percona_pg_telemetry
BuildRequires: percona-postgresql%{pgrel}-devel
Requires: percona-telemetry-agent
Provides: percona-pg-telemetry%{pgrel}
Conflicts: percona-pg-telemetry%{pgrel}
Obsoletes: percona-pg-telemetry%{pgrel} <= %{version}-%{release}
Epoch: 1
Packager: Percona Development Team <https://jira.percona.com>
Vendor: Percona, Inc

%description
The percona_pg_telemetry is an extension for Percona telemetry data collection for PostgreSQL.

%prep
%setup -q -n percona-pg-telemetry%{pgrel}-%{version}


%build
sed -i 's:PG_CONFIG = pg_config:PG_CONFIG = /usr/pgsql-%{pgrel}/bin/pg_config:' Makefile
%{__make} USE_PGXS=1 %{?_smp_mflags}


%install
%{__rm} -rf %{buildroot}
%{__make} USE_PGXS=1 %{?_smp_mflags} install DESTDIR=%{buildroot}
%{__install} -d %{buildroot}%{pginstdir}/share/extension
%{__install} -m 755 README.md %{buildroot}%{pginstdir}/share/extension/README-percona_pg_telemetry


%clean
%{__rm} -rf %{buildroot}

%pre -n percona-pg-telemetry%{pgrel}
if [ $1 == 1 ]; then
if ! getent passwd postgres > /dev/null 2>&1; then
groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
/usr/sbin/useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
fi
fi

%post -n percona-pg-telemetry%{pgrel}
usermod -a -G percona-telemetry postgres
install -d -m 2775 -o postgres -g percona-telemetry /usr/local/percona/telemetry/pg

%postun -n percona-pg-telemetry%{pgrel}
rm -rf /usr/local/percona/telemetry/pg

%files
%defattr(755,root,root,755)
%doc %{pginstdir}/share/extension/README-percona_pg_telemetry
%{pginstdir}/lib/percona_pg_telemetry.so
%{pginstdir}/share/extension/percona_pg_telemetry--*.sql
%{pginstdir}/share/extension/percona_pg_telemetry.control
%{pginstdir}/lib/bitcode/percona_pg_telemetry*.bc
%{pginstdir}/lib/bitcode/percona_pg_telemetry/*.bc


%changelog
* Fri Apr 26 2024 Surabhi Bhat <[email protected]> - 1.0.0-1
- Initial build
Loading

0 comments on commit 089a33b

Please sign in to comment.