From 71b69213b1600694a3dac25c062f9f39a6b0f143 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 21 Aug 2019 11:08:53 +0200 Subject: lib/common-functions: expand_blacklist_architectures() new --- lib/common-functions | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lib/common-functions') 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$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 +} -- cgit v1.2.3-70-g09d2