summaryrefslogtreecommitdiffstats
path: root/pushpkgs
blob: 1605f4ff19a81046af84e35a315864e9d9233f15 (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
#!/bin/sh

prependid()
{
	sed -e '/^#/!{
	i\
\# $Id$
	:loop
	n
	b loop
	}' PKGBUILD >PKGBUILD.new
	mv PKGBUILD.new PKGBUILD
}

# Make sure that the package directories are added to the SVN repo.
syncsvn()
{
	svn add --parents PKGBUILD ../repos
	# Make sure that the Id keyword-property is active.
	svn propset svn:keywords Id PKGBUILD
}


if [ -z "$REPODIR" ]
then
	echo "Specify the destination directory with the REPODIR env var." 1>&2
	exit 1
fi

[ "$PKGDEST" ] || PKGDEST=~/pkg/dest

cd "$PKGDEST" || exit $?
pkgdir=$(pwd)

for pkg
do
	if [ ! -d "$pkg" ]
	then
		echo "pkg/$pkg was not found." 1>&2
		continue
	fi

	echo "$REPODIR/$pkg"
	if [ -d "$REPODIR/$pkg" ]
	then
		rm -rf "$REPODIR/$pkg/trunk/"*
	fi

	mkdir -p "$REPODIR/$pkg/"{trunk,repos}
	cp -r -t "$REPODIR/$pkg/trunk" "$pkg"/* 

	cd "$REPODIR/$pkg/trunk"
	prependid
	syncsvn >/dev/null 2>&1

	cd "$pkgdir"
done