percona / postgres-packaging

7 stars 12 forks source link

Percona packages should conflict with the OS (and PGDG) packages providing the same tool #641

Open mohag opened 3 months ago

mohag commented 3 months ago

For Debian packages at least, when trying to install the PGDG versions of pgbouncer, patroni, pgbackrest and pgbadger (those were the ones that I tried to move, others might have similar issues), the install fails due to files that already exists in the Percona packages (this likely happens the other way around as well - moving from OS/PGDG packages to Percona package, I have not tested that yet though)

If the Debian packages are marked as conflicting APT would remove the packages from the other provider before attempting to install the packages.

It seems like marking the packages with Replaces and Breaks might also work. (A test env to build the packages to test in not trivial to get running)

(Background: I'm trying to install pg_cron, which is not packaged in the Percona repo and if I move the other packages to PDGD repo instead, the outbound access requirements for is slightly simpler)

(Keeping the packaged tools / extensions in sync with PGDG / Debian here might be the other option)

mohag commented 3 months ago

I have this (untested) patch for the main branch:

---
 patroni/control          | 2 ++
 pg_repack/control        | 1 +
 pgaudit/control          | 1 +
 pgaudit_set_user/control | 1 +
 pgbackrest/control       | 2 ++
 pgbadger/control         | 1 +
 pgbouncer/control        | 1 +
 postgres-common/control  | 2 ++
 postgres/control         | 7 ++++++-
 wal2json/control         | 2 ++
 10 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/patroni/control b/patroni/control
index 7f64a6a..be03f6c 100644
--- a/patroni/control
+++ b/patroni/control
@@ -39,6 +39,7 @@ Architecture: all
 Depends: ${misc:Depends}, ${python3:Depends}, lsb-base (>= 3.0-6), python3-psycopg2 , python3-etcd (>= 0.4.3) | python3-consul (>= 0.7.0) | python3-kazoo | python3-kubernetes, python-six, python-requests | python3-requests, python-yaml | python3-yaml, python3-dateutil, python3-yaml, python3-psutil, python3-prettytable, python3-click, python3-cdiff, python3-ydiff
 Suggests: percona-postgresql-12 | postgresql-12, etcd-server | consul | zookeeperd, haproxy, percona-patroni-doc
 Provides: patroni
+Conflicts: patroni
 Description: PostgreSQL High Availability with ZooKeeper, etcd, Consul, or Kubernetes
  Patroni is a template for a customized, high-availability PostgreSQL solution
  using Python and a distributed configuration store (ZooKeeper, etcd or
@@ -50,6 +51,7 @@ Section: doc
 Architecture: all
 Depends: ${misc:Depends}, ${sphinxdoc:Depends}
 Provides: patroni-doc
+Conflicts: patroni-doc
 Suggests: postgresql, etcd-server | consul | zookeeperd, haproxy
 Description: PostgreSQL High Availability (documentation)
  Patroni is a template for a customized, high-availability PostgreSQL solution
diff --git a/pg_repack/control b/pg_repack/control
index 41a5595..13abe30 100644
--- a/pg_repack/control
+++ b/pg_repack/control
@@ -12,6 +12,7 @@ Package: percona-postgresql-12-repack
 Architecture: any
 Depends: postgresql-12 (>= 12.5) | percona-postgresql-12 (>= 12.5), ${shlibs:Depends}, ${misc:Depends}
 Provides: pg-repack, postgresql-12-repack
+Conflicts: postgresql-12-repack
 Description: reorganize tables in PostgreSQL databases with minimal locks
  pg_repack is a PostgreSQL extension which lets you remove bloat from tables
  and indexes, and optionally restore the physical order of clustered indexes.
diff --git a/pgaudit/control b/pgaudit/control
index a5456c0..9f6eab8 100644
--- a/pgaudit/control
+++ b/pgaudit/control
@@ -16,6 +16,7 @@ Package: percona-postgresql-12-pgaudit
 Architecture: any
 Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-12 (>= 12.5) | percona-postgresql-12 (>= 12.5)
 Provides: pgaudit, postgresql-12-pgaudit
+Conflicts: postgresql-12-pgaudit
 Description: PostgreSQL Audit Extension
  The pgAudit extension provides detailed session and/or object audit logging
  via the standard PostgreSQL logging facility.
diff --git a/pgaudit_set_user/control b/pgaudit_set_user/control
index 1fb98fc..c8dcb30 100644
--- a/pgaudit_set_user/control
+++ b/pgaudit_set_user/control
@@ -13,6 +13,7 @@ Package: percona-pgaudit12-set-user
 Architecture: any
 Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-12 (>= 12.0) | percona-postgresql-12 (>= 12.0)
 Provides: pgaudit-set-user, postgresql-12-pgaudit-set-user
+Conflicts: postgresql-12-pgaudit-set-user
 Description: PostgreSQL Audit Set User Extension
   PostgreSQL is an advanced Object-Relational database management
   system. The PostgreSQL Audit extension (pgaudit) provides detailed
diff --git a/pgbackrest/control b/pgbackrest/control
index b305032..6837f6a 100644
--- a/pgbackrest/control
+++ b/pgbackrest/control
@@ -24,6 +24,7 @@ Package: percona-pgbackrest
 Architecture: any
 Depends: postgresql-common | percona-postgresql-common , ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
 Provides: pgbackrest
+Conflicts: pgbackrest
 Suggests: pgbackrest-doc, check-pgbackrest
 Description: Reliable PostgreSQL Backup & Restore
  pgBackRest is a simple, reliable backup and restore system for PostgreSQL
@@ -37,6 +38,7 @@ Multi-Arch: foreign
 Section: doc
 Depends: ${misc:Depends}
 Provides: pgbackrest-doc
+Conflicts: pgbackrest-doc
 Description: Documentation package for pgbackrest
  pgBackRest is a simple, reliable backup and restore system for PostgreSQL
  that can seamlessly scale up to the largest databases and workloads.
diff --git a/pgbadger/control b/pgbadger/control
index 8b5f9ff..2ff3f83 100644
--- a/pgbadger/control
+++ b/pgbadger/control
@@ -8,6 +8,7 @@ Package: percona-pgbadger
 Architecture: any
 Depends: libjson-xs-perl, libtext-csv-xs-perl, ${misc:Depends}, ${perl:Depends}
 Provides: pgbadger
+Conflicts: pgbadger
 Description: Fast PostgreSQL log analysis report
  pgBadger is a PostgreSQL log analyzer built for speed with fully detailed
  reports from your PostgreSQL log file. It's a single and small Perl script
diff --git a/pgbouncer/control b/pgbouncer/control
index 6a991a4..f2b72c7 100644
--- a/pgbouncer/control
+++ b/pgbouncer/control
@@ -27,6 +27,7 @@ Depends:
  ${misc:Depends},
  ${shlibs:Depends}
 Provides: pgbouncer, percona-pgbouncer
+Conflicts: pgbouncer
 Suggests: python3, python3-psycopg2
 Enhances: postgresql (>= 7.4)
 Description: lightweight connection pooler for PostgreSQL
diff --git a/postgres-common/control b/postgres-common/control
index 36a5c8a..b140455 100644
--- a/postgres-common/control
+++ b/postgres-common/control
@@ -72,6 +72,7 @@ Recommends:
  ${readline:Recommends},
 Replaces: percona-postgresql-client-common
 Provides: postgresql-client-common, percona-postgresql-client-common
+Conflicts: postgresql-client-common
 Description: manager for multiple PostgreSQL client versions
  The postgresql-client-common package provides a structure under which
  multiple versions of PostgreSQL client programs may be installed at
@@ -95,6 +96,7 @@ Depends:
  ${misc:Depends},
  ${server-dev-all-depends},
 Provides: postgresql-server-dev-all
+Conflicts: postgresql-server-dev-all
 Replaces: postgresql-server-dev-all, percona-postgresql-server-dev-all
 Description: extension build tool for multiple PostgreSQL versions
  The postgresql-server-dev-all package provides the pg_buildext script for
diff --git a/postgres/control b/postgres/control
index 9123acb..5d657b3 100644
--- a/postgres/control
+++ b/postgres/control
@@ -136,6 +136,7 @@ Depends:
  ${misc:Depends},
  ${shlibs:Depends}
 Provides: percona-postgresql-contrib-12, postgresql-contrib-12 (= ${binary:Version}), postgresql-12 (= ${binary:Version})
+Conflicts: postgresql-12
 Recommends: sysstat
 Description: The World's Most Advanced Open Source Relational Database
  PostgreSQL, also known as Postgres, is a free and open-source relational
@@ -161,7 +162,7 @@ Depends:
  ${shlibs:Depends}
 Suggests: percona-postgresql-12, percona-postgresql-doc-12
 Provides: percona-postgresql-client, postgresql-client (= ${binary:Version}), postgresql-client-12 (= ${binary:Version})
-Conflicts: postgresql-server-dev-12 (<< 12.1-2~)
+Conflicts: postgresql-server-dev-12 (<< 12.1-2~), postgresql-client-12
 Replaces: postgresql-server-dev-12 (<< 12.1-2~)
 Description: front-end programs for PostgreSQL 12
  This package contains client and administrative programs for
@@ -205,6 +206,7 @@ Multi-Arch: foreign
 Section: doc
 Depends: ${misc:Depends}
 Breaks: postgresql-common (<< 158~)
+Conflicts: postgresql-doc-12
 Description: documentation for the PostgreSQL database management system
  This package contains all README files, user manual, and examples for
  PostgreSQL 12. The manual is in HTML format.
@@ -221,6 +223,7 @@ Depends:
 Breaks: percona-postgresql-12 (<< 12~beta4)
 Replaces: percona-postgresql-12 (<< 12~beta4)
 Provides: percona-postgresql-plperl, postgresql-plperl, postgresql-plperl-12
+Conflicts: postgresql-plperl-12
 Description: PL/Perl procedural language for PostgreSQL 12
  PL/Perl enables an SQL developer to write procedural language functions
  for PostgreSQL 12 in Perl.  You need this package if you have any
@@ -237,6 +240,7 @@ Depends:
 Breaks: percona-postgresql-12 (<< 12~beta4)
 Replaces: percona-postgresql-12 (<< 12~beta4)
 Provides: postgresql-plpython3,postgresql-plpython3-12, percona-postgresql-plpython3
+Conflicts: postgresql-plpython3-12
 Description: PL/Python 3 procedural language for PostgreSQL 12
  PL/Python 3 enables an SQL developer to write procedural language functions
  for PostgreSQL 12 in Python 3.  You need this package if you have any
@@ -251,6 +255,7 @@ Depends:
  ${misc:Depends},
  ${shlibs:Depends}
 Provides: percona-postgresql-pltcl, postgresql-pltcl, postgresql-12-pltcl
+Conflicts: postgresql-12-pltcl
 Description: PL/Tcl procedural language for PostgreSQL 12
  PL/Tcl enables an SQL developer to write procedural language functions
  for PostgreSQL 12 in Tcl.  You need this package if you have any
diff --git a/wal2json/control b/wal2json/control
index ef853e7..e5d26ed 100644
--- a/wal2json/control
+++ b/wal2json/control
@@ -9,6 +9,8 @@ Rules-Requires-Root: no
 Package: percona-postgresql-12-wal2json
 Architecture: any
 Depends: percona-postgresql-12 | postgresql-12, ${misc:Depends}, ${shlibs:Depends}
+Provides: postgresql-12-wal2json
+Conflicts: postgresql-12-wal2json
 Description: PostgreSQL logical decoding JSON output plugin
  wal2json is an output plugin for PostgreSQL's logical decoding. The plugin has
  access to tuples produced by INSERT and UPDATE. Also, UPDATE/DELETE old row

I'm not completely sure which branches would need similar changes... (I can open some PRs if it would be useful changes) (Testing of packaging changes needs a bit of time to get a build env set up...)

maqeel75 commented 3 months ago

Thanks @mohag for your inputs and the patch. I will test the changes in our test environment and then update you.