summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-08-21 11:08:53 +0200
committerErich Eckner <git@eckner.net>2019-08-21 11:08:53 +0200
commit71b69213b1600694a3dac25c062f9f39a6b0f143 (patch)
tree8e8b0c243b8ae0b83b3cc30c452f86cb235b8888 /lib
parent1b47369e3b43e4b8b6c6f095e31ce11faf886b8a (diff)
downloadbuilder-71b69213b1600694a3dac25c062f9f39a6b0f143.tar.xz
lib/common-functions: expand_blacklist_architectures() new
Diffstat (limited to 'lib')
-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
+}