summaryrefslogtreecommitdiffstats
path: root/testing2x
blob: 48f2bb229e7a0cf2c3d3fe764e37e2349b2c3d71 (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
56
57
58
59
#!/bin/bash

. "$(dirname $0)/config"
. "$(dirname $0)/db-functions"

if [ $# -lt 1 ]; then
	msg "usage: ${0##*/} <pkgname> ..."
	exit 1
fi

# Lock everything to reduce  possibility of interfering task between the different repo-updates
script_lock
for repo in ${TESTING_REPO} ${STABLE_REPOS[@]}; do
	for pkgarch in ${ARCHES[@]}; do
		repo_lock ${repo} ${pkgarch} || exit 1
	done
done

for pkgname in "$@"; do
	msg "Moving $pkgname"

	for pkgarch in ${ARCHES[@]}; do
		repo_from=""
		repo_to=""
		found_source=false
		found_target=false

		path="${HISTORYREPO}/${TESTING_REPO}/${pkgarch}/${pkgname}"
		if [ -e "${path}" ]; then
			found_source=true
			repo_from="${TESTING_REPO}"
		fi
		${found_source} || continue

		for repo in ${STABLE_REPOS[@]}; do
			path="${HISTORYREPO}/${repo}/${pkgarch}/${pkgname}"
			if [ -e "${path}" ]; then
				found_target=true
				repo_to="${repo}"

				msg2 "$pkgarch $repo_from -> $repo_to"
				arch_db_move "$repo_from" "$repo_to" "$pkgarch" "$pkgname"
				break
			fi
		done
		${found_target} || warning "${pkgname} not found in any of these repos: ${STABLE_REPOS[@]}. skipping"
	done
	${found_source} || warning "${pkgname} not found in [${TESTING_REPO}]. skipping"
done

arch_history_commit "testing2x: $@"

for repo in  ${TESTING_REPO} ${STABLE_REPOS[@]}; do
	for pkgarch in ${ARCHES[@]}; do
		repo_unlock ${repo} ${pkgarch}
	done
done

script_unlock