/usr/share/doc/mini-buildd/examples/packages.testbuild is in mini-buildd 1.0.33.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #!/bin/bash -e
# Be sure the "Changed-By" E-Mail in changes is set reasonably
# so we don't accidentally spam someone while testing ;)
export DEBEMAIL="$(id -n -u)@$(hostname -f)"
declare -A DEB_RELEASE_VERSION=(
	[woody]=30
	[sarge]=31
	[etch]=40
	[lenny]=50
	[squeeze]=60
	[wheezy]=70
	[jessie]=80
	[sid]=SID
)
declare -A DEB_RELEASE_PREV=(
	[woody]=potato
	[sarge]=woody
	[etch]=sarge
	[lenny]=etch
	[squeeze]=lenny
	[wheezy]=squeeze
	[jessie]=wheezy
	[sid]=wheezy
)
read -e -i "mini-buildd-$(hostname)" -p "Dput target? " dput_target
read -e -i "test" -p "mini-buildd reposiory id? " id
read -e -i "$(lsb_release --short --codename)" -p "upload to base distribution? " dist
prev_dist=${DEB_RELEASE_PREV[${dist}]}
prev_prev_dist=${DEB_RELEASE_PREV[${prev_dist}]}
read -e -i "unstable" -p "upload to suite? " dest
read -e -i "${prev_dist}-${id}-${dest}, ${prev_prev_dist}-${id}-${dest}" -p "auto backports for? " backports
PKG_DIR="$(dirname $(readlink -f ${0}))/packages/"
PACKAGES="${*}"
[ -n "${PACKAGES}" ] || PACKAGES=$(ls "${PKG_DIR}/")
printf "Acting on: %s\n" "${PACKAGES}"
builddir="$(mktemp -d)"
cd "${builddir}"
# Check if there us a secret key available
GPG_KEY=$(gpg --with-colons --list-secret-key | head -1 | cut -d: -f5)
if [ -n "${GPG_KEY}" ]; then
	SIGN_OPTS="-k${GPG_KEY}"
	printf "I: Using signing key ${GPG_KEY}.\n" >&2
else
	SIGN_OPTS="-us -uc"
	printf "W: Disabling signing.\n" >&2
fi
for P in ${PACKAGES}; do
	if ! echo "${P}" | grep -q "template"; then
		(
			version="$(date --utc +%Y%m%d%H%M%S)~${id}${DEB_RELEASE_VERSION[${dist}]}+"
			if cp -a "${PKG_DIR}/${P}" "${P}"; then
				cd "${P}"
			else
				apt-get source "${P}"
				DIR=$(find . -maxdepth 1 -mindepth 1 -type d -name "${P}*")
				[ -n "${DIR}" ]
				version="$(echo ${DIR} | rev | cut -d- -f1 | rev)-${version}"
				cd "${DIR}"
			fi
			if [ "${dest}" = "experimental" -o "${dest}" = "snapshot" ]; then
				version+="0"
			else
				version+="1"
			fi
			debchange --force-distribution --force-bad-version --newversion "${version}" --dist "${dist}-${id}-${dest}" "test build for mini-buildd"
			[ -z "${backports}" ] || debchange --force-distribution --force-bad-version --dist "${dist}-${id}-${dest}" --append "MINI_BUILDD_OPTION: auto-ports=${backports}"
			dpkg-buildpackage ${SIGN_OPTS} -d -S -sa
		)
	fi
done
action=u
while [ "${action}" != "q" ]; do
	read -p "dput '${builddir}/*.changes' to '${dput_target}' [R]" dummy
	dput -u -f "${dput_target}" *.changes || true
	printf "I: Working dir: $(pwd)\n"
	read -e -i"r" -p "(q)uit and purge build dir '${builddir}', or (r)e-upload? " action
done
rm -rfv "${builddir}"
 |