summaryrefslogtreecommitdiffstats
path: root/gen-perl-pkg
blob: 46e5d1866259faa57e0fe909826bc015c47e5522 (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
#!/bin/bash
set -e

for pkg in "$@"; do
	export MAINTAINER="Florian Pritz <bluewind@xinu.at>"
	targets=(~/arch/{community,extra})
	target_new=~/arch/community
	found_pkg=0

	genpkg "$pkg"

	for target in "${targets[@]}"; do
		if [[ -f "$target/$pkg/trunk/PKGBUILD" ]]; then
			found_pkg=1
			vimdiff "$target/$pkg/trunk/PKGBUILD" "$HOME/pkg/dest/$pkg/PKGBUILD"
		fi
	done

	if ((!found_pkg)); then
		if [[ $PWD =~ ($HOME/arch/(community|extra)).* ]]; then
			target_new="${BASH_REMATCH[1]}"
			echo "Found target directory $target_new"
		fi

		echo "Package not found, creating new in '$target_new/$pkg/trunk'"
		mkdir -p "$target_new/$pkg/"{trunk,repos}
		cp "$HOME/pkg/dest/$pkg/PKGBUILD" "$target_new/$pkg/trunk/"
		cd "$target_new"
		svn add "$pkg"
	fi
done