summaryrefslogtreecommitdiff
path: root/lib/common-functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common-functions')
-rwxr-xr-xlib/common-functions28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/common-functions b/lib/common-functions
index 59576fb..501a5d0 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -1079,3 +1079,31 @@ extract_dependencies_from_package() {
| tr '[:upper:]' '[:lower:]' \
| sort -u
}
+
+# expand_blacklist_architectures $tmp_file
+# expand the architecture of the blacklisted packages given on stdin as
+# lines
+# $arch<tab>$pkgbase/$pkgname/$whatever
+expand_blacklist_architectures() {
+ # shellcheck disable=SC2016
+ {
+ printf 'SELECT `superior`.`name`,`inferior`.`name`'
+ printf ' FROM `architectures` AS `inferior`'
+ printf ' JOIN `architecture_compatibilities`'
+ printf ' ON `architecture_compatibilities`.`built_for`=`inferior`.`id`'
+ printf ' JOIN `architectures` AS `superior`'
+ printf ' ON `architecture_compatibilities`.`runs_on`=`superior`.`id`'
+ # "any" has a special role - it should be regarded as *inferior* to
+ # all architectures
+ printf ' WHERE `superior`.`name`!="any";\n'
+ printf 'SELECT "any",`architectures`.`name`'
+ printf ' FROM `architectures`;\n'
+ } \
+ | mysql_run_query \
+ | grep -v '\sany$' \
+ | sort -k1,1 \
+ > "$1"
+ sort -k1,1 \
+ | join -1 1 -2 1 -o 1.2,2.2 "$1" - \
+ | sort -u
+}