summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db-functions17
-rwxr-xr-xdb-update24
2 files changed, 32 insertions, 9 deletions
diff --git a/db-functions b/db-functions
index 25bca78..663067e 100644
--- a/db-functions
+++ b/db-functions
@@ -46,4 +46,21 @@ getpkgname() {
echo ${tmp%-*-*}
}
+check_pkg_arch () { #check_pkg_arch pkgfile arch
+ local arch
+ _arch="$(/usr/bin/bsdtar -xOf "$1" .PKGINFO | /bin/grep "^arch" | /bin/sed 's|\w*\s*=\s*\(.*\)|\1|')"
+
+ if [ -z "$_arch" ]; then
+ echo "ERROR: Package '$1' has no arch in the PKGINFO. Fail!"
+ return 1
+ fi
+ if [ "$_arch" = "$2" ]; then
+ echo "yay"
+ return 0
+ else
+ echo "nay"
+ return 1
+ fi
+}
+
# vim: set ts=4 sw=4 noet ft=sh:
diff --git a/db-update b/db-update
index 5060449..d3fff2c 100755
--- a/db-update
+++ b/db-update
@@ -108,17 +108,23 @@ if [ -n "$ADDPKGS" ]; then
for pkg in $ADDPKGS; do
_pkgfile=$(basename $pkg)
_pkgname="$(getpkgname $pkg)"
- echo " Checking SVN for $_pkgname"
- /usr/bin/svn up -q $_pkgname
- if [ -d "$_pkgname/repos/$svnrepo" ]; then
- . "$_pkgname/repos/$svnrepo/$BUILDSCRIPT"
- if [ "$_pkgfile" = "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT" ]; then
- to_add="$to_add $pkg"
+
+ echo " Validating package arch ($arch) $_pkgname"
+ if ! check_pkg_arch "$pkg" "$arch"; then
+ echo " ERROR: $_pkgfile was built for the wrong architecture"
+ else
+ echo " Checking SVN for $_pkgname"
+ /usr/bin/svn up -q $_pkgname
+ if [ -d "$_pkgname/repos/$svnrepo" ]; then
+ . "$_pkgname/repos/$svnrepo/$BUILDSCRIPT"
+ if [ "$_pkgfile" = "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT" ]; then
+ to_add="$to_add $pkg"
+ else
+ echo " WARNING: $_pkgfile does not match $BUILDSCRIPT in $svnrepo"
+ fi
else
- echo " WARNING: $_pkgfile does not match $BUILDSCRIPT in $svnrepo"
+ echo " WARNING: Package $_pkgname not found in $svnrepo"
fi
- else
- echo " WARNING: Package $_pkgname not found in $svnrepo"
fi
done