Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
921 changes: 921 additions & 0 deletions .github/workflows/release.yml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions common/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Bridge wrapper: pgedge-builder-action hardcodes
# `cd /build && bash ./common/build.sh $COMPONENT_NAME`. Our packaging lives
# under pkg/, so delegate to the real entrypoint there. The shared
# pgedge-builder-action must not be modified — this wrapper adapts to it.
exec "$(dirname "$0")/../pkg/scripts/build.sh" "$@"
64 changes: 64 additions & 0 deletions pkg/build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
set -euo pipefail

# Environment variables
BUILD_DIR="/tmp/pg_deb_build"
SRC_DIR="${BUILD_DIR}/src"

export DEBIAN_FRONTEND=noninteractive

prepare() {

setup_apt_build_env

# This function is for debugging purpose if you have your own keys. GH workflow does not need it.
#import_gpg_keys

rm -rf "$SRC_DIR"
mkdir -p "$SRC_DIR"

stage_source "${BUILD_DIR}/${SRC_TARBALL}"
tar -C "$BUILD_DIR" -xzf "${BUILD_DIR}/${SRC_TARBALL}"

echo "Moving Debian packaging into source directory..."
cp -rp "${COMPONENT_DIR}/deb/debian" "$BUILD_DIR/lolor-${LOLOR_VERSION}/"
cp $BUILD_DIR/lolor-${LOLOR_VERSION}/debian/control.in $BUILD_DIR/lolor-${LOLOR_VERSION}/debian/control
sed -i "s|PG_MAJOR_VERSION|${PG_MAJOR_VERSION}|g" $BUILD_DIR/lolor-${LOLOR_VERSION}/debian/control
mv $BUILD_DIR/lolor-${LOLOR_VERSION}/debian/pgedge-postgresql-lolor.install $BUILD_DIR/lolor-${LOLOR_VERSION}/debian/pgedge-postgresql-${PG_MAJOR_VERSION}-lolor.install
sed -i "s|PG_MAJOR_VERSION|${PG_MAJOR_VERSION}|g" $BUILD_DIR/lolor-${LOLOR_VERSION}/debian/pgedge-postgresql-${PG_MAJOR_VERSION}-lolor.install

echo "Installing build dependencies..."
cd "$BUILD_DIR/lolor-${LOLOR_VERSION}"
sudo apt-get update
sudo apt-get build-dep -y .
}

build() {

cd "$BUILD_DIR/lolor-${LOLOR_VERSION}"
echo "Building Debian package..."
DISTRO=$(lsb_release -cs)
# LOLOR_DEB_VERSION carries the '~<pretag>' form for pre-releases so they
# sort below stable; it equals LOLOR_VERSION for a GA build.
# A Debian changelog entry needs a blank line after the header and before the
# maintainer trailer. Written in final form, so no dch pass is needed — dch
# with this same version appended a duplicate entry instead of editing.
rm -rf debian/changelog
{
echo "pgedge-lolor (${LOLOR_DEB_VERSION}-${LOLOR_BUILDNUM}.${DISTRO}) ${DISTRO}; urgency=low"
echo ""
echo " * Update Release."
echo ""
echo " -- pgEdge Build Team <support@pgedge.com> $(date -R)"
} > debian/changelog

DEB_BUILD_OPTIONS=nocheck PATH=/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH USE_PGXS=1 dpkg-buildpackage -us -uc -b
}

post_build() {
echo "Copying .deb packages to output..."
sudo mkdir -p "/output"
# Rename .ddeb files to .deb files
rename_ddeb_packages $BUILD_DIR
sudo cp "$BUILD_DIR"/*.deb "/output" || echo "No .deb packages found."
}
42 changes: 42 additions & 0 deletions pkg/build-rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -euo pipefail

RHEL="$(rpm --eval %rhel)"

prepare() {
setup_dnf_build_env
echo "Copying packaging files..."
cp "${COMPONENT_DIR}/rpm/lolor.spec" ~/rpmbuild/SPECS/

# The spec's Source0 basename is v<version>.tar.gz (a GitHub tag archive),
# while %setup expects the lolor-<version>/ directory inside it — which is
# what release.yml's `git archive --prefix` produces.
stage_source ~/rpmbuild/SOURCES/v${LOLOR_VERSION}.tar.gz

# This function is for debugging purpose if you have your own keys. GH workflow sets it
#import_gpg_keys

echo "🔧 Installing RPM build dependencies..."
dnf builddep -y \
--define "lolor_version ${LOLOR_VERSION}" \
--define "lolor_buildnum ${LOLOR_BUILDNUM}" \
--define "pgmajorversion ${PG_MAJOR_VERSION}" \
~/rpmbuild/SPECS/lolor.spec
}

build() {
QA_RPATHS=$(( 0xffff )) rpmbuild -ba ~/rpmbuild/SPECS/lolor.spec \
--define "lolor_version ${LOLOR_VERSION}" \
--define "lolor_buildnum ${LOLOR_BUILDNUM}" \
--define "pgmajorversion ${PG_MAJOR_VERSION}"
}

post_build() {
echo "📤 Copying built RPMs to /output..."
mkdir -p /output
cp -v ~/rpmbuild/RPMS/*/*.rpm /output/ || echo "No binary RPMs found"
cp -v ~/rpmbuild/SRPMS/*.src.rpm /output/ || echo "No SRPM found"

sign_rpms /output/*.rpm
validate_signatures /output/*.rpm
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
64 changes: 64 additions & 0 deletions pkg/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
# common.sh - packaging environment for Lolor.
#
# Lolor is a PostgreSQL extension: one build per PG major.
# pgedge-detect-build-matrix reads this to fan the matrix out over pg_versions.
PER_PG_VERSION=true

export PG_VERSION="${PG_VERSION:-17}"
export PG_MAJOR_VERSION="$(echo "$PG_VERSION" | cut -d. -f1)"

export PG_LOLOR_REPO="https://github.com/pgEdge/lolor.git"
export LOLOR_BRANCH="${COMPONENT_BRANCH:-v1.3.0}"

# Upstream version, suffix-stripped (e.g. 1.3.0). Names the source tarball's
# internal directory and the RPM Version.
export LOLOR_VERSION="${COMPONENT_VERSION:-1.3.0}"
export LOLOR_BUILDNUM=${COMPONENT_BUILDNUM:-1}

export REPO_TYPE="${REPO_TYPE:-daily}"

# DEB only: move a pre-release pretag (COMPONENT_BUILDNUM='rc1_1') into the
# upstream version with a leading '~' so pre-releases sort BELOW stable in
# dpkg/reprepro: 1.3.0~rc1-1.noble < 1.3.0-1.noble.
#
# The '~' form goes in a SEPARATE variable used only by the debian/changelog:
# LOLOR_VERSION itself must stay clean because it names the source tarball
# and its unpack directory (a '~' there would break %setup and the DEB extract).
export LOLOR_DEB_VERSION="${LOLOR_VERSION}"
if command -v apt-get &>/dev/null; then
if [[ "$LOLOR_BUILDNUM" == *_* ]]; then
LOLOR_PRETAG="${LOLOR_BUILDNUM%%_*}"
export LOLOR_DEB_VERSION="${LOLOR_VERSION}~${LOLOR_PRETAG}"
LOLOR_BUILDNUM="${LOLOR_BUILDNUM##*_}"
fi
fi

# release.yml stages the source tarball built from THIS run's checkout here.
export ARTIFACT_DIR="${ARTIFACT_DIR:-$(pwd)/release-artifacts}"
export SRC_TARBALL="lolor-${LOLOR_VERSION}.tar.gz"

# Prefer the workflow-staged tarball (so branch / simulate_tag runs build the
# exact commit under test and need no network). The LOLOR_BRANCH clone is an
# opt-in fallback for local builds: set LOLOR_ALLOW_CLONE_FALLBACK=1.
stage_source() {
local dest="$1"
if [ -f "${ARTIFACT_DIR}/${SRC_TARBALL}" ]; then
echo "Staging ${SRC_TARBALL} from ${ARTIFACT_DIR}"
cp "${ARTIFACT_DIR}/${SRC_TARBALL}" "${dest}"
elif [ -z "${LOLOR_ALLOW_CLONE_FALLBACK:-}" ]; then
# A staged tarball is required by default: cloning LOLOR_BRANCH instead
# would ship a package built from a different commit than COMPONENT_VERSION
# claims.
echo "::error::${ARTIFACT_DIR}/${SRC_TARBALL} not found. release.yml stages it with git archive; for a local build, stage it yourself or set LOLOR_ALLOW_CLONE_FALLBACK=1 to clone ${LOLOR_BRANCH} instead." >&2
return 1
else
echo "Fetching Lolor source code (${LOLOR_BRANCH})"
rm -rf "lolor-${LOLOR_VERSION}"
git clone --depth=1 --branch "$LOLOR_BRANCH" "$PG_LOLOR_REPO" "lolor-${LOLOR_VERSION}"
rm -rf "lolor-${LOLOR_VERSION}/.git"
tar -czf "${SRC_TARBALL}" "lolor-${LOLOR_VERSION}"
rm -rf "lolor-${LOLOR_VERSION}"
mv "${SRC_TARBALL}" "${dest}"
fi
}
29 changes: 29 additions & 0 deletions pkg/deb/debian/control.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Source: pgedge-lolor
Section: database
Priority: optional
Maintainer: pgEdge Build Team <support@pgedge.com>
Build-Depends:
debhelper-compat (= 13),
pgedge-postgresql-all <!nocheck>,
pgedge-postgresql-server-dev-PG_MAJOR_VERSION,
pgedge-postgresql-server-dev-all,
Standards-Version: 4.7.0
Rules-Requires-Root: no
Homepage: https://github.com/pgEdge/lolor

Package: pgedge-postgresql-PG_MAJOR_VERSION-lolor
Architecture: any
Depends:
${misc:Depends},
pgedge-postgresql-PG_MAJOR_VERSION,
${shlibs:Depends},
Conflicts:
postgresql-PG_MAJOR_VERSION-lolor,
Provides:
postgresql-PG_MAJOR_VERSION-lolor,
Replaces:
postgresql-PG_MAJOR_VERSION-lolor,
Breaks:
postgresql-PG_MAJOR_VERSION-lolor,
Description: lolor is a plugin in replacement for Postgres' Large Objects that
makes them compatible with Logical Replication.
1 change: 1 addition & 0 deletions pkg/deb/debian/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LICENSE.md
1 change: 1 addition & 0 deletions pkg/deb/debian/pgedge-postgresql-lolor.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debian/tmp/sbom/* usr/lib/postgresql/PG_MAJOR_VERSION/sbom/
19 changes: 19 additions & 0 deletions pkg/deb/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/make -f

%:
dh $@

override_dh_builddeb:
dh_builddeb -- -Zgzip

execute_before_dh_install:
# --- SBOM generation and signing ---
mkdir -p debian/tmp/sbom
syft dir:$(CURDIR) -o cyclonedx-json > debian/tmp/sbom/lolor-sbom.json || exit 1
KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/{print $5}' | head -n 1); export KEY_ID
gpg --armor --detach-sign \
--output debian/tmp/sbom/lolor-sbom.json.asc \
debian/tmp/sbom/lolor-sbom.json || exit 1

override_dh_installdocs:
dh_installdocs --all README.*
1 change: 1 addition & 0 deletions pkg/deb/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
5 changes: 5 additions & 0 deletions pkg/deb/debian/tests/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Depends:
make,
@,
Tests: installcheck
Restrictions: allow-stderr
3 changes: 3 additions & 0 deletions pkg/deb/debian/tests/installcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

pg_buildext installcheck
2 changes: 2 additions & 0 deletions pkg/deb/debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version=4
https://github.com/pgEdge/lolor/tags .*/v(.*).tar.gz
79 changes: 79 additions & 0 deletions pkg/rpm/lolor.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
%global pname lolor
%global sname pgedge-lolor
%global pginstdir /usr/pgsql-%{pgmajorversion}

%{!?llvm:%global llvm 1}

Name: %{sname}_%{pgmajorversion}
Version: %{lolor_version}
Release: %{lolor_buildnum}%{?dist}
Summary: Large Object LOgical Replication
License: PostgreSQL License
URL: https://github.com/pgEdge/%{pname}/
Source0: https://github.com/pgEdge/%{pname}/archive/refs/tags/v%{version}.tar.gz

BuildRequires: pgedge-postgresql%{pgmajorversion}-devel
Requires: pgedge-postgresql%{pgmajorversion}-server
Provides: %{pname}_%{pgmajorversion}

%description
lolor is a plugin in replacement for Postgres' Large Objects that makes them
compatible with Logical Replication.

%if %llvm
%package llvmjit
Summary: Just-in-time compilation support for lolor
Requires: %{name}%{?_isa} = %{version}-%{release}
%if 0%{?suse_version} >= 1500
BuildRequires: llvm17-devel clang17-devel
Requires: llvm17
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: llvm-devel >= 13.0 clang-devel >= 13.0
Requires: llvm => 13.0
Provides: %{pname}_%{pgmajorversion}-llvmjit
%endif

%description llvmjit
This packages provides JIT support for lolor
%endif

%prep
%setup -q -n %{pname}-%{version}

%build
USE_PGXS=1 PATH=%{pginstdir}/bin:$PATH %{__make} #%{?_smp_mflags}
syft dir:%{_builddir}/%{pname}-%{version} -o cyclonedx-json > %{_builddir}/%{pname}-%{version}/%{pname}-sbom.json || exit 1

KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/{print $5}' | head -n 1); export KEY_ID
gpg --armor --detach-sign --output %{_builddir}/%{pname}-%{version}/%{pname}-sbom.json.asc %{_builddir}/%{pname}-%{version}/%{pname}-sbom.json || exit 1
Comment thread
coderabbitai[bot] marked this conversation as resolved.

%install
%{__rm} -rf %{buildroot}
USE_PGXS=1 PATH=%{pginstdir}/bin:$PATH %{__make} %{?_smp_mflags} install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/%{pginstdir}/sbom
install -p -m 0644 %{_builddir}/%{pname}-%{version}/%{pname}-sbom.json %{buildroot}/%{pginstdir}/sbom/%{pname}-sbom.json
install -p -m 0644 %{_builddir}/%{pname}-%{version}/%{pname}-sbom.json.asc %{buildroot}/%{pginstdir}/sbom/%{pname}-sbom.json.asc

%files
%doc README.md
%license LICENSE.md
%{pginstdir}/lib/%{pname}.so
%{pginstdir}/share/extension/%{pname}.control
%{pginstdir}/share/extension/%{pname}*sql
%{pginstdir}/sbom/%{pname}-sbom.json
%{pginstdir}/sbom/%{pname}-sbom.json.asc

%if %llvm
%files llvmjit
%{pginstdir}/lib/bitcode/%{pname}*.bc
%{pginstdir}/lib/bitcode/%{pname}/src/*.bc
%endif

%changelog
* Thu Dec 18 2025 Muhammad Aqeel <muhammad.aqeel@pgedge.com> - 1.2.2
- Update lolor package to 1.2.2
* Thu Sep 25 2025 Muhammad Aqeel <muhammad.aqeel@pgedge.com> - 1.2.1
- Update lolor package to 1.2.1
* Mon Jul 21 2025 Muhammad Aqeel <muhammad.aqeel@pgedge.com> - 1.2
- Initial lolor package.
31 changes: 31 additions & 0 deletions pkg/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail

COMPONENT_NAME=$1

# Resolve absolute, canonical paths. The common/build.sh bridge wrapper
# exec's this script with a relative $0 (./common/../pkg/scripts/build.sh),
# so `$(dirname "$0")/../${COMPONENT_NAME}/` would yield non-canonical paths
# that resolve wrong. cd+pwd gives stable absolute paths regardless of caller.
# Exported so common-functions.sh (sourced below) reuses them.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
COMPONENT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
export SCRIPT_DIR COMPONENT_DIR

source "${COMPONENT_DIR}/common.sh"

COMMON_FILE="${SCRIPT_DIR}/common-functions.sh"
if [ -f "$COMMON_FILE" ]; then
source "$COMMON_FILE"
else
echo "Error: $COMMON_FILE not found!" >&2
exit 1
fi

###########
# Main
###########
detect_os_type
prepare
build
post_build
Loading
Loading