-
Notifications
You must be signed in to change notification settings - Fork 15
/
testing2x
executable file
·54 lines (46 loc) · 1.64 KB
/
testing2x
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
#!/bin/bash
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
if (( $# < 1 )); then
msg "usage: %s <pkgname|pkgbase> ..." "${0##*/}"
exit 1
fi
# Lock everything to reduce possibility of interfering task between the different repo-updates
script_lock
for repo in "${TESTING_REPOS[@]}" "${STABLE_REPOS[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${pkgarch}" || exit 1
done
done
declare -A pkgs
testing_repo=
for pkgbase in "$@"; do
for pkgarch in "${ARCHES[@]}"; do
vcsrepo_from="$(find_repo_for_package "${pkgbase}" "${pkgarch[@]}" "${TESTING_REPOS[@]}")"
vcsrepo_to="$(find_repo_for_package "${pkgbase}" "${pkgarch[@]}" "${STABLE_REPOS[@]}")"
repo_from=${vcsrepo_from%-@(any|${pkgarch})}
repo_to="${vcsrepo_to%-@(any|${pkgarch})}"
if [[ -z ${testing_repo} ]]; then
testing_repo=${repo_from}
elif [[ ${testing_repo} != ${repo_from} ]]; then
die "Cannot move packages from multiple repos at a time: %s" "${testing_repo} ${repo_from}"
fi
if [[ ${vcsrepo_from} && ${vcsrepo_to} ]]; then
pkgs[${repo_to}]+="${pkgbase} "
break
fi
done
[[ ${vcsrepo_from} ]] || die "%s not found in any of these repos: %s" "${pkgbase}" "${TESTING_REPOS[@]}"
[[ ${vcsrepo_to} ]] || die "%s not found in any of these repos: %s" "$pkgbase" "${STABLE_REPOS[*]}"
done
for repo in "${TESTING_REPOS[@]}" "${STABLE_REPOS[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
repo_unlock "${repo}" "${pkgarch}"
done
done
for repo in "${STABLE_REPOS[@]}"; do
if [[ -n ${pkgs[${repo}]} ]]; then
"$(dirname "$(readlink -e "$0")")/db-move" "${testing_repo}" "${repo}" ${pkgs[${repo}]}
fi
done
script_unlock