# oldest version: used by QA scripts (repo/bin/missing-pg-modules)
PG_OLDEST_VERSION=9.6
PG_MAIN_VERSION=17
PG_BETA_VERSION=17
PG_DEVEL_VERSION=18
PG_VERSIONS="10 11 12 13 14 15 16 17 18" # all server versions >= 10 (what we build extensions for)
PG_ALL_VERSIONS="8.2 8.3 8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6 $PG_VERSIONS" # all versions (which server packages we build on LTS dists)
# supported dists: actively updated
PG_SUPPORTED_DISTS="sid trixie bookworm bullseye \
oracular noble jammy focal"
# repository dists: kept in repository config
PG_REPOSITORY_DISTS="sid trixie bookworm bullseye buster \
oracular noble mantic jammy focal"
# archive dists: all distributions (used in apt.postgresql.org.sh)
PG_ARCHIVE_DISTS="sid trixie bookworm bullseye buster stretch jessie wheezy squeeze lenny etch \
oracular noble mantic lunar kinetic jammy impish hirsute groovy focal eoan disco cosmic bionic zesty xenial wily utopic saucy precise lucid"

set_dist_vars () { # args: $1 = distribution [$2 = architecture]
  ARCHS="amd64 arm64 ppc64el s390x" # default set of supported architectures
  COMPONENTS="main $PG_ALL_VERSIONS"
  HAS_BACKPORTS=""
  case $1 in
    # Debian
    sid)      PGDG_TAG=""      DISTRO="debian" RELEASE="unstable"              ARCHS="amd64 arm64 i386 ppc64el s390x" ;;
    trixie)   PGDG_TAG="130"   DISTRO="debian" RELEASE="13" ;;
    bookworm) PGDG_TAG="120"   DISTRO="debian" RELEASE="12" ;;
    bullseye) PGDG_TAG="110"   DISTRO="debian" RELEASE="11"    HAS_BACKPORTS=1 ;;
    buster)   PGDG_TAG="100"   DISTRO="debian" RELEASE="10"                    ARCHS="amd64 arm64 i386 ppc64el s390x" ;;
    stretch)  PGDG_TAG="90"    DISTRO="debian" RELEASE="9"     HAS_BACKPORTS=1 ARCHS="amd64       i386 ppc64el"       ;;
    jessie)   PGDG_TAG="80"    DISTRO="debian" RELEASE="8"                     ARCHS="amd64       i386 ppc64el"       COMPONENTS="main         8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6 10 11 12" ;;
    wheezy)   PGDG_TAG="70"    DISTRO="debian" RELEASE="7"                     ARCHS="amd64       i386"               COMPONENTS="main 8.2 8.3 8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6 10" ;;
    squeeze)  PGDG_TAG="60"    DISTRO="debian" RELEASE="6.0" ;;
    lenny)    PGDG_TAG="50"    DISTRO="debian" RELEASE="5.0" ;;
    etch)     PGDG_TAG="40"    DISTRO="debian" RELEASE="4.1" ;;
    # Ubuntu
    oracular) PGDG_TAG="24.10" DISTRO="ubuntu" RELEASE="24.10"                 ARCHS="amd64"                          COMPONENTS="main $PG_VERSIONS" ;;
    noble)    PGDG_TAG="24.04" DISTRO="ubuntu" RELEASE="24.04" ;;
    mantic)   PGDG_TAG="23.10" DISTRO="ubuntu" RELEASE="23.10"                 ARCHS="amd64"                          COMPONENTS="main $PG_VERSIONS" ;;
    lunar)    PGDG_TAG="23.04" DISTRO="ubuntu" RELEASE="23.04"                 ARCHS="amd64"                          COMPONENTS="main $PG_VERSIONS" ;;
    kinetic)  PGDG_TAG="22.10" DISTRO="ubuntu" RELEASE="22.10"                 ARCHS="amd64"                          COMPONENTS="main $PG_VERSIONS" ;;
    jammy)    PGDG_TAG="22.04" DISTRO="ubuntu" RELEASE="22.04" ;;
    impish)   PGDG_TAG="21.10" DISTRO="ubuntu" RELEASE="21.10"                 ARCHS="amd64"                          COMPONENTS="main                                     9.6 10 11 12 13 14 15 16" ;;
    hirsute)  PGDG_TAG="21.04" DISTRO="ubuntu" RELEASE="21.04"                 ARCHS="amd64"                          COMPONENTS="main                                     9.6 10 11 12 13 14" ;;
    groovy)   PGDG_TAG="20.10" DISTRO="ubuntu" RELEASE="20.10"                 ARCHS="amd64"                          COMPONENTS="main                                 9.5 9.6 10 11 12 13" ;;
    focal)    PGDG_TAG="20.04" DISTRO="ubuntu" RELEASE="20.04" HAS_BACKPORTS=1 ;;
    eoan)     PGDG_TAG="19.10" DISTRO="ubuntu" RELEASE="19.10"                 ARCHS="amd64"                          COMPONENTS="main                             9.4 9.5 9.6 10 11 12" ;;
    disco)    PGDG_TAG="19.04" DISTRO="ubuntu" RELEASE="19.04"                 ARCHS="amd64"                          COMPONENTS="main                             9.4 9.5 9.6 10 11 12" ;;
    cosmic)   PGDG_TAG="18.10" DISTRO="ubuntu" RELEASE="18.10" ;;
    bionic)   PGDG_TAG="18.04" DISTRO="ubuntu" RELEASE="18.04" HAS_BACKPORTS=1 ARCHS="amd64 arm64 i386 ppc64el"       ;;
    zesty)    PGDG_TAG="17.04" DISTRO="ubuntu" RELEASE="17.04" HAS_BACKPORTS=1 ;;
    xenial)   PGDG_TAG="16.04" DISTRO="ubuntu" RELEASE="16.04" HAS_BACKPORTS=1 ARCHS="amd64       i386 ppc64el"       COMPONENTS="main 8.2 8.3 8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6 10 11 12 13" ;;
    wily)     PGDG_TAG="15.10" DISTRO="ubuntu" RELEASE="15.10" HAS_BACKPORTS=1 ;;
    utopic)   PGDG_TAG="14.10" DISTRO="ubuntu" RELEASE="14.10" HAS_BACKPORTS=1 ;;
    trusty)   PGDG_TAG="14.04" DISTRO="ubuntu" RELEASE="14.04" HAS_BACKPORTS=1 ARCHS="amd64       i386 ppc64el"       COMPONENTS="main         8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6 10 11" ;;
    saucy)    PGDG_TAG="13.10" DISTRO="ubuntu" RELEASE="13.10" HAS_BACKPORTS=1 ;;
    precise)  PGDG_TAG="12.4"  DISTRO="ubuntu" RELEASE="12.04" HAS_BACKPORTS=1 ARCHS="amd64 i386"                     COMPONENTS="main 8.2 8.3 8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6" ;;
    lucid)    PGDG_TAG="10.4"  DISTRO="ubuntu" RELEASE="10.04" HAS_BACKPORTS=1 ;;
    *) echo "Unknown distribution $1" >&2 ; exit 1 ;;
  esac
  PGDG_DISTRIBUTION="pgdg$PGDG_TAG"

  case $DISTRO in
    debian)
      mirror="http://deb.debian.org/debian"
      security="http://security.debian.org/debian-security"
      security_src="$security"
      dist_security="$1-security"
      case $1 in
        sid) unset dist_security ;; # no security support
      esac
      case $(hostname) in
        pgapt*)
          mirror="http://mirror.hetzner.de/debian/packages" # doesn't have Sources
          mirror_src="http://ftp.de.debian.org/debian"
          security="http://mirror.hetzner.de/debian/security"
          ;;
      esac
      ;;
    ubuntu)
      mirror="http://archive.ubuntu.com/ubuntu"
      case ${architecture:-} in arm64|ppc64el|s390x)
        mirror="http://ports.ubuntu.com/ubuntu-ports" ;;
      esac
      case $(hostname) in
        pgapt*)
          if [ "$1" != "lunar" ]; then # no lunar mirror yet there
          mirror="http://mirror.hetzner.de/ubuntu/packages"
          mirror_src="http://archive.ubuntu.com/ubuntu"
          fi
          ;;
      esac
      ;;
  esac
  : ${mirror_src:=$mirror}

  if [ "${HAS_BACKPORTS:-}" ]; then
    mirror_backports="deb $mirror $1-backports main"
  fi
}

PG_BUILD_OPTIONS="parallel=1" # disable parallel builds
REPO_ORIGIN="apt.postgresql.org"
REPO_LABEL="PostgreSQL for Debian/Ubuntu repository"
REPO_SIGN_WITH="ACCC4CF8"
REPO_HOST="atalia.postgresql.org"
REPO_FILE_PATH="/srv/apt"
REPO_URL_PATH="/pub/repos/apt"
REPO_DIST_SUFFIX="-pgdg"
REPO_DIST_FLAVORS=". testing snapshot"
PGDG_MIRROR="atalia.postgresql.org"
CHROOT_INSTALL_PKGS="postgresql-all"

MAILING_LIST="PostgreSQL on Debian and Ubuntu <pgsql-pkg-debian@lists.postgresql.org>"
MAIL_FROM="apt.postgresql.org Repository Update <noreply@postgresql.org>"

# add $HOME/apt.postgresql.org/jenkins to PATH
case $PATH in
  */apt.postgresql.org/jenkins*) ;;
  *) PATH=$HOME/apt.postgresql.org/jenkins:$PATH ;;
esac

# vim:ft=sh:
