blob: 789e53645c1e9e7c168f841297f859058822b8f3 (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#!/bin/bash
# Originally from Pierre's testing2extra script
if [ $# -ne 4 ]; then
echo "usage: $(basename $0) <pkgname> <repo-from> <repo-to> <arch>"
exit 1
fi
. "$(dirname $0)/db-functions"
source_makepkg
packagename="$1"
repofrom="$2"
repoto="$3"
arch="$4"
export CARCH="$arch"
ftppath_from="$FTP_BASE/$repofrom/os/$arch/"
ftppath_to="$FTP_BASE/$repoto/os/$arch/"
svnrepo_from="$repofrom-$arch"
svnrepo_to="$repoto-$arch"
[ "$UID" = "" ] && UID=$(uid)
WORKDIR="$TMPDIR/db-move.$svnrepo_from.$svnrepo_to.$UID"
cleanup() {
# unlock
repo_unlock $repoto $arch
repo_unlock $repofrom $arch
rm -rf "$WORKDIR"
[ "$1" ] && exit $1
}
ctrl_c() {
echo "Interrupted" >&2
cleanup 0
}
die() {
echo "$*" >&2
cleanup 1
}
trap ctrl_c 2
trap cleanup 0
repo_lock $repoto $arch
repo_lock $repofrom $arch
/bin/mkdir -p "$WORKDIR"
cd "$WORKDIR"
/usr/bin/svn checkout -N $SVN_PATH checkout
cd checkout
/usr/bin/svn up -q $packagename
if [ -d "$packagename/repos/$svnrepo_from" ]; then
. "$packagename/repos/$svnrepo_from/$BUILDSCRIPT"
_pkgfile="$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT"
if [ ! -f "$ftppath_from/$_pkgfile" ]; then
die "error: package file '$_pkgfile' not found in repo '$repofrom'"
fi
if [ -d "$packagename/repos/$svnrepo_to" ]; then
echo " Removing existing package from subversion"
/usr/bin/svn rm --force -q "$packagename/repos/$svnrepo_to"
/usr/bin/svn commit -q -m "$(basename $0): $packagename removed by $(id -un) for move to $repoto"
fi
echo " Moving svn entries"
/usr/bin/svn mv -r HEAD "$packagename/repos/$svnrepo_from" "$packagename/repos/$svnrepo_to"
/usr/bin/svn commit -m "$(basename $0): moved $packagename from [$repofrom] to [$repoto] ($arch)"
echo " Moving package file and updating DBs"
cd "$WORKDIR"
[ -d build/ ] || mkdir build
cd build/
# copy the db file into our working area
if [ -f "$ftppath_from/$repofrom.db.tar.$DB_COMPRESSION" ]; then
copy_helper "$ftppath_from/$repofrom.db.tar.$DB_COMPRESSION" .
else
touch "$repofrom.db.tar.$DB_COMPRESSION"
fi
/usr/bin/repo-remove "$repofrom.db.tar.$DB_COMPRESSION" $packagename || die "Error in repo-remove"
#use '*' to move the old DB too
mv $repofrom.db.tar.$DB_COMPRESSION* $ftppath_from
echo " Package files will be cleaned up automatically"
if [ -f "$ftppath_to/$repoto.db.tar.$DB_COMPRESSION" ]; then
copy_helper "$ftppath_to/$repoto.db.tar.$DB_COMPRESSION" .
else
touch "$repoto.db.tar.$DB_COMPRESSION"
fi
copy_helper "$ftppath_from/$_pkgfile" .
/usr/bin/repo-add "$repoto.db.tar.$DB_COMPRESSION" $_pkgfile || die "Error in repo-add"
#use '*' to move the old DB too
mv $repoto.db.tar.$DB_COMPRESSION* $_pkgfile $ftppath_to
else
die "Error: $packagename is not in repo $repofrom"
fi
cleanup
|