summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-05-05 03:38:33 +0200
committerJudd Vinet <judd@archlinux.org>2006-05-05 03:38:33 +0200
commit2d8cc96bf6eada340975827b8f631496da79e63b (patch)
tree71d8cbf87f55dc14f29b3984cb9721b9f5a55d4d
parentf3d8a756a29d26d91bfe191e717b2a656d39c176 (diff)
downloaddbscripts-2d8cc96bf6eada340975827b8f631496da79e63b.tar.gz
dbscripts-2d8cc96bf6eada340975827b8f631496da79e63b.tar.xz
updates for multi-architecture support
-rwxr-xr-xdb-arch4
-rwxr-xr-xdb-arch6418
-rwxr-xr-xdb-extra4
-rwxr-xr-xdb-extra6418
-rw-r--r--db-inc52
-rwxr-xr-xdb-testing12
-rwxr-xr-xdb-unstable4
-rwxr-xr-xdb-unstable6418
-rwxr-xr-xgenpkglist10
-rwxr-xr-xupdatesync-many16
10 files changed, 118 insertions, 38 deletions
diff --git a/db-arch b/db-arch
index e348228..9b61eee 100755
--- a/db-arch
+++ b/db-arch
@@ -1,13 +1,15 @@
#!/bin/bash
-# $Id: db-arch,v 1.23 2006/02/20 06:33:40 judd Exp $
+# $Id: db-arch,v 1.24 2006/05/05 01:38:33 judd Exp $
repoid=1
reponame="current"
+arch="i686"
ftppath="/home/ftp/current/os/i686"
cvspath="/home/cvs-arch"
cvsmod="arch/build"
+cvstag="CURRENT"
stagedir="$HOME/staging/arch"
diff --git a/db-arch64 b/db-arch64
new file mode 100755
index 0000000..ac2cbb1
--- /dev/null
+++ b/db-arch64
@@ -0,0 +1,18 @@
+#!/bin/bash
+# $Id: db-arch64,v 1.1 2006/05/05 01:38:33 judd Exp $
+
+repoid=1
+reponame="current"
+arch="x86_64"
+
+ftppath="/home/ftp/current/os/x86_64"
+
+cvspath="/home/cvs-arch"
+cvsmod="arch/build"
+cvstag="CURRENT-64"
+
+stagedir="/home/arch64/staging/arch"
+
+# call the real script
+. `dirname $0`/db-inc
+
diff --git a/db-extra b/db-extra
index 5ee7564..c24a26f 100755
--- a/db-extra
+++ b/db-extra
@@ -1,13 +1,15 @@
#!/bin/bash
-# $Id: db-extra,v 1.12 2006/02/20 06:33:40 judd Exp $
+# $Id: db-extra,v 1.13 2006/05/05 01:38:33 judd Exp $
repoid=2
reponame="extra"
+arch="i686"
ftppath="/home/ftp/extra/os/i686"
cvspath="/home/cvs-extra"
cvsmod="extra"
+cvstag="CURRENT"
stagedir="$HOME/staging/extra"
diff --git a/db-extra64 b/db-extra64
new file mode 100755
index 0000000..8dce59b
--- /dev/null
+++ b/db-extra64
@@ -0,0 +1,18 @@
+#!/bin/bash
+# $Id: db-extra64,v 1.1 2006/05/05 01:38:33 judd Exp $
+
+repoid=2
+reponame="extra"
+arch="x86_64"
+
+ftppath="/home/ftp/extra/os/x86_64"
+
+cvspath="/home/cvs-extra"
+cvsmod="extra"
+cvstag="CURRENT-64"
+
+stagedir="/home/arch64/staging/extra"
+
+# call the real script
+. `dirname $0`/db-inc
+
diff --git a/db-inc b/db-inc
index 99cbcee..5e2eff0 100644
--- a/db-inc
+++ b/db-inc
@@ -1,10 +1,10 @@
-# $Id: db-inc,v 1.4 2006/02/20 06:33:40 judd Exp $
+# $Id: db-inc,v 1.5 2006/05/05 01:38:33 judd Exp $
[ "$UID" = "" ] && UID=`uid`
-TMPDIR="/tmp/archpkg.$repoid.$UID"
+TMPDIR="/tmp/archpkg.$arch.$repoid.$UID"
# where are the arch scripts located?
-ARCHDIR="/arch-new"
+ARCHDIR="/arch"
if [ ! `type -p fakeroot` ]; then
echo "error: fakeroot is missing" >&2
@@ -19,7 +19,7 @@ fi
cleanup() {
rm -rf $TMPDIR
# unlock
- rm -f /tmp/.repolck.$repoid
+ rm -f /tmp/.repolck.$arch.$repoid
[ "$1" ] && exit $1
}
@@ -34,8 +34,8 @@ die() {
}
# check for locks
-if [ -f /tmp/.repolck.$repoid ]; then
- owner=`/bin/ls -l /tmp/.repolck.$repoid | awk '{print $3}'`
+if [ -f /tmp/.repolck.$arch.$repoid ]; then
+ owner=`/bin/ls -l /tmp/.repolck.$arch.$repoid | awk '{print $3}'`
echo "error: db generation is already in progress (started by $owner)"
exit 1
fi
@@ -43,7 +43,7 @@ fi
# catch ^C breaks
trap ctrl_c SIGINT
# lock
-touch /tmp/.repolck.$repoid
+touch /tmp/.repolck.$arch.$repoid
# RedHat's mktemp is broken...
if [ -d $TMPDIR ]; then
@@ -61,8 +61,8 @@ if [ "`ls $stagedir/add`" -o "`ls $stagedir/del`" ]; then
if [ "$cvsdir" ]; then
mv $cvsdir $TMPDIR/$cvsmod
else
- echo "==> Checking out module: $cvsmod"
- CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:$cvspath cvs -q export -r CURRENT $cvsmod
+ echo "==> Checking out module: $cvsmod ($cvstag)"
+ CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:$cvspath cvs -q export -r $cvstag $cvsmod
if [ $? -gt 0 ]; then
die "==> CVS export failed!"
fi
@@ -81,7 +81,7 @@ fi
# This means the sync db could actually be unpacked/repacked twice in
# one db-* invocation, but it's not a huge performance hit.
-if [ "`ls $stagedir/add`" ]; then
+if [ -d $stagedir/add -a "`ls $stagedir/add`" ]; then
cd $TMPDIR
echo "==> Processing new/updated packages for repository '$reponame'..." >&2
@@ -99,15 +99,18 @@ if [ "`ls $stagedir/add`" ]; then
cp $TMPDIR/$reponame.db.tar.gz $ftppath
- echo "==> Scanning for New/Updated packages..." >&2
- cd $stagedir/add
- $ARCHDIR/pkgdb1 $TMPDIR/$cvsmod | $ARCHDIR/pkgdb2-add $repoid $stagedir/add
+ # only for i686 (for now)
+ if [ "$arch" = "i686" ]; then
+ echo "==> Scanning for New/Updated packages..." >&2
+ cd $stagedir/add
+ $ARCHDIR/pkgdb1 $TMPDIR/$cvsmod | $ARCHDIR/pkgdb2-add $repoid $stagedir/add
+ fi
# move the package files into the ftp directory
mv -f $stagedir/add/*.pkg.tar.gz $ftppath
fi
-if [ "`ls $stagedir/del`" ]; then
+if [ -d $stagedir/del -a "`ls $stagedir/del`" ]; then
cd $TMPDIR
echo "==> Processing deleted packages for repository '$reponame'..." >&2
@@ -125,14 +128,17 @@ if [ "`ls $stagedir/del`" ]; then
cp $TMPDIR/$reponame.db.tar.gz $ftppath
- echo "==> Scanning for Deleted packages..." >&2
- cd $stagedir/del
- (
- for i in *.pkg.tar.gz; do
- pkgname=${i%-*-*}
- echo $pkgname
- done
- ) | $ARCHDIR/pkgdb2-del $repoid $stagedir/del
+ # only for i686 (for now)
+ if [ "$arch" = "i686" ]; then
+ echo "==> Scanning for Deleted packages..." >&2
+ cd $stagedir/del
+ (
+ for i in *.pkg.tar.gz; do
+ pkgname=${i%-*-*}
+ echo $pkgname
+ done
+ ) | $ARCHDIR/pkgdb2-del $repoid $stagedir/del
+ fi
# remove the package files
rm -f $stagedir/del/*.pkg.tar.gz
@@ -141,7 +147,7 @@ fi
if [ "$updatelists" ]; then
echo "==> Generating Text Package List..." >&2
cd $TMPDIR/$cvsmod
- $ARCHDIR/genpkglist $reponame
+ $ARCHDIR/genpkglist $ftppath
# hack -- only Current's packages.txt goes in a "setup" subdir
if [ "$reponame" = "current" ]; then
diff --git a/db-testing b/db-testing
index 97039a3..1baad46 100755
--- a/db-testing
+++ b/db-testing
@@ -1,13 +1,15 @@
#!/bin/bash
-# $Id: db-testing,v 1.12 2006/03/10 23:17:48 judd Exp $
+# $Id: db-testing,v 1.13 2006/05/05 01:38:33 judd Exp $
repoid=4
reponame="testing"
+arch="i686"
ftppath="/home/ftp/testing/os/i686"
cvspath="/home/cvs-arch"
cvsmod="testing"
+cvstag="TESTING"
stagedir="$HOME/staging/testing"
@@ -18,13 +20,13 @@ testing_cleanup() {
# catch ^C
trap testing_cleanup SIGINT
-if [ -f /tmp/.repolck.$repoid ]; then
- owner=`/bin/ls -l /tmp/.repolck.$repoid | awk '{print $3}'`
+if [ -f /tmp/.repolck.$arch.$repoid ]; then
+ owner=`/bin/ls -l /tmp/.repolck.$arch.$repoid | awk '{print $3}'`
echo "error: db generation is already in progress (started by $owner)"
exit 1
fi
# lock
-touch /tmp/.repolck.$repoid
+touch /tmp/.repolck.$arch.$repoid
# testing is special, so we have to do the CVS checkout stuff here
testingtmp=$(mktemp -d /tmp/testtmp-XXXXXX) || exit 1
@@ -46,7 +48,7 @@ if [ "`ls $stagedir/add`" -o "`ls $stagedir/del`" ]; then
fi
# unlock
-rm -f /tmp/.repolck.$repoid
+rm -f /tmp/.repolck.$arch.$repoid
# call the real script
. `dirname $0`/db-inc
diff --git a/db-unstable b/db-unstable
index 194bee5..e37e664 100755
--- a/db-unstable
+++ b/db-unstable
@@ -1,13 +1,15 @@
#!/bin/bash
-# $Id: db-unstable,v 1.17 2006/02/20 06:33:40 judd Exp $
+# $Id: db-unstable,v 1.18 2006/05/05 01:38:33 judd Exp $
repoid=3
reponame="unstable"
+arch="i686"
ftppath="/home/ftp/unstable/os/i686"
cvspath="/home/cvs-unstable"
cvsmod="unstable"
+cvstag="CURRENT"
stagedir="$HOME/staging/unstable"
diff --git a/db-unstable64 b/db-unstable64
new file mode 100755
index 0000000..38904d3
--- /dev/null
+++ b/db-unstable64
@@ -0,0 +1,18 @@
+#!/bin/bash
+# $Id: db-unstable64,v 1.1 2006/05/05 01:38:33 judd Exp $
+
+repoid=3
+reponame="unstable"
+arch="x86_64"
+
+ftppath="/home/ftp/unstable/os/x86_64"
+
+cvspath="/home/cvs-unstable"
+cvsmod="unstable"
+cvstag="CURRENT-64"
+
+stagedir="/home/arch64/staging/unstable"
+
+# call the real script
+. `dirname $0`/db-inc
+
diff --git a/genpkglist b/genpkglist
index 1d25201..7dba4d6 100755
--- a/genpkglist
+++ b/genpkglist
@@ -1,5 +1,5 @@
#!/bin/bash
-# $Id: genpkglist,v 1.13 2006/02/22 07:56:11 judd Exp $
+# $Id: genpkglist,v 1.14 2006/05/05 01:38:33 judd Exp $
#
# genpkglist
@@ -9,7 +9,7 @@
#
pkgfile="`pwd`/packages.txt"
-repodir=$1
+ftppath=$1
rm -f $pkgfile
for category in `find * -maxdepth 0 -type d | grep -v CVS`; do
@@ -18,7 +18,7 @@ for category in `find * -maxdepth 0 -type d | grep -v CVS`; do
cd $pkg
if [ -f PKGBUILD ]; then
. PKGBUILD
- if [ -f /home/ftp/$repodir/os/i686/$pkgname-$pkgver-$pkgrel.pkg.tar.gz ]; then
+ if [ -f $ftppath/$pkgname-$pkgver-$pkgrel.pkg.tar.gz ]; then
echo "$category/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" >>$pkgfile
else
echo "notice: Missing $pkgname-$pkgver-$pkgrel.pkg.tar.gz in ftp site" >&2
@@ -29,7 +29,7 @@ for category in `find * -maxdepth 0 -type d | grep -v CVS`; do
cd ..
done
-cd /home/ftp/$1/os/i686
+cd $ftppath
unset DUPES DUPEFILES last
for pkg in *.pkg.tar.gz; do
pkgname=${pkg%-*-*}
@@ -54,7 +54,7 @@ showdupes() {
}
if [ "$DUPES" ]; then
- echo "Possible Dupes for $1 (please remove old versions)"
+ echo "Possible Dupes for $ftppath (remove old versions)"
echo "Date Filename"
for dupe in $((for d in `echo $DUPES`; do echo $d; done) | sort -u); do
showdupes $dupe
diff --git a/updatesync-many b/updatesync-many
index 150cd66..3899632 100755
--- a/updatesync-many
+++ b/updatesync-many
@@ -2,8 +2,8 @@
#
# updatesync-many
#
-# Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
-# Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org>
+# Copyright (c) 2004-2006 by Jason Chu and Judd Vinet
+# Contact: <jason@archlinux.org> and <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -189,6 +189,10 @@ update_entry()
cd - >/dev/null
}
+if [ ! "`type -p lsof`" ]; then
+ echo "ERROR: lsof is needed to run updatesync-many!"
+ exit 1
+fi
if [ $# -lt 3 ]; then
usage
@@ -225,6 +229,14 @@ tar zxf $PKGDB || die "error unpacking $PKGDB"
# Process packages in the staging directory
for pkgfile in $STAGEDIR/*.pkg.tar.gz; do
+ # Make sure this file isn't currently in use by any processes...
+ # This is our cheap way of (mostly) making sure the file isn't being
+ # uploaded at this very time (and thus incomplete).
+ # Of course, if an upload failed and the scp connection terminated, then
+ # this check will fail us.
+ lsof $pkgfile &>/dev/null
+ [ $? -ne 1 ] && continue
+
tmp=${pkgfile##*/}
pkgname=${tmp%-*-*};
fullname=${tmp%.pkg.tar.gz}