summaryrefslogtreecommitdiffstats
path: root/db-testing
blob: d0991a7bcdbe4d5dd28a0070f06d4fbb180019b4 (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
#!/bin/bash
# $Id: db-testing,v 1.6 2004/07/03 20:28:11 judd Exp $

uid=`id -u`
repoid=4
TMPDIR="/tmp/archpkg.$repoid.$uid"

cleanup() {
	rm -rf $TMPDIR
	# unlock
	rm -f /tmp/.repolck.$repoid
	exit 0
}

# check for locks
if [ -f /tmp/.repolck.$repoid ]; then
	owner=`/bin/ls -l /tmp/.repolck.$repoid | awk '{print $3}'`
	echo "error: db generation is already in progress (started by $owner)"
	exit 1
fi
if [ -d /tmp/.gensync ]; then
	echo "error: someone else is currently running gensync!"
	exit 1
fi

# catch ^C breaks
trap cleanup SIGINT
# lock
touch /tmp/.repolck.$repoid

# RedHat's mktemp is broken...
if [ -d $TMPDIR ]; then
	echo "==> Removing old temp dir..." >&2
	rm -rf $TMPDIR || exit 1
fi
mkdir $TMPDIR; [ $? -gt 0 ] && exit 1

echo "==> Generating Pacman Database for TESTING..." >&2
cd $TMPDIR
echo "--- CURRENT ---"
CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-arch cvs -q export -r TESTING arch
mv arch/build/* . && rm -rf arch
echo "--- EXTRA ---"
CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-extra cvs -q export -r TESTING extra
cp -a extra/* . && rm -rf extra
echo "--- UNSTABLE ---"
CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-unstable cvs -q export -r TESTING unstable
cp -a unstable/* . && rm -rf unstable
# check again
if [ -d /tmp/.gensync ]; then
	echo "error: someone else is currently running gensync!"
	exit 1
fi
/usr/bin/gensync $TMPDIR $TMPDIR/testing.db.tar.gz /home/ftp/testing/os/i686
[ -f $TMPDIR/testing.db.tar.gz ] && mv -f $TMPDIR/testing.db.tar.gz /home/ftp/testing/os/i686

echo "==> Scanning for New/Updated/Deleted packages..." >&2
cd $TMPDIR
/arch/pkgdb1 $repoid | /arch/pkgdb2 $repoid

echo "==> Generating Text Package List..." >&2
/arch/genpkglist testing

cleanup