From 29cd25770761c0cc6e056807789f32493470d550 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 5 Feb 2018 16:27:05 +0100 Subject: bin/mysql-functions: add unknown packages whose pkgbase is identically found in the database --- bin/mysql-functions | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/mysql-functions b/bin/mysql-functions index 1f2e882..3c02511 100755 --- a/bin/mysql-functions +++ b/bin/mysql-functions @@ -805,8 +805,21 @@ mysql_repair_binary_packages_without_build_assignment() { grep '"pkgname":\s*"'"$(str_to_regex "${pkgname}")"'"' | \ tr ',' '\n' | \ grep '"pkgbase":' | \ - cut -d'"' -f4 + cut -d'"' -f4 | \ + sort -u | \ + head -n1 ) + if [ -z "${pkgbase}" ] && \ + { + printf 'SELECT count(*) FROM `package_sources`' + printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s")' \ + "$(printf '%s' "${pkgname}" | base64 -w0)" + } | \ + ${mysql_command} --raw --batch | \ + sed '1d' | \ + grep -vxF '0'; then + pkgbase="${pkgname}" + fi if [ -z "${pkgbase}" ]; then >&2 printf 'Could not find "%s" upstream.\n' "${pkgname}" continue -- cgit v1.2.3-70-g09d2