blob: 2c86ef802926962f984665d5d02b53bf921e7746 (
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
|
#!/bin/bash
# $Id: pkgdb1,v 1.5 2007/09/14 16:38:41 thomas Exp $
# Get the package name from the filename
# hackish, but should work for now
getpkgname() {
local tmp
tmp=${1##*/}
tmp=${tmp%.pkg.tar.gz}
tmp=${tmp%-i686}
tmp=${tmp%-x86_64}
echo ${tmp%-*-*}
}
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
pkgname=$(getpkgname $pkgfile);
fullname=$(basename $pkgfile)
# 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
|