deb-mock/mock/integration-tests/19-sign-plugin.tst
robojerk 4c0dcb2522
Some checks failed
Build Deb-Mock Package / build (push) Successful in 54s
Lint Code / Lint All Code (push) Failing after 1s
Test Deb-Mock Build / test (push) Failing after 36s
enhance: Add comprehensive .gitignore for deb-mock project
- Add mock-specific build artifacts (chroot/, mock-*, mockroot/)
- Include package build files (*.deb, *.changes, *.buildinfo)
- Add development tools (.coverage, .pytest_cache, .tox)
- Include system files (.DS_Store, Thumbs.db, ._*)
- Add temporary and backup files (*.tmp, *.bak, *.backup)
- Include local configuration overrides (config.local.yaml, .env.local)
- Add test artifacts and documentation builds
- Comprehensive coverage for Python build system project

This ensures build artifacts, chroot environments, and development
tools are properly ignored in version control.
2025-08-18 23:37:49 -07:00

61 lines
1.5 KiB
Bash

#!/bin/bash
: "${MOCKCMD=mock}"
if test -z "$TESTDIR"; then
TESTDIR=$(dirname "$(readlink -f "$0")")
fi
. ${TESTDIR}/functions
header "testing that sign plugin works"
confdir=$HOME/.config
mkdir -p "$confdir"
case $(rpm --eval "%__gpg") in
*gpg-mock) ;;
*) die "this system is not prepared (run setup-box from remote location)" ;;
esac
local_config=$confdir/mock.cfg
test -f "$local_config" && die "please remove $local_config first"
TMPDIR=$(mktemp -d) || die "can't create temporary directory"
cat > "$local_config" <<EOF
config_opts['plugin_conf']['sign_enable'] = True
config_opts['plugin_conf']['sign_opts'] = {}
config_opts['plugin_conf']['sign_opts']['cmd'] = 'rpmsign'
# For the future: Even if change the default, please keep this line
# so we check compatibility.
config_opts['plugin_conf']['sign_opts']['opts'] = '--addsign %(rpms)s'
EOF
cleanup() {
rm "$local_config"
rm -rf "$TMPDIR"
}
trap cleanup EXIT
runcmd "$MOCKCMD --rebuild ${TESTDIR}/test-C-1.1-0.src.rpm --resultdir $TMPDIR" \
|| die "mock rebuild failed"
rpmoutput=$(rpm --qf '%{NAME} %{RSAHEADER}\n' -qp "$TMPDIR"/*.rpm 2>/dev/null)
lines=0
while read -r line; do
case $line in
"(none)") die "some packages are not signed" ;;
*)
if test ${#line} -lt 256; then
die "weird signature $line"
fi
;;
esac
lines=$(( lines + 1 ))
done <<<"$rpmoutput"
test $lines -eq 2 || die "two packages are expected to be signed"
exit 0