summaryrefslogtreecommitdiffstats
path: root/testing2x
blob: f209e839003b70f8f37a8bcf1c636dd6d374876c (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
60
61
#!/bin/bash

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

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

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

declare -A pkgs

for pkgbase in $*; do
	if [ ! -d "${WORKDIR}/${pkgbase}" ]; then
		/usr/bin/svn export -q "${SVNREPO}/${pkgbase}/repos" "${WORKDIR}/${pkgbase}" >/dev/null

		found_source=false
		for pkgarch in ${ARCHES[@]} 'any'; do
			svnrepo_from="${WORKDIR}/${pkgbase}/testing-${pkgarch}"
			if [ -r "${svnrepo_from}/PKGBUILD" ]; then
				found_source=true
				break
			fi
		done
		${found_source} || die "${pkgbase} not found in [testing]"
		found_target=false
		for pkgarch in ${ARCHES[@]} 'any'; do
			for repo in 'core' 'extra'; do
				svnrepo_to="${WORKDIR}/${pkgbase}/${repo}-${pkgarch}"
				if [ -r "${svnrepo_to}/PKGBUILD" ]; then
					found_target=true
					pkgs[${repo}]+="${pkgbase} "
					break 2
				fi
			done
		done
		${found_target} || die "${pkgbase} neither found in [core] nor [extra]"
	fi
done

for pkgarch in ${ARCHES[@]}; do
	repo_unlock 'testing' ${pkgarch}
done
for repo in  'core' 'extra'; do
	for pkgarch in ${ARCHES[@]}; do
		repo_unlock ${repo} ${pkgarch}
	done
	if [ -n "${pkgs[${repo}]}" ]; then
		"$(dirname $0)/db-move" 'testing' "${repo}" ${pkgs[${repo}]}
	fi
done

script_unlock