1
0
Fork 0
php-sqlcipher/scripts/render-debian-files.sh
Miguel Jacq c408cfe2ce
All checks were successful
Build PHP PDO SQLCipher packages / php7.4 on debian-12-bookworm (push) Successful in 4m13s
Build PHP PDO SQLCipher packages / php8.0 on debian-12-bookworm (push) Successful in 4m2s
Build PHP PDO SQLCipher packages / php8.1 on debian-12-bookworm (push) Successful in 4m4s
Build PHP PDO SQLCipher packages / php8.2 on debian-12-bookworm (push) Successful in 4m18s
Build PHP PDO SQLCipher packages / php8.3 on debian-12-bookworm (push) Successful in 3m47s
Build PHP PDO SQLCipher packages / php8.4 on debian-12-bookworm (push) Successful in 3m52s
Build PHP PDO SQLCipher packages / php8.5 on debian-12-bookworm (push) Successful in 4m9s
Build PHP PDO SQLCipher packages / php7.4 on debian-13-trixie (push) Successful in 4m48s
Build PHP PDO SQLCipher packages / php8.0 on debian-13-trixie (push) Successful in 4m34s
Build PHP PDO SQLCipher packages / php8.1 on debian-13-trixie (push) Successful in 4m10s
Build PHP PDO SQLCipher packages / php8.2 on debian-13-trixie (push) Successful in 4m6s
Build PHP PDO SQLCipher packages / php8.3 on debian-13-trixie (push) Successful in 4m10s
Build PHP PDO SQLCipher packages / php8.4 on debian-13-trixie (push) Successful in 5m9s
Build PHP PDO SQLCipher packages / php8.5 on debian-13-trixie (push) Successful in 4m10s
Build PHP PDO SQLCipher packages / php7.4 on ubuntu-22.04 (push) Successful in 4m25s
Build PHP PDO SQLCipher packages / php8.0 on ubuntu-22.04 (push) Successful in 4m14s
Build PHP PDO SQLCipher packages / php8.1 on ubuntu-22.04 (push) Successful in 4m20s
Build PHP PDO SQLCipher packages / php8.2 on ubuntu-22.04 (push) Successful in 4m46s
Build PHP PDO SQLCipher packages / php8.3 on ubuntu-22.04 (push) Successful in 4m28s
Build PHP PDO SQLCipher packages / php8.4 on ubuntu-22.04 (push) Successful in 4m24s
Build PHP PDO SQLCipher packages / php8.5 on ubuntu-22.04 (push) Successful in 4m25s
Build PHP PDO SQLCipher packages / php7.4 on ubuntu-24.04 (push) Successful in 5m5s
Build PHP PDO SQLCipher packages / php8.0 on ubuntu-24.04 (push) Successful in 4m57s
Build PHP PDO SQLCipher packages / php8.1 on ubuntu-24.04 (push) Successful in 4m57s
Build PHP PDO SQLCipher packages / php8.2 on ubuntu-24.04 (push) Successful in 4m58s
Build PHP PDO SQLCipher packages / php8.3 on ubuntu-24.04 (push) Successful in 4m47s
Build PHP PDO SQLCipher packages / php8.4 on ubuntu-24.04 (push) Successful in 4m46s
Build PHP PDO SQLCipher packages / php8.5 on ubuntu-24.04 (push) Successful in 5m1s
Update to SQLCipher 4.16.0 and pass timestamp/sqlcipher version to package names/changelog
2026-05-13 11:48:10 +10:00

81 lines
2.8 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# ---- Compute variables ----
PHP_VER="${PHP_VER:?set PHP_VER like 7.4|8.0|8.1|8.2|8.3|8.4}"
PKG="php${PHP_VER}-sqlcipher"
PHP_BIN="php${PHP_VER}"
DOC_DIR="/usr/share/doc/${PKG}"
# Distro codename
if command -v lsb_release >/dev/null 2>&1; then
DIST_CODENAME="${DIST_CODENAME:-$(lsb_release -sc)}"
else
. /etc/os-release 2>/dev/null || true
DIST_CODENAME="${DIST_CODENAME:-${VERSION_CODENAME:-unknown}}"
fi
MAINT_NAME="${MAINT_NAME:-Miguel Jacq}"
MAINT_EMAIL="${MAINT_EMAIL:-mig@mig5.net}"
DATE_RFC2822="$(date -R)"
# Derive package version if not provided
if [[ -z "${PKG_VERSION:-}" ]]; then
if command -v "${PHP_BIN}" >/dev/null 2>&1; then
PHP_FULL="$("${PHP_BIN}" -r 'echo PHP_MAJOR_VERSION,".",PHP_MINOR_VERSION,".",PHP_RELEASE_VERSION;')"
else
PHP_FULL="$(dpkg-query -W -f='${Version}\n' "${PHP_BIN}-dev" 2>/dev/null | sed 's/-.*//;q' || echo "${PHP_VER}.0")"
fi
BUILD_ID="${BUILD_ID:-$(date -u +%Y%m%d%H%M%S)}"
# Debian revision cannot contain hyphens. Keep this conservative.
SQLCIPHER_DEB_VER="$(
printf '%s' "${SQLCIPHER_VERSION:-unknown}" \
| sed -E 's/^[vV]//; s/[^A-Za-z0-9.+~]/./g'
)"
BUILD_ID_DEB="$(
printf '%s' "${BUILD_ID}" \
| sed -E 's/[^A-Za-z0-9.+~]/./g'
)"
PKG_VERSION="${PHP_FULL}-1+${DIST_CODENAME}.${BUILD_ID_DEB}.sqlcipher${SQLCIPHER_DEB_VER}"
fi
# Export everything envsubst must see
export PHP_VER PKG PHP_BIN DOC_DIR DIST_CODENAME PKG_VERSION MAINT_NAME MAINT_EMAIL DATE_RFC2822 SQLCIPHER_VERSION BUILD_ID
# Only substitute the vars we care about
VARS='${PHP_VER} ${PKG} ${PHP_BIN} ${DOC_DIR} ${DIST_CODENAME} ${PKG_VERSION} ${MAINT_NAME} ${MAINT_EMAIL} ${DATE_RFC2822} ${SQLCIPHER_VERSION} ${BUILD_ID}'
render() {
local src="$1" dst="$2"
[[ -f "$src" ]] || return 0
# Support both ${VAR} and @VAR@ templates
local tmp; tmp="$(mktemp)"
sed -E 's/@([A-Z0-9_]+)@/\${\1}/g' "$src" > "$tmp"
envsubst "$VARS" < "$tmp" > "$dst"
rm -f "$tmp"
}
# Render files
render debian/changelog.in debian/changelog
render debian/control.in debian/control
render debian/copyright.in debian/copyright
render debian/pkg.examples.in "debian/${PKG}.examples"
render debian/pkg.php.in "debian/${PKG}.php"
mkdir -p debian/tests
render debian/tests/control.in debian/tests/control
render debian/tests/basic.in debian/tests/basic
# ---- Self-check: make sure changelog header is valid and no ${...} placeholders remain ----
if [[ -f debian/changelog ]]; then
head -n1 debian/changelog | grep -Eq '^[a-z0-9.+-]+ \([0-9][^)]*\) [^;]+; urgency=' \
|| { echo "ERROR: debian/changelog header invalid:"; sed -n '1,3p' debian/changelog; exit 1; }
! grep -q '\${[A-Z0-9_]\+}' debian/changelog \
|| { echo "ERROR: Unsubstituted variables remain in debian/changelog"; sed -n '1,8p' debian/changelog; exit 1; }
fi