Skip to content

Commit

Permalink
Update remaining core extensions to Postgres 17 (#838)
Browse files Browse the repository at this point in the history
Some have new versions, either from their control files or from Postgres
itself, so adjust accordingly. Simplify the build scripting to shallowly
clone the Postgres repo at the release tag, skip configuring Postgres,
and use `make USE_PGXS=1` to install to the proper locations for the
system Postgres, rather than the `/usr/local` default from configuring
Postgres, eliminating the need for `mv`s in the install command.

The exception to the above is the procedural languages, which do not
support `USE_PGXS=1`. In those cases, configure postgres but specify
the same SHAREDIR and PKGLIBDIR as the system Postgres.

This technique does require overwriting the `Makefile` for each of the
SPI extensions, but it's quite simple, a short `printf` statement for
each.
  • Loading branch information
theory committed Dec 12, 2024
1 parent 83fa760 commit 8d2a1e7
Show file tree
Hide file tree
Showing 87 changed files with 423 additions and 879 deletions.
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pg-trunk"
version = "0.15.3"
version = "0.15.4"
edition = "2021"
authors = ["Ian Stanton", "Vinícius Miguel"]
description = "A package manager for PostgreSQL extensions"
Expand Down
20 changes: 7 additions & 13 deletions contrib/amcheck/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}
USER root

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
Expand All @@ -15,14 +15,8 @@ RUN apt-get update && apt-get install -y \
xsltproc \
ccache

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

ARG PG_RELEASE=REL_15_3

RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib/amcheck && \
make
# Clone repository and build extension.
ARG EXTENSION_NAME
ARG PG_RELEASE
RUN git clone --depth 1 --branch "${PG_RELEASE}" https://github.com/postgres/postgres.git \
&& make -C postgres/contrib/${EXTENSION_NAME} USE_PGXS=1
11 changes: 3 additions & 8 deletions contrib/amcheck/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[extension]
name = "amcheck"
version = "1.3.0"
version = "1.4.0"
repository = "https://github.com/postgres/postgres/tree/master/contrib/amcheck"
license = "PostgreSQL"
description = "The amcheck module provides functions that allow you to verify the logical consistency of the structure of relations."
Expand All @@ -12,12 +12,7 @@ categories = ["index_table_optimizations"]
apt = ["libc6"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/amcheck && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""
install_command = "make -C postgres/contrib/amcheck install USE_PGXS=1"
23 changes: 9 additions & 14 deletions contrib/auth_delay/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}
USER root

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
Expand All @@ -13,16 +13,11 @@ RUN apt-get update && apt-get install -y \
libssl-dev \
libxml2-utils \
xsltproc \
ccache

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

ARG PG_RELEASE=REL_15_3
ccache \
libkrb5-dev

RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib/auth_delay && \
make
# Clone repository and build extension.
ARG EXTENSION_NAME
ARG PG_RELEASE
RUN git clone --depth 1 --branch "${PG_RELEASE}" https://github.com/postgres/postgres.git \
&& make -C postgres/contrib/${EXTENSION_NAME} USE_PGXS=1
12 changes: 3 additions & 9 deletions contrib/auth_delay/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[extension]
name = "auth_delay"
version = "15.3.0"
version = "17.2.0"
repository = "https://github.com/postgres/postgres/tree/master/contrib/auth_delay"
license = "PostgreSQL"
description = "auth_delay causes the server to pause briefly before reporting authentication failure, to make brute-force attacks on database passwords more difficult."
Expand All @@ -10,13 +10,7 @@ categories = ["security"]
loadable_libraries = [{ library_name = "auth_delay", requires_restart = true }]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/auth_delay && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""

install_command = "make -C postgres/contrib/auth_delay install USE_PGXS=1"
23 changes: 9 additions & 14 deletions contrib/autoinc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PG_VERSION=17
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}
USER root

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
Expand All @@ -15,15 +15,10 @@ RUN apt-get update && apt-get install -y \
xsltproc \
ccache

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

ARG PG_RELEASE=REL_17_2

RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib/spi && \
make

# Clone repository and build extension.
ARG EXTENSION_NAME
ARG PG_RELEASE
RUN git clone --depth 1 --branch "${PG_RELEASE}" https://github.com/postgres/postgres.git \
&& printf "MODULES = autoinc\nEXTENSION = autoinc\nDATA = \$(wildcard autoinc--*.sql)\nPG_CONFIG ?= pg_config\nPGXS := \$(shell \$(PG_CONFIG) --pgxs)\ninclude \$(PGXS)\n" > postgres/contrib/spi/Makefile \
&& cat postgres/contrib/spi/Makefile \
&& make -C postgres/contrib/spi USE_PGXS=1
8 changes: 1 addition & 7 deletions contrib/autoinc/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@ apt = ["libc6"]
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/spi && make install
set -x
mv /usr/local/pgsql/share/extension/autoinc* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/autoinc* /usr/lib/postgresql/15/lib
"""

install_command = "make -C postgres/contrib/spi install USE_PGXS=1"
21 changes: 8 additions & 13 deletions contrib/basebackup_to_shell/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}
USER root

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
Expand All @@ -15,14 +15,9 @@ RUN apt-get update && apt-get install -y \
xsltproc \
ccache

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

ARG PG_RELEASE=REL_15_3

RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib/basebackup_to_shell && \
make
# Clone repository and build extension.
ARG EXTENSION_NAME
ARG PG_RELEASE
RUN git clone --depth 1 --branch "${PG_RELEASE}" https://github.com/postgres/postgres.git \
&& (cd postgres && ./configure --datarootdir "$(pg_config --sharedir)" --libdir "$(pg_config --pkglibdir)") \
&& make -C postgres/contrib/${EXTENSION_NAME}
12 changes: 3 additions & 9 deletions contrib/basebackup_to_shell/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[extension]
name = "basebackup_to_shell"
version = "15.3.0"
version = "17.2.0"
repository = "https://github.com/postgres/postgres/tree/master/contrib/basebackup_to_shell"
license = "PostgreSQL"
description = "basebackup_to_shell adds a custom basebackup target called shell."
Expand All @@ -13,13 +13,7 @@ loadable_libraries = [{ library_name = "basebackup_to_shell", requires_restart =
apt = ["libc6"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/basebackup_to_shell && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""

install_command = "make -C postgres/contrib/basebackup_to_shell install"
20 changes: 7 additions & 13 deletions contrib/basic_archive/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PG_VERSION=15
ARG PG_VERSION=17
FROM quay.io/coredb/c-builder:pg${PG_VERSION}
USER root

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
Expand All @@ -15,14 +15,8 @@ RUN apt-get update && apt-get install -y \
xsltproc \
ccache

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

ARG PG_RELEASE=REL_15_3

RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib/basic_archive && \
make
# Clone repository and build extension.
ARG EXTENSION_NAME
ARG PG_RELEASE
RUN git clone --depth 1 --branch "${PG_RELEASE}" https://github.com/postgres/postgres.git \
&& make -C postgres/contrib/${EXTENSION_NAME} USE_PGXS=1
12 changes: 3 additions & 9 deletions contrib/basic_archive/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[extension]
name = "basic_archive"
version = "15.3.0"
version = "17.2.0"
repository = "https://github.com/postgres/postgres/tree/master/contrib/basic_archive"
license = "PostgreSQL"
description = "This module copies completed WAL segment files to the specified directory."
Expand All @@ -13,13 +13,7 @@ loadable_libraries = [{ library_name = "basic_archive", requires_restart = true
apt = ["libc6"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/basic_archive && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""

install_command = "make -C postgres/contrib/basic_archive install USE_PGXS=1"
22 changes: 9 additions & 13 deletions contrib/insert_username/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}
USER root

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
Expand All @@ -15,14 +15,10 @@ RUN apt-get update && apt-get install -y \
xsltproc \
ccache

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

ARG PG_RELEASE=REL_15_3

RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib/spi && \
make
# Clone repository and build extension.
ARG EXTENSION_NAME
ARG PG_RELEASE
RUN git clone --depth 1 --branch "${PG_RELEASE}" https://github.com/postgres/postgres.git \
&& printf "MODULES = insert_username\nEXTENSION = insert_username\nDATA = \$(wildcard insert_username--*.sql)\nPG_CONFIG ?= pg_config\nPGXS := \$(shell \$(PG_CONFIG) --pgxs)\ninclude \$(PGXS)\n" > postgres/contrib/spi/Makefile \
&& cat postgres/contrib/spi/Makefile \
&& make -C postgres/contrib/spi USE_PGXS=1
9 changes: 2 additions & 7 deletions contrib/insert_username/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ categories = ["auditing_logging"]
apt = ["libc6"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/spi && make install
set -x
mv /usr/local/pgsql/share/extension/insert_username* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/insert_username* /usr/lib/postgresql/15/lib
"""
install_command = "make -C postgres/contrib/spi install USE_PGXS=1"
20 changes: 7 additions & 13 deletions contrib/intagg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}
USER root

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
Expand All @@ -15,14 +15,8 @@ RUN apt-get update && apt-get install -y \
xsltproc \
ccache

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

ARG PG_RELEASE=REL_15_3

RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib/intagg && \
make
# Clone repository and build extension.
ARG EXTENSION_NAME
ARG PG_RELEASE
RUN git clone --depth 1 --branch "${PG_RELEASE}" https://github.com/postgres/postgres.git \
&& make -C postgres/contrib/${EXTENSION_NAME} USE_PGXS=1
9 changes: 2 additions & 7 deletions contrib/intagg/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ documentation = "https://www.postgresql.org/docs/current/intagg.html"
categories = ["data_transformations"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/intagg && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""
install_command = "make -C postgres/contrib/intagg install USE_PGXS=1"
Loading

0 comments on commit 8d2a1e7

Please sign in to comment.