blob: 765610cfe18506c018be3212d1b87c3daa6f66cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/bin/bash
# contains functions used by more than one script
# find the PKGBUILD of a given package in a given repository
# TODO:
# _properly_ include repository of package customizations
find_pkgbuild() {
for prefix in "${repo_paths["packages"]}" "${repo_paths["community"]}"; do
[ -d "${prefix}/$1" ] || continue
ls "${prefix}/$1/repos/$2-"*"/PKGBUILD" 2> /dev/null && break
done | \
tr ' ' '\n' | \
grep -v -- '-i686/PKGBUILD$' | \
grep -v -- '-\(staging\|testing\)-[^/]\+/PKGBUILD$' | \
sort | \
tail -n1
}
find_repository_with_commit() {
for repository in "${!repo_paths[@]}"; do
if [ "$(git -C "${repo_paths["${repository}"]}" cat-file -t "$1" 2> /dev/null)" == "commit" ]; then
echo "${repository}"
return 0
fi
done
>&2 echo "can't find repository with commit '$1'"
exit 1
}
find_git_repository_to_package_repository() {
for repository in "${!repo_paths[@]}"; do
if [ "${repository}" == "archlinux32" ]; then
continue
fi
if [ -n "$(
(
ls "${repo_paths["${repository}"]}/"*"/repos" | \
grep -v ':$' | \
sed 's|-[^-]\+$||' | \
sort -u
echo "$1"
) | \
sort | \
uniq -d
)" ]; then
echo "${repository}"
return 0
fi
done
>&2 echo "can't find git repository with package repository '$1'"
exit 1
}
|