From 643646c64af7a56d415b2177f7b4da74ce9ea2a8 Mon Sep 17 00:00:00 2001 From: Vladislav Pavlov Date: Fri, 29 May 2026 13:00:06 +0300 Subject: [PATCH 1/7] CI-5748 Add .deb package --- .github/workflows/build_deb.yml | 16 +++++++++++++ Makefile | 3 +++ debian/changelog | 5 ++++ debian/compat | 1 + debian/control | 14 +++++++++++ debian/gpbackup.install.in | 3 +++ debian/rules | 42 +++++++++++++++++++++++++++++++++ 7 files changed, 84 insertions(+) create mode 100644 .github/workflows/build_deb.yml create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/gpbackup.install.in create mode 100755 debian/rules diff --git a/.github/workflows/build_deb.yml b/.github/workflows/build_deb.yml new file mode 100644 index 00000000..d253dfa8 --- /dev/null +++ b/.github/workflows/build_deb.yml @@ -0,0 +1,16 @@ +name: build_deb + +on: + push: + branches: + - '*' + workflow_dispatch: + +jobs: + build_deb: + uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@CI-5748 + with: + go_version: "1.20" + artifact_name: gpbackup-deb + test_docker: ubuntu:24.04 + add_greengage_repo: true diff --git a/Makefile b/Makefile index 1fd0d0c8..dd07ed36 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,9 @@ install : fi; \ rm /tmp/seg_hosts +deb : + dpkg-buildpackage -us -uc -b + clean : # Build artifacts rm -f $(BIN_DIR)/$(BACKUP) $(BACKUP) $(BIN_DIR)/$(RESTORE) $(RESTORE) $(BIN_DIR)/$(HELPER) $(HELPER) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..0364f8dc --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +gpbackup (1.30.7-1) unstable; urgency=medium + + * Initial Debian package + + -- Greengage Fri, 29 May 2026 00:00:00 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..b1bd38b6 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +13 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..956b1601 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: gpbackup +Maintainer: Greengage +Section: database +Build-Depends: debhelper (>= 13), + build-essential +Standards-Version: 4.6.0 + +Package: gpbackup +Architecture: any +Depends: ${shlibs:Depends}, + greengage6 | greengage7 +Description: Greengage Backup and Restore utilities + gpbackup and gprestore are Go utilities for performing Greengage Database + backups and restores. gpbackup_helper is used with the --single-data-file flag. diff --git a/debian/gpbackup.install.in b/debian/gpbackup.install.in new file mode 100644 index 00000000..a3e5b72b --- /dev/null +++ b/debian/gpbackup.install.in @@ -0,0 +1,3 @@ +@GPBACKUP_HOME_REL@/bin/gpbackup +@GPBACKUP_HOME_REL@/bin/gprestore +@GPBACKUP_HOME_REL@/bin/gpbackup_helper diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..45a6253f --- /dev/null +++ b/debian/rules @@ -0,0 +1,42 @@ +#!/usr/bin/make -f + +DH_VERBOSE = 1 + +GPBACKUP_HOME ?= /opt/greengagedb/gpbackup +GPBACKUP_HOME_REL := $(GPBACKUP_HOME:/%=%) + +export DH_OPTIONS := $(DH_OPTIONS) +export DEB_BUILD_OPTIONS = nocheck +export PATH := /usr/local/go/bin:$(PATH) +export CGO_ENABLED = 1 +export GOPATH ?= $(HOME)/go + +BUILD_DIR := $(CURDIR)/_build + +%: + dh $@ + +override_dh_auto_clean: + @echo "Skipping clean" + +override_dh_auto_configure: + @echo "=== Generating .install files ===" + sed 's|@GPBACKUP_HOME_REL@|$(GPBACKUP_HOME_REL)|g' debian/gpbackup.install.in > debian/gpbackup.install + +override_dh_auto_build: + @echo "=== Building gpbackup binaries ===" + mkdir -p $(BUILD_DIR) + $(MAKE) build BIN_DIR=$(BUILD_DIR) + +override_dh_auto_install: + @echo "=== Installing gpbackup binaries ===" + install -D -m 755 $(BUILD_DIR)/gpbackup $(CURDIR)/debian/tmp/$(GPBACKUP_HOME_REL)/bin/gpbackup + install -D -m 755 $(BUILD_DIR)/gprestore $(CURDIR)/debian/tmp/$(GPBACKUP_HOME_REL)/bin/gprestore + install -D -m 755 $(BUILD_DIR)/gpbackup_helper $(CURDIR)/debian/tmp/$(GPBACKUP_HOME_REL)/bin/gpbackup_helper + +override_dh_dwz: + @echo "Skipping debug symbols compression (not working properly with Golang)" + +override_dh_gencontrol: + @echo "=== Generating control files ===" + dh_gencontrol From c9382c0eb3853eaf7f44ee97fcf39b3d7e11a36d Mon Sep 17 00:00:00 2001 From: Vladislav Pavlov Date: Tue, 2 Jun 2026 14:06:31 +0300 Subject: [PATCH 2/7] remove changelog, rename workflow, change workflow rules --- .github/workflows/build_deb.yml | 10 ++++++---- Makefile | 15 ++++++++++++++- debian/changelog | 5 ----- 3 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 debian/changelog diff --git a/.github/workflows/build_deb.yml b/.github/workflows/build_deb.yml index d253dfa8..d7865302 100644 --- a/.github/workflows/build_deb.yml +++ b/.github/workflows/build_deb.yml @@ -1,10 +1,11 @@ -name: build_deb +name: Build deb on: push: - branches: - - '*' - workflow_dispatch: + branches: ['master'] + tags: ['**'] + pull_request: + branches: ['**'] jobs: build_deb: @@ -12,5 +13,6 @@ jobs: with: go_version: "1.20" artifact_name: gpbackup-deb + build_command: make deb test_docker: ubuntu:24.04 add_greengage_repo: true diff --git a/Makefile b/Makefile index dd07ed36..6e408ed8 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,20 @@ install : fi; \ rm /tmp/seg_hosts -deb : +# Packaging +DATE_RFC := $(shell date -R) +DISTRO_CODENAME := $(shell lsb_release -sc 2>/dev/null || echo unstable) +DEB_VERSION := $(shell echo "$(GIT_VERSION)" | sed 's/^v//') +DEB_MAINTAINER := Greengage + +debian/changelog : + @echo "=== Generating debian/changelog ===" + @printf 'gpbackup (%s) %s; urgency=medium\n\n * Build from %s\n\n -- %s %s\n' \ + "$(DEB_VERSION)" "$(DISTRO_CODENAME)" "$(GIT_VERSION)" "$(DEB_MAINTAINER)" "$(DATE_RFC)" > $@ + +changelog : debian/changelog + +deb : debian/changelog dpkg-buildpackage -us -uc -b clean : diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 0364f8dc..00000000 --- a/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -gpbackup (1.30.7-1) unstable; urgency=medium - - * Initial Debian package - - -- Greengage Fri, 29 May 2026 00:00:00 +0000 From cb86e0d0d76159663d069b3c63fc9d8f46f3ee91 Mon Sep 17 00:00:00 2001 From: Vladislav Pavlov Date: Tue, 2 Jun 2026 22:39:00 +0300 Subject: [PATCH 3/7] change workflow reference --- .github/workflows/build_deb.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_deb.yml b/.github/workflows/build_deb.yml index d7865302..07523de3 100644 --- a/.github/workflows/build_deb.yml +++ b/.github/workflows/build_deb.yml @@ -9,10 +9,10 @@ on: jobs: build_deb: - uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@CI-5748 + uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@v43 with: go_version: "1.20" - artifact_name: gpbackup-deb - build_command: make deb - test_docker: ubuntu:24.04 + artifact_name: "gpbackup-deb" + build_command: "make deb" + test_docker: "ubuntu:24.04" add_greengage_repo: true From e74d5418d1617c23a1e86ae72341fed7c170db5c Mon Sep 17 00:00:00 2001 From: Vladislav Pavlov Date: Wed, 3 Jun 2026 12:02:04 +0300 Subject: [PATCH 4/7] support both ubuntu versions --- .github/workflows/build_deb.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_deb.yml b/.github/workflows/build_deb.yml index 07523de3..063fa33f 100644 --- a/.github/workflows/build_deb.yml +++ b/.github/workflows/build_deb.yml @@ -9,10 +9,14 @@ on: jobs: build_deb: + strategy: + matrix: + ubuntu_version: ["22.04", "24.04"] uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@v43 with: go_version: "1.20" - artifact_name: "gpbackup-deb" + artifact_name: "gpbackup-deb-ubuntu${{ matrix.ubuntu_version }}" build_command: "make deb" - test_docker: "ubuntu:24.04" + runner: "ubuntu-${{ matrix.ubuntu_version }}" + test_docker: "ubuntu:${{ matrix.ubuntu_version }}" add_greengage_repo: true From b33145ac1b9400f3523dc477dd5e0c7609daed10 Mon Sep 17 00:00:00 2001 From: Vladislav Pavlov Date: Wed, 3 Jun 2026 12:02:53 +0300 Subject: [PATCH 5/7] change workflow reference --- .github/workflows/build_deb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_deb.yml b/.github/workflows/build_deb.yml index 063fa33f..7ead13fd 100644 --- a/.github/workflows/build_deb.yml +++ b/.github/workflows/build_deb.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: ubuntu_version: ["22.04", "24.04"] - uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@v43 + uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@CI-5788 with: go_version: "1.20" artifact_name: "gpbackup-deb-ubuntu${{ matrix.ubuntu_version }}" From a2cb785b12b0603117a1a4a618760400e619a750 Mon Sep 17 00:00:00 2001 From: Vladislav Pavlov Date: Wed, 3 Jun 2026 16:55:38 +0300 Subject: [PATCH 6/7] change workflow reference --- .github/workflows/build_deb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_deb.yml b/.github/workflows/build_deb.yml index 7ead13fd..063fa33f 100644 --- a/.github/workflows/build_deb.yml +++ b/.github/workflows/build_deb.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: ubuntu_version: ["22.04", "24.04"] - uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@CI-5788 + uses: greengagedb/greengage-ci/.github/workflows/greengage-reusable-deb-native.yml@v43 with: go_version: "1.20" artifact_name: "gpbackup-deb-ubuntu${{ matrix.ubuntu_version }}" From 35847f02f740505b030d60db01399856a79f2f24 Mon Sep 17 00:00:00 2001 From: Vladislav Pavlov Date: Wed, 3 Jun 2026 22:20:33 +0300 Subject: [PATCH 7/7] add postinst and postrm scripts --- debian/postinst | 11 +++++++++++ debian/postrm | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 debian/postinst create mode 100644 debian/postrm diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 00000000..479d425a --- /dev/null +++ b/debian/postinst @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +GPBACKUP_BIN=/opt/greengagedb/gpbackup/bin + +for gphome in /opt/greengagedb/greengage*/; do + [ -d "${gphome}bin" ] || continue + for binary in gpbackup gprestore gpbackup_helper; do + ln -sf "${GPBACKUP_BIN}/${binary}" "${gphome}bin/${binary}" + done +done diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 00000000..d9033ca7 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +for gphome in /opt/greengagedb/greengage*/; do + [ -d "${gphome}bin" ] || continue + for binary in gpbackup gprestore gpbackup_helper; do + rm -f "${gphome}bin/${binary}" + done +done