summaryrefslogtreecommitdiff
path: root/lib/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-23 09:57:21 +0100
committerErich Eckner <git@eckner.net>2018-03-23 09:57:21 +0100
commitaa91222717dabe20642aeb8ddf9b2a127ba19f0f (patch)
tree4752416ccf0f3595efe21606fb9042ef44f6b98f /lib/common-functions
parentb798f420fda3be00914a8ac7a5817b651a9858f4 (diff)
downloadbuilder-aa91222717dabe20642aeb8ddf9b2a127ba19f0f.tar.xz
lib/common-functions: find_git_repository_to_package_repository read info from database instead of git
Diffstat (limited to 'lib/common-functions')
-rwxr-xr-xlib/common-functions40
1 files changed, 15 insertions, 25 deletions
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