#!/bin/sh

set -e

# Ensure that recent versions of important dependencies will be installed from
# trixie-backports. This is a no-op if trixie-backports isn't in the APT
# sources.
# This needs to be a standalone file that can be passed to `autopkgtest
# --setup-commands` and SALSA_CI_PIUPARTS_PRE_INSTALL_SCRIPT.

# shellcheck disable=SC2043
for backport in python3-django-cte; do
    backport_pref="/etc/apt/preferences.d/debusine-$backport.pref"
    if [ ! -e "$backport_pref" ]; then
        cat >"$backport_pref" <<EOF
Package: $backport
Pin: release n=trixie-backports
Pin-Priority: 900
EOF
    fi
done
