Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-07-20 20:35:24 +0200
committerErich Eckner <git@eckner.net>2017-07-20 20:35:24 +0200
commit002d036064354d9e7b4412f703ddbb8a92b87804 (patch)
tree7e99dfcbcfd2011f6a2d4bf31f8ea5e8709b52d4 /bin/common-functions
parentca6a26f35eeeef7cd45989bf1af0737b01a7fb1b (diff)
bin/common-functions: find_package_repository_to_package new
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-xbin/common-functions36
1 files changed, 36 insertions, 0 deletions
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}"
+
+}