summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2007-09-14 18:38:41 +0200
committerThomas Bächler <thomas@archlinux.org>2007-09-14 18:38:41 +0200
commita1d4355f6cae8275d4da6ee39f52095909cf11a0 (patch)
tree418cd69081e81ea1942df5bbb130eec96285d2f6
parentab3b5e0eac5c557843716ab44ba44e49603f5d65 (diff)
downloaddbscripts-a1d4355f6cae8275d4da6ee39f52095909cf11a0.tar.gz
dbscripts-a1d4355f6cae8275d4da6ee39f52095909cf11a0.tar.xz
adjusted scripts for pacman 3 naming scheme, should still work with the old one
-rw-r--r--db-inc18
-rwxr-xr-xgenpkglist21
-rwxr-xr-xpkgdb119
-rwxr-xr-xupdatesync-many31
4 files changed, 69 insertions, 20 deletions
diff --git a/db-inc b/db-inc
index a984ca9..18eecda 100644
--- a/db-inc
+++ b/db-inc
@@ -1,4 +1,4 @@
-# $Id: db-inc,v 1.6 2006/05/07 18:02:42 judd Exp $
+# $Id: db-inc,v 1.7 2007/09/14 16:38:41 thomas Exp $
[ "$UID" = "" ] && UID=`uid`
TMPDIR="/tmp/archpkg.$arch.$repoid.$UID"
@@ -16,6 +16,18 @@ if [ ! -d $stagedir ]; then
exit 1
fi
+# 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%-*-*}
+}
+
cleanup() {
rm -rf $TMPDIR
# unlock
@@ -134,7 +146,7 @@ if [ -d $stagedir/del -a "`ls $stagedir/del`" ]; then
cd $stagedir/del
(
for i in *.pkg.tar.gz; do
- pkgname=${i%-*-*}
+ pkgname=$(getpkgname $i)
echo $pkgname
done
) | $ARCHDIR/pkgdb2-del $repoid $stagedir/del
@@ -147,7 +159,7 @@ fi
if [ "$updatelists" ]; then
echo "==> Generating Text Package List..." >&2
cd $TMPDIR/$cvsmod
- $ARCHDIR/genpkglist $ftppath
+ $ARCHDIR/genpkglist $ftppath $arch
# hack -- only Current's packages.txt goes in a "setup" subdir
if [ "$reponame" = "current" ]; then
diff --git a/genpkglist b/genpkglist
index 7dba4d6..79224d8 100755
--- a/genpkglist
+++ b/genpkglist
@@ -1,5 +1,5 @@
#!/bin/bash
-# $Id: genpkglist,v 1.14 2006/05/05 01:38:33 judd Exp $
+# $Id: genpkglist,v 1.15 2007/09/14 16:38:41 thomas Exp $
#
# genpkglist
@@ -8,8 +8,21 @@
# (also used to check for missing packages in the download directory)
#
+# 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%-*-*}
+}
+
pkgfile="`pwd`/packages.txt"
ftppath=$1
+dbarch=$2
rm -f $pkgfile
for category in `find * -maxdepth 0 -type d | grep -v CVS`; do
@@ -20,8 +33,10 @@ for category in `find * -maxdepth 0 -type d | grep -v CVS`; do
. PKGBUILD
if [ -f $ftppath/$pkgname-$pkgver-$pkgrel.pkg.tar.gz ]; then
echo "$category/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" >>$pkgfile
+ elif [ -f $ftppath/$pkgname-$pkgver-$pkgrel-$dbarch.pkg.tar.gz ]; then
+ echo "$category/$pkgname-$pkgver-$pkgrel-$dbarch.pkg.tar.gz" >>$pkgfile
else
- echo "notice: Missing $pkgname-$pkgver-$pkgrel.pkg.tar.gz in ftp site" >&2
+ echo "notice: Missing $pkgname-$pkgver-$pkgrel-$dbarch.pkg.tar.gz in ftp site" >&2
fi
fi
cd ..
@@ -32,7 +47,7 @@ done
cd $ftppath
unset DUPES DUPEFILES last
for pkg in *.pkg.tar.gz; do
- pkgname=${pkg%-*-*}
+ pkgname=$(getpkgname $pkg)
if [ "$last" = "$pkgname" ]; then
DUPES="$DUPES $pkgname"
DUPEFILES="$DUPEFILES $pkg"
diff --git a/pkgdb1 b/pkgdb1
index 5b2f09a..2c86ef8 100755
--- a/pkgdb1
+++ b/pkgdb1
@@ -1,5 +1,17 @@
#!/bin/bash
-# $Id: pkgdb1,v 1.4 2006/02/20 06:33:40 judd Exp $
+# $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`
@@ -16,9 +28,8 @@ fi
cd $STAGEDIR
for pkgfile in `ls $STAGEDIR/*.pkg.tar.gz`; do
- tmp=${pkgfile##*/}
- pkgname=${tmp%-*-*};
- fullname=${tmp%.pkg.tar.gz}
+ pkgname=$(getpkgname $pkgfile);
+ fullname=$(basename $pkgfile)
# find the matching PKGBUILD
tmpf=$(mktemp /tmp/pkgdb1.XXXXXXXXXX) || exit 1
find $ABSDIR -type d -name "$pkgname" >$tmpf
diff --git a/updatesync-many b/updatesync-many
index 3899632..7833944 100755
--- a/updatesync-many
+++ b/updatesync-many
@@ -1,4 +1,5 @@
#!/bin/bash
+# $Id: updatesync-many,v 1.3 2007/09/14 16:38:41 thomas Exp $
#
# updatesync-many
#
@@ -46,6 +47,18 @@ msg()
echo "updatesync-many: $*" >&2
}
+# 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%-*-*}
+}
+
check_option() {
local i
for i in ${options[@]}; do
@@ -76,6 +89,9 @@ db_write_entry()
cd $pkgname-$pkgver-$pkgrel
# desc
: >desc
+ echo "%FILENAME%" >>desc
+ echo "$2" >>desc
+ echo "" >>desc
echo "%NAME%" >>desc
echo "$pkgname" >>desc
echo "" >>desc
@@ -138,10 +154,8 @@ db_write_entry()
delete_entry()
{
- # strip to the basename
- tmp=${1##*/}
# grab the pkgname
- pkgname=${tmp%-*-*}
+ pkgname=$(getpkgname $1)
for i in *; do
if [ "${i%-*-*}" = "$pkgname" ]; then
rm -rf $i
@@ -152,9 +166,8 @@ delete_entry()
update_entry()
{
pkgfile=$1
- tmp=${pkgfile##*/}
- pkgname=${tmp%-*-*};
- fullname=${tmp%.pkg.tar.gz}
+ pkgname=$(getpkgname ${pkgfile})
+ fullname=$(basename ${pkgfile})
# find the matching PKGBUILD
tmpf=$(mktemp /tmp/updatesync-many.XXXXXXXXXX) || exit 1
@@ -185,7 +198,7 @@ update_entry()
pkgmd5sum=`get_md5checksum $pkgfile`
[ -z $pkgmd5sum ] && die "error generating checksum for $pkgfile"
- db_write_entry $pkgbuild || die "error writing entry for $pkgname"
+ db_write_entry ${pkgbuild} ${fullname} || die "error writing entry for $pkgname"
cd - >/dev/null
}
@@ -237,9 +250,7 @@ for pkgfile in $STAGEDIR/*.pkg.tar.gz; do
lsof $pkgfile &>/dev/null
[ $? -ne 1 ] && continue
- tmp=${pkgfile##*/}
- pkgname=${tmp%-*-*};
- fullname=${tmp%.pkg.tar.gz}
+ pkgname=$(getpkgname ${pkgfile})
if [ "$ACTION" = "del" ]; then
msg "Deleting entry: $pkgname"
delete_entry $pkgfile