From aa91222717dabe20642aeb8ddf9b2a127ba19f0f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 23 Mar 2018 09:57:21 +0100 Subject: lib/common-functions: find_git_repository_to_package_repository read info from database instead of git --- lib/common-functions | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'lib/common-functions') diff --git a/lib/common-functions b/lib/common-functions index f66ccd1..8425e9a 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -88,35 +88,25 @@ find_repository_with_commit() { find_git_repository_to_package_repository() { local repository - local package_repository - local repo_path - - package_repository="$1" - if [ "$1" = 'build-support' ]; then - echo 'packages' + repository=$( + # shellcheck disable=SC2016 + { + printf 'SELECT `git_repositories`.`name` FROM `git_repositories`' + mysql_join_git_repositories_upstream_repositories + printf ' WHERE `upstream_repositories`.`name`=from_base64("%s");\n' \ + "$(printf '%s' "$1" | base64 -w0)" + } | \ + mysql_run_query + ) + if [ -z "${repository}" ]; then + >&2 echo "can't find git repository with package repository '$1'" + exit 1 + else + echo "${repository}" return 0 fi - for repository in ${repo_names}; do - if [ "${repository}" = "archlinux32" ]; then - continue - fi - eval 'repo_path="${repo_paths__'"${repository}"'}"' - if git -C "${repo_path}" archive "$(cat "${work_dir}/${repository}.revision")" -- | \ - tar -t --wildcards '*/repos' | \ - grep '^\([^/]\+/\)\{3\}PKGBUILD$' | \ - cut -d/ -f3 | \ - sed 's|-[^-]\+$||' | \ - sort -u | \ - grep -qxF "${package_repository}"; then - echo "${repository}" - return 0 - fi - done - >&2 echo "can't find git repository with package repository '$1'" - exit 1 - } # repository_of_package $package.$repo_revision.$mod_repo_revision.$repository -- cgit v1.2.3-70-g09d2