index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-07-20 20:35:24 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-07-20 20:35:24 +0200 |
commit | 002d036064354d9e7b4412f703ddbb8a92b87804 (patch) | |
tree | 7e99dfcbcfd2011f6a2d4bf31f8ea5e8709b52d4 /bin/common-functions | |
parent | ca6a26f35eeeef7cd45989bf1af0737b01a7fb1b (diff) |
-rwxr-xr-x | bin/common-functions | 36 |
diff --git a/bin/common-functions b/bin/common-functions index 31ce6f1..2037853 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -604,3 +604,39 @@ find_newest_of_git_revisions() { echo "${newest}" ) } + +# find_package_repository_to_package $package $git_repository +# find the package repository a package from a given git repository +# belongs to + +find_package_repository_to_package() { + + local package="$1" + local git_repository="$2" + local repo_path + local repo + + eval 'repo_path="${repo_paths__'"${git_repository}"'}"' + + repo="$( + ls "${repo_path}/${package}/repos" 2> /dev/null | \ + grep -v 'staging\|testing' | \ + grep -v -- '-i686$' | \ + sed 's|-[^-]\+$||' | \ + sort -u + )" + + if [ -z "${repo}" ]; then + return 1 + fi + + if [ "$( + echo "${repo}" | \ + wc -l + )" -ne 1 ]; then + return 1 + fi + + echo "${repo}" + +} |