Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-09-28 18:25:17 +0200
committerErich Eckner <git@eckner.net>2022-09-28 18:25:17 +0200
commitaca3ba055ae3a9d012e3dc8c7d159b19996c8814 (patch)
treecb54b2326f93c1b14e74077122a18405ad83c0c2 /lib/common-functions
parentaa166d81abc3be5eb8949cc309755a22c0581c5e (diff)
lib/common-functions: find_package_repository_to_package(): if multiple repositories are found, apply some sanity filter based on the database
Diffstat (limited to 'lib/common-functions')
-rwxr-xr-xlib/common-functions35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/common-functions b/lib/common-functions
index eb61e9e..cecd27f 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -521,7 +521,40 @@ find_package_repository_to_package() {
"${git_repository}" \
"${git_commit}"
>&2 printf '%s\n' "${repo}"
- return 1
+ >&2 printf 'trying to filter based on git\n'
+
+ if ! repo=$(
+ {
+ printf 'SELECT `upstream_repositories`.`name`'
+ printf ' FROM `upstream_repositories`'
+ mysql_join_upstream_repositories_git_repositories
+ printf ' WHERE `git_repositories`.`name`=from_base64("%s")' \
+ "$(
+ printf '%s' "${git_repository}" \
+ | base64 -w0
+ )"
+ } | \
+ mysql_run_query 'unimportant' | \
+ grep -xF "${repo}"
+ ); then
+ >&2 printf 'find_package_repository_to_package %s %s %s: no repo found after filtering\n' \
+ "${package}" \
+ "${git_repository}" \
+ "${git_commit}"
+ return 1
+ fi
+
+ if [ "$(
+ echo "${repo}" | \
+ wc -l
+ )" -ne 1 ]; then
+ >&2 printf 'find_package_repository_to_package %s %s %s: still multiple repos found after filter:\n' \
+ "${package}" \
+ "${git_repository}" \
+ "${git_commit}"
+ >&2 printf '%s\n' "${repo}"
+ return 1
+ fi
fi
echo "${repo}"