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
22 changes: 22 additions & 0 deletions .github/workflows/build_deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build deb

on:
push:
branches: ['master']
tags: ['**']
pull_request:
branches: ['**']

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-ubuntu${{ matrix.ubuntu_version }}"
build_command: "make deb"
runner: "ubuntu-${{ matrix.ubuntu_version }}"
test_docker: "ubuntu:${{ matrix.ubuntu_version }}"
add_greengage_repo: true
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ install :
fi; \
rm /tmp/seg_hosts

# 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 <greengage@greengagedb.org>

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 :
# Build artifacts
rm -f $(BIN_DIR)/$(BACKUP) $(BACKUP) $(BIN_DIR)/$(RESTORE) $(RESTORE) $(BIN_DIR)/$(HELPER) $(HELPER)
Expand Down
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
13
14 changes: 14 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Source: gpbackup
Maintainer: Greengage <greengage@greengagedb.org>
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.
3 changes: 3 additions & 0 deletions debian/gpbackup.install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@GPBACKUP_HOME_REL@/bin/gpbackup
@GPBACKUP_HOME_REL@/bin/gprestore
@GPBACKUP_HOME_REL@/bin/gpbackup_helper
11 changes: 11 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions debian/postrm
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/make -f

DH_VERBOSE = 1

GPBACKUP_HOME ?= /opt/greengagedb/gpbackup
Comment thread
bimboterminator1 marked this conversation as resolved.
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
Loading