deb-m-a-dep-check/generate_testcases.sh

101 lines
2.8 KiB
Bash
Executable file

#!/bin/sh
#
# Copyright 2015 Johannes Schauer <josch@mister-muffin.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
set -eu
pkgArel="depends conflicts"
pkgAvpkg="pkgb pkgb:amd64 pkgb:i386 pkgb:any pkgc pkgc:amd64 pkgc:i386 pkgc:any"
pkgAsrcvpkg="pkgb:native pkgc:native"
pkgAtype="binary source"
pkgBprovides="none pkgc pkgc:amd64 pkgc:i386"
binpkgarch="amd64 i386 all"
# possible Multi-Arch values
maprop="no foreign allowed same"
# list for Arch:all packages without "same"
allmaprop="no foreign allowed"
# all testcases are a 8-tuple with the following content:
#
# 1. pkgAtype
# 2. pkgBprovides
# 3. pkgAarch (if pkgA is a binary package)
# 4. pkgBarch
# 5. pkgAmaprop (if pkgA is a binary package)
# 6. pkgBmaprop
# 7. relationship (depends or conflicts)
# 8. vpkg value
#
# then, in case pkgAtype is "binary" both packages are tried to be installed
# at the same time
# in case pkgAtype is "source", the source package is checked for its
# build depends/conflict satisfiability with the second package installed
#
# the :any qualifier will also be used to depend on packages which are not
# m-a:allowed. This is to test situations in which either:
# 1. :any was added wrongly or
# 2. a m-a:allowed package was changed to something else without changing
# all reverse dependencies or
# 3. different package repositories are mixed where a package which
# is m-a:allowed in one repository and depended upon with :any is not
# m-a:allowed in another repository but of higher version or otherwise
# preferred
for t1 in $pkgAtype; do
for t2 in $pkgBprovides; do
if [ "$t1" = "binary" ]; then
pkgAarches="$binpkgarch"
else
pkgAarches="none"
fi
for t3 in $pkgAarches; do
for t4 in $binpkgarch; do
if [ "$t1" = "binary" ]; then
if [ "$t3" = "all" ]; then
pkgAma="$allmaprop"
else
pkgAma="$maprop"
fi
else
pkgAma="none"
fi
for t5 in $pkgAma; do
if [ "$t4" = "all" ]; then
pkgBma="$allmaprop"
else
pkgBma="$maprop"
fi
for t6 in $pkgBma; do
for t7 in $pkgArel; do
if [ "$t1" = "binary" ]; then
props="$pkgAvpkg"
else
props="$pkgAvpkg $pkgAsrcvpkg"
fi
for t8 in $props; do
echo "$t1 $t2 $t3 $t4 $t5 $t6 $t7 $t8"
done
done
done
done
done
done
done
done