diff options
-rwxr-xr-x | db-arch | 8 | ||||
-rwxr-xr-x | db-unstable | 5 | ||||
-rwxr-xr-x | genpkglist | 4 | ||||
-rwxr-xr-x | pkgdb | 70 |
4 files changed, 80 insertions, 7 deletions
@@ -1,18 +1,20 @@ #!/bin/bash -# $Id: db-arch,v 1.4 2003/01/24 19:27:35 judd Exp $ +# $Id: db-arch,v 1.5 2003/05/21 23:07:33 judd Exp $ echo "==> Updating ABS Tree..." >&2 cd /tmp +rm -rf arch CVSROOT=:ext:judd@cvs.archlinux.org:/home/cvs-arch cvs -q export -r CURRENT -f arch/build echo "==> Rebuilding HTML Package List..." >&2 cd /tmp/arch/build rm -f packages.txt -/root/bin/htmlpkglist arch +/arch/htmlpkglist arch mv pkgs_arch_name.html pkgs_arch_cat.html /home/sites/archlinux/htdocs/pkglists +/arch/pkgdb 1 echo "==> Generating Text Package List..." >&2 -/root/bin/genpkglist +/arch/genpkglist mv packages.txt /home/ftp/current/setup/packages.txt echo "==> Generating pacsync2 Database for ARCH..." >&2 diff --git a/db-unstable b/db-unstable index 7e3431f..4d76d9e 100755 --- a/db-unstable +++ b/db-unstable @@ -1,5 +1,5 @@ #!/bin/bash -# $Id: db-unstable,v 1.1 2003/02/24 00:54:29 judd Exp $ +# $Id: db-unstable,v 1.2 2003/05/21 23:07:33 judd Exp $ echo "==> Generating pacsync2 Database for UNSTABLE..." >&2 cd /tmp @@ -10,10 +10,11 @@ CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-unstable cvs -q export -r C echo "==> Rebuilding HTML Package List..." >&2 cd /tmp/unstable rm -f packages.txt -$HOME/htmlpkglist unstable +/arch/htmlpkglist unstable cp -f pkgs_unstable_name.html /home/sites/archlinux/htdocs/pkglists cp -f pkgs_unstable_cat.html /home/sites/archlinux/htdocs/pkglists rm pkgs_unstable_name.html pkgs_unstable_cat.html +/arch/pkgdb 3 rm -rf /tmp/unstable @@ -1,5 +1,5 @@ #!/bin/bash -# $Id: genpkglist,v 1.5 2002/11/28 08:28:13 judd Exp $ +# $Id: genpkglist,v 1.6 2003/05/21 23:07:33 judd Exp $ # # genpkglist @@ -9,7 +9,7 @@ pkgfile="`pwd`/packages.txt" -cd /usr/abs +cd /tmp/arch/build rm -f $pkgfile for category in `find * -type d -maxdepth 0 | grep -v CVS`; do cd $category @@ -0,0 +1,70 @@ +#!/bin/bash +# $Id: pkgdb,v 1.1 2003/05/21 23:07:33 judd Exp $ + +tl=`pwd` +TMPFILE=/tmp/.mysqltmp +repoid=$1 +dbuser='archweb' +dbname='archweb' +dbpass='14xuk0Gi' + +if [ "$repoid" = "" ]; then + me=`basename $0` + echo "usage: $me <repoid>" + exit 1 +fi + +echo "==> Updating Package Entries in Database..." + +for category in `find * -type d -maxdepth 0 | grep -v CVS | grep -v "^unofficial" | grep -v "^unstable"`; do + for pkg in `ls $category | sort`; do + cd $tl/$category/$pkg + if [ -f PKGBUILD ]; then + . PKGBUILD + deplist=${depends[@]} + deplist=`php -r "echo addslashes(\"$deplist\");"` + sources=${source[@]} + sources=`php -r "echo addslashes(\"$sources\");"` + pkgname=`php -r "echo addslashes(\"$pkgname\");"` + pkgver=`php -r "echo addslashes(\"$pkgver\");"` + pkgrel=`php -r "echo addslashes(\"$pkgrel\");"` + pkgdesc=`php -r "echo addslashes(\"$pkgdesc\");"` + mysql -u $dbuser -p$dbpass $dbname >$TMPFILE <<_EOF +SELECT id FROM packages WHERE repoid=$repoid AND pkgname='$pkgname'; +_EOF + id=`tail -1 $TMPFILE` + if [ "$id" != "" ]; then + mysql -u $dbuser -p$dbpass $dbname >$TMPFILE <<_EOF +SELECT pkgver,pkgrel FROM packages WHERE repoid=$repoid AND pkgname='$pkgname'; +_EOF + oldver=`tail -1 $TMPFILE | awk '{print $1}'` + oldrel=`tail -1 $TMPFILE | awk '{print $2}'` + if [ "$oldver" != "$pkgver" -o "$oldrel" != "$pkgrel" ]; then + mysql -u $dbuser -p$dbpass $dbname <<_EOF +UPDATE packages SET category='$category',pkgname='$pkgname',pkgver='$pkgver', +pkgrel='$pkgrel',pkgdesc='$pkgdesc',url='$url',sources='$sources', +depends='$deplist',lastupdate=NOW() WHERE id='$id'; +_EOF + else + mysql -u $dbuser -p$dbpass $dbname <<_EOF +UPDATE packages SET category='$category',pkgname='$pkgname',pkgver='$pkgver', +pkgrel='$pkgrel',pkgdesc='$pkgdesc',url='$url',sources='$sources', +depends='$deplist' WHERE id='$id'; +_EOF + + fi + else + mysql -u $dbuser -p$dbpass $dbname <<_EOF +INSERT INTO packages (id,repoid,category,pkgname,pkgver,pkgrel, +pkgdesc,url,sources,depends,lastupdate) VALUES (NULL,$repoid, +'$category','$pkgname','$pkgver','$pkgrel','$pkgdesc','$url', +'$sources','$deplist',NOW()); +_EOF + fi + fi + done + cd $tl +done + +rm -f $TMPFILE + |