As rewriting the repo db scripts is a time intensive process which
involves cleaning up the web backend too, I did a few hacks to our
current scripts to support both the pacman2 and pacman3 naming scheme.
I changed the updatesync-many, pkgdb1, db-inc and genpkglist files.
Please everyone who is familiar with the scripts (and everyone else,
because noone is actually familiar with them) look over my changes and
see if they make sense.
If no errors are found, the scripts WILL be moved from CVS to /arch and
WILL be used. So make sure I didn't screw up.
For the lazy, I attached the diff.
Index: db-inc
===================================================================
RCS file: /home/cvs-arch/arch/scripts/db-inc,v
retrieving revision 1.6
diff -u -r1.6 db-inc
--- db-inc 7 May 2006 18:02:42 -0000 1.6
+++ db-inc 14 Sep 2007 16:38:14 -0000
@@ -16,6 +16,18 @@
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 @@
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 @@
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
Index: genpkglist
===================================================================
RCS file: /home/cvs-arch/arch/scripts/genpkglist,v
retrieving revision 1.14
diff -u -r1.14 genpkglist
--- genpkglist 5 May 2006 01:38:33 -0000 1.14
+++ genpkglist 14 Sep 2007 16:38:14 -0000
@@ -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 @@
. 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 @@
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"
Index: pkgdb1
===================================================================
RCS file: /home/cvs-arch/arch/scripts/pkgdb1,v
retrieving revision 1.4
diff -u -r1.4 pkgdb1
--- pkgdb1 20 Feb 2006 06:33:40 -0000 1.4
+++ pkgdb1 14 Sep 2007 16:38:14 -0000
@@ -1,6 +1,18 @@
#!/bin/bash
# $Id: pkgdb1,v 1.4 2006/02/20 06:33:40 judd 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
@@ -16,9 +28,8 @@
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
Index: updatesync-many
===================================================================
RCS file: /home/cvs-arch/arch/scripts/updatesync-many,v
retrieving revision 1.2
diff -u -r1.2 updatesync-many
--- updatesync-many 5 May 2006 01:38:33 -0000 1.2
+++ updatesync-many 14 Sep 2007 16:38:14 -0000
@@ -1,4 +1,5 @@
#!/bin/bash
+# $Id: $
#
# updatesync-many
#
@@ -46,6 +47,18 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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