summaryrefslogtreecommitdiffstats
path: root/pkgdb1
blob: 5b2f09ad6605b04dbd06d43af65e8d4adc52c0df (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
#!/bin/bash
# $Id: pkgdb1,v 1.4 2006/02/20 06:33:40 judd Exp $

STAGEDIR=`pwd`

ABSDIR=$1
if [ "$ABSDIR" = "" ]; then
	me=`basename $0`
	echo "usage: $me <abs_dir>" >&2
	exit 1
fi

if [ ! "`ls $STAGEDIR/*.pkg.tar.gz 2>/dev/null`" ]; then
	exit
fi

cd $STAGEDIR
for pkgfile in `ls $STAGEDIR/*.pkg.tar.gz`; do
	tmp=${pkgfile##*/}
	pkgname=${tmp%-*-*};
	fullname=${tmp%.pkg.tar.gz}
	# find the matching PKGBUILD
	tmpf=$(mktemp /tmp/pkgdb1.XXXXXXXXXX) || exit 1
	find $ABSDIR -type d -name "$pkgname" >$tmpf
	if [ "`cat $tmpf | wc -l`" != "1" ]; then
		echo "WARNING: could not find PKGBUILD for $pkgname, cannot update this entry" >&2
		rm $tmpf
		continue
	fi
	pkgbuild="`cat $tmpf`/PKGBUILD"
	rm $tmpf
	if [ ! -f $pkgbuild ]; then
		echo "WARNING: could not find PKGBUILD for $fullname, cannot update this entry" >&2
		continue
	fi
	# pick out the category from the pathname
	catpath=$(cd `dirname $pkgbuild`/.. && pwd)
	category=${catpath##*/}
	# now read the PKGBUILD and output the data for pkgdb2
  unset pkgname pkgver pkgrel pkgdesc license groups provides md5sums force
  unset replaces depends conflicts backup source install build makedepends
  unset options
	source $pkgbuild || continue

	deplist=${depends[@]}
	sources=${source[@]}
	echo $pkgname
	echo $pkgver
	echo $pkgrel
	echo $pkgdesc
	echo $category
	echo $url
	echo $sources
	echo $deplist
done

exit 0