Commit 05ab7ce9 authored by Antonio Terceiro's avatar Antonio Terceiro

list-dep8-packages: add support for blacklist

parent 9ba30347
......@@ -3,6 +3,7 @@
: waiting for gpg key generation due to low entropy
[_] add timeout to guard against unbehaving test suites
[_] support for blacklisting packages
[X] write the code
[_] blacklist pyzmq: for some reason it is crashing the entire run
[_] add a postrm to remove all traces on package purge
[_] remove data directory
......
......@@ -6,13 +6,26 @@ base=$(readlink -f $(dirname $(readlink -f $0))/..)
. $base/lib/environment.sh
. $base/lib/functions.sh
list_packages() {
list_packages_from_archive() {
grep_sources -n -s Package -F Testsuite -X autopkgtest | sort | uniq
}
whitelist="${debci_config_dir}/whitelist"
if [ -f "${whitelist}" ]; then
sed -e '/^#/d' "${whitelist}"
list_packages() {
whitelist="${debci_config_dir}/whitelist"
if [ -f "${whitelist}" ]; then
sed -e '/^#/d' "${whitelist}"
else
list_packages_from_archive
fi
}
blacklist="${debci_config_dir}/blacklist"
if [ -e "$blacklist" ]; then
for pkg in $(list_packages); do
if ! grep -q "^\s*${pkg}\s*$" "$blacklist"; then
echo "$pkg"
fi
done
else
list_packages
fi
. $(dirname $0)/test_helper.sh
export debci_config_dir="$TMPDIR"
setUp() {
rm -rf $TMPDIR/*
}
tearDown() {
rm -rf $TMPDIR/*
}
test_with_whitelist() {
echo "pkg1" > $TMPDIR/whitelist
assertEquals "pkg1" "$(./scripts/list-dep8-packages)"
}
test_with_blacklist() {
echo "pkg1" >> $TMPDIR/whitelist
echo "pkg2" >> $TMPDIR/whitelist
echo "pkg3" >> $TMPDIR/whitelist
echo "pkg2" > $TMPDIR/blacklist
./scripts/list-dep8-packages > $TMPDIR/pkgs
assertTrue 'pkg1 should be listed' "grep -q pkg1 $TMPDIR/pkgs"
assertFalse "package pkg2 is blacklisted, should not be listed" "grep -q pkg2 $TMPDIR/pkgs"
assertTrue 'pkg3 should be listed' "grep -q pkg3 $TMPDIR/pkgs"
}
. shunit2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment