repo-install-test: update package filtering logic

Instead of filtering with several blacklist_* files that must contain
the exact names of packages to be filtered, add a shell function that
uses fnmatch for filtering. Combine all lists into one.

This fixes the error we get with each limesuite release, without the
need to increase the version in the txt files every time. Currently the
repo-install-tests are failing for all debian versions because of this.

Change-Id: I6745b10804685119d68b089f129ec9b0cde8cdf5
diff --git a/scripts/repo-install-test/blacklist_centos8.txt b/scripts/repo-install-test/blacklist_centos8.txt
deleted file mode 100644
index 3e5381d..0000000
--- a/scripts/repo-install-test/blacklist_centos8.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-# These packages will not get explicitly installed in this test.
-# Package lines must have nothing but the package (no comment,
-# no additional space etc).
-
-# The ulfius package in network:osmocom:* is linked to the opensuse version,
-# which has dependencies that exist under another name in centos
-# (libgnutls-devel, libjansson-devel). Linking to the opensuse version has the
-# advantage that we don't need to worry about updating the package. However,
-# the dependency problem means that we can't simply install the package in
-# centos. In OBS we work around this in the project config.
-ulfius-devel
-
-# Also linked to opensuse versions
-nftables-devel
-python3-nftables
diff --git a/scripts/repo-install-test/blacklist_debian10.txt b/scripts/repo-install-test/blacklist_debian10.txt
deleted file mode 100644
index 93dac75..0000000
--- a/scripts/repo-install-test/blacklist_debian10.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-# These packages will not get explicitly installed in this test.
-# Package lines must have nothing but the package (no comment,
-# no additional space etc).
-
-# OpenBSC
-# This is legacy, we aren't really interested in testing openbsc.git
-# derived packages. Packages are found in openbsc/debian/control.
-openbsc-dev
-osmo-bsc-mgcp
-osmo-bsc-mgcp-dbg
-osmocom-bs11-utils
-osmocom-bs11-utils-dbg
-osmocom-bsc-nat
-osmocom-bsc-nat-dbg
-osmocom-bsc-sccplite
-osmocom-bsc-sccplite-dbg
-osmocom-ipaccess-utils
-osmocom-ipaccess-utils-dbg
-osmocom-nitb
-osmocom-nitb-dbg
-
-# Not relevant for the test
-limesuite-images
-limesuite-images23.10
-
-# SoapySDR is not used anymore (see OS#3542)
-soapysdr-module-lms7
-soapysdr0.6-module-lms7
-soapysdr0.6-module-lms7-dbgsym
-soapysdr0.7-module-lms7
-soapysdr0.7-module-lms7-dbgsym
-
-# Depends on specific verions 0.5.4.38.0847 of rtl-sdr, which we won't install
-librtlsdr0-dbgsym
-rtl-sdr-dbgsym
-
-# Depends on mongodb, which was droppend from debian 10 onwards
-open5gs
-open5gs-amf
-open5gs-amf-dbgsym
-open5gs-ausf
-open5gs-ausf-dbgsym
-open5gs-common
-open5gs-common-dbgsym
-open5gs-dbg
-open5gs-hss
-open5gs-hss-dbgsym
-open5gs-mme
-open5gs-mme-dbgsym
-open5gs-nrf
-open5gs-nrf-dbgsym
-open5gs-pcf
-open5gs-pcf-dbgsym
-open5gs-pcrf
-open5gs-pcrf-dbgsym
-open5gs-sgwc
-open5gs-sgwc-dbgsym
-open5gs-sgwu
-open5gs-sgwu-dbgsym
-open5gs-smf
-open5gs-smf-dbgsym
-open5gs-udm
-open5gs-udm-dbgsym
-open5gs-udr
-open5gs-udr-dbgsym
-open5gs-upf
-open5gs-upf-dbgsym
diff --git a/scripts/repo-install-test/blacklist_debian11.txt b/scripts/repo-install-test/blacklist_debian11.txt
deleted file mode 100644
index c962ffc..0000000
--- a/scripts/repo-install-test/blacklist_debian11.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-# These packages will not get explicitly installed in this test.
-# Package lines must have nothing but the package (no comment,
-# no additional space etc).
-
-# OpenBSC
-# This is legacy, we aren't really interested in testing openbsc.git
-# derived packages. Packages are found in openbsc/debian/control.
-openbsc-dev
-osmo-bsc-mgcp
-osmo-bsc-mgcp-dbg
-osmocom-bs11-utils
-osmocom-bs11-utils-dbg
-osmocom-bsc-nat
-osmocom-bsc-nat-dbg
-osmocom-bsc-sccplite
-osmocom-bsc-sccplite-dbg
-osmocom-ipaccess-utils
-osmocom-ipaccess-utils-dbg
-osmocom-nitb
-osmocom-nitb-dbg
-
-# Causing conflicts, not relevant for the test
-liblimesuite20.10-1-dbgsym
-liborcania1.2
-liborcania1.2-dbgsym
-liborcania2.1
-liborcania2.1-dbgsym
-libulfius2.5
-libulfius2.5-dbgsym
-libulfius2.7
-libulfius2.7-dbgsym
-libyder2.0-dbgsym
-limesuite-dbgsym
-limesuite-images
-limesuite-images23.10
-soapysdr0.7-module-lms7-dbgsym
-
-# Depends on specific verions 0.5.4.38.0847 of rtl-sdr, which we won't install
-librtlsdr0-dbgsym
-rtl-sdr-dbgsym
-
-# Depends on mongodb, which was droppend from debian 10 onwards
-open5gs
-open5gs-amf
-open5gs-amf-dbgsym
-open5gs-ausf
-open5gs-ausf-dbgsym
-open5gs-common
-open5gs-common-dbgsym
-open5gs-dbg
-open5gs-hss
-open5gs-hss-dbgsym
-open5gs-mme
-open5gs-mme-dbgsym
-open5gs-nrf
-open5gs-nrf-dbgsym
-open5gs-pcf
-open5gs-pcf-dbgsym
-open5gs-pcrf
-open5gs-pcrf-dbgsym
-open5gs-sgwc
-open5gs-sgwc-dbgsym
-open5gs-sgwu
-open5gs-sgwu-dbgsym
-open5gs-smf
-open5gs-smf-dbgsym
-open5gs-udm
-open5gs-udm-dbgsym
-open5gs-udr
-open5gs-udr-dbgsym
-open5gs-upf
-open5gs-upf-dbgsym
diff --git a/scripts/repo-install-test/blacklist_debian12.txt b/scripts/repo-install-test/blacklist_debian12.txt
deleted file mode 100644
index 9b5f5e7..0000000
--- a/scripts/repo-install-test/blacklist_debian12.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-# These packages will not get explicitly installed in this test.
-# Package lines must have nothing but the package (no comment,
-# no additional space etc).
-
-# OpenBSC
-# This is legacy, we aren't really interested in testing openbsc.git
-# derived packages. Packages are found in openbsc/debian/control.
-openbsc-dev
-osmo-bsc-mgcp
-osmo-bsc-mgcp-dbg
-osmocom-bs11-utils
-osmocom-bs11-utils-dbg
-osmocom-bsc-nat
-osmocom-bsc-nat-dbg
-osmocom-bsc-sccplite
-osmocom-bsc-sccplite-dbg
-osmocom-ipaccess-utils
-osmocom-ipaccess-utils-dbg
-osmocom-nitb
-osmocom-nitb-dbg
-
-# Causing conflicts, not relevant for the test
-liblimesuite20.10-1-dbgsym
-liblimesuite22.09-1-dbgsym
-liborcania1.2
-liborcania1.2-dbgsym
-liborcania2.1
-liborcania2.1-dbgsym
-libulfius2.5
-libulfius2.5-dbgsym
-libulfius2.7
-libulfius2.7-dbgsym
-libyder2.0-dbgsym
-limesuite-dbgsym
-limesuite-images
-limesuite-images23.10
-soapysdr0.7-module-lms7
-soapysdr0.7-module-lms7-dbgsym
-soapysdr-module-lms7
-
-# Depends on specific verions 0.5.4.38.0847 of rtl-sdr, which we won't install
-librtlsdr0-dbgsym
-rtl-sdr-dbgsym
-
-# Depends on mongodb, which was droppend from debian 10 onwards
-open5gs
-open5gs-amf
-open5gs-amf-dbgsym
-open5gs-ausf
-open5gs-ausf-dbgsym
-open5gs-common
-open5gs-common-dbgsym
-open5gs-dbg
-open5gs-hss
-open5gs-hss-dbgsym
-open5gs-mme
-open5gs-mme-dbgsym
-open5gs-nrf
-open5gs-nrf-dbgsym
-open5gs-pcf
-open5gs-pcf-dbgsym
-open5gs-pcrf
-open5gs-pcrf-dbgsym
-open5gs-sgwc
-open5gs-sgwc-dbgsym
-open5gs-sgwu
-open5gs-sgwu-dbgsym
-open5gs-smf
-open5gs-smf-dbgsym
-open5gs-udm
-open5gs-udm-dbgsym
-open5gs-udr
-open5gs-udr-dbgsym
-open5gs-upf
-open5gs-upf-dbgsym
diff --git a/scripts/repo-install-test/run-inside.sh b/scripts/repo-install-test/run-inside.sh
index d7730ff..425e49e 100755
--- a/scripts/repo-install-test/run-inside.sh
+++ b/scripts/repo-install-test/run-inside.sh
@@ -306,48 +306,77 @@
 	esac
 }
 
-# Filter $PWD/osmocom_packages_all.txt through a blacklist_$DISTRO.txt and store the result in
-# $PWD/osmocom_packages.txt.
-filter_packages_txt() {
-	# Copy distro specific blacklist file, remove comments and sort it
-	grep -v "^#" /repo-install-test/blacklist_$DISTRO.txt | sort -u > blacklist.txt
+filter_packages() {
+	for i in "$@"; do
+		case "$i" in
+		# OpenBSC
+		# This is legacy, we aren't really interested in testing
+		# openbsc.git derived packages. Packages are found in
+		# openbsc/debian/control.
+		osmo-bsc-dev) ;;
+		osmo-bsc-mgcp*) ;;
+		osmocom-bs11-utils*) ;;
+		osmocom-bsc-nat*) ;;
+		osmocom-bsc-sccplite*) ;;
+		osmocom-ipaccess-utils*) ;;
+		osmocom-nitb*) ;;
 
-	# Generate list of pkgs to be installed from available pkgs minus the ones blacklisted
-	comm -23 osmocom_packages_all.txt \
-		blacklist.txt > osmocom_packages.txt
+		# Causing conflicts, not relevant for the test
+		liblimesuite*) ;;
+		liborcania*) ;;
+		libulfius*) ;;
+		libhyder*) ;;
+		limesuite*) ;;
+		soapysdr*-module-lms7*) ;;
+
+		# Depends on specific verions 0.5.4.38.0847 of rtl-sdr, which
+		# we won't install
+		librtlsdr0-dbgsym) ;;
+		rtl-sdr-dbgsym) ;;
+
+		# Depends on mongodb, which was droppend from debian 10 onwards
+		open5gs*) ;;
+
+		# Dependencies that have a different name in centos8/almalinux8
+		# but are pulled in by linking to opensuse packages. In OBS we
+		# work around this in the project config.
+		ulfius-devel) ;;
+		nftables-devel) ;;
+		python3-nftables) ;;
+
+		# All other packages are not filtered
+		*) echo "$i" ;;
+		esac
+	done
 }
 
 install_repo_packages_debian() {
+	local packages
 	echo "Installing all repository packages"
 
 	# Get a list of all packages from the repository. Reference:
 	# https://www.debian.org/doc/manuals/aptitude/ch02s04s05.en.html
-	aptitude search -F%p \
-		"?origin(.*$PROJ.*) ?architecture(native)" | sort \
-		> osmocom_packages_all.txt
+	packages="$(aptitude search -F%p \
+		    "?origin(.*$PROJ.*) ?architecture(native)" | sort)"
+	packages="$(filter_packages $packages)"
 
-	cat osmocom_packages_all.txt
-
-	filter_packages_txt
-	apt-get install -y --no-install-recommends $(cat osmocom_packages.txt)
+	apt-get install -y --no-install-recommends -- $packages
 }
 
 install_repo_packages_centos() {
+	local packages
 	echo "Installing all repository packages"
 
 	# Get a list of all packages from the repository
-	LANG=C.UTF-8 repoquery \
+	packages=$(LANG=C.UTF-8 repoquery \
 		--quiet \
 		--repoid="$(proj_with_underscore "$PROJ")" \
 		--archlist="x86_64,noarch" \
 		--qf="%{name}" \
-		| sort \
-		> osmocom_packages_all.txt
+		| sort)
 
-	cat osmocom_packages_all.txt
-
-	filter_packages_txt
-	dnf install -y $(cat osmocom_packages.txt)
+	packages="$(filter_packages $packages)"
+	dnf install -y -- $packages
 }
 
 install_repo_packages() {