summaryrefslogtreecommitdiffstats
path: root/db-update
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-08 16:03:11 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-08 16:03:11 +0200
commit830c4d84d13712974ffd392cdcc58b038c0dcfd9 (patch)
tree43ebdbef0d019de1d6dfda8a1f4a98dc94284375 /db-update
parent8a377f398ef5a01f8b52695597152c49d7a64f96 (diff)
downloaddbscripts-830c4d84d13712974ffd392cdcc58b038c0dcfd9.tar.gz
dbscripts-830c4d84d13712974ffd392cdcc58b038c0dcfd9.tar.xz
Source PKGBUILD in subshells
This patch sources a PKGBUILD in a subshells instead of directly. This way we don't polute our scope or overwrite our vars which might lead to unexpected behavior.
Diffstat (limited to 'db-update')
-rwxr-xr-xdb-update42
1 files changed, 22 insertions, 20 deletions
diff --git a/db-update b/db-update
index f971a6f..375ed02 100755
--- a/db-update
+++ b/db-update
@@ -62,23 +62,24 @@ if [ -n "$ANYPKGS" ]; then
cd checkout
to_add_any=""
for pkg in $ANYPKGS; do
- _pkgfile=$(basename $pkg)
- _pkgname="$(getpkgname $pkg)"
- _pkgbase="$(getpkgbase $pkg)"
+ pkgfile=$(basename $pkg)
+ pkgname="$(getpkgname $pkg)"
+ pkgbase="$(getpkgbase $pkg)"
svnrepo="$reponame-any"
if ! check_pkg_arch "$pkg" "any"; then
- echo " ERROR: $_pkgfile is not architecture independent!"
+ echo " ERROR: $pkgfile is not architecture independent!"
else
- /usr/bin/svn up -q $_pkgbase
- if [ -d "$_pkgbase/repos/$svnrepo" ]; then
- . "$_pkgbase/repos/$svnrepo/PKGBUILD"
- if echo "$_pkgfile" | grep -q "$_pkgname-$pkgver-$pkgrel-any"; then
+ /usr/bin/svn up -q $pkgbase
+ if [ -d "$pkgbase/repos/$svnrepo" ]; then
+ pkgver=$(. "$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgver})
+ pkgrel=$(. "$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgrel})
+ if echo "$pkgfile" | grep -q "$pkgname-$pkgver-$pkgrel-any"; then
to_add_any="$to_add_any $pkg"
else
- echo " WARNING: $_pkgfile does not match PKGBUILD in $svnrepo"
+ echo " WARNING: $pkgfile does not match PKGBUILD in $svnrepo"
fi
else
- echo " WARNING: Package $_pkgbase not found in $svnrepo"
+ echo " WARNING: Package $pkgbase not found in $svnrepo"
fi
fi
done
@@ -132,23 +133,24 @@ for current_arch in ${ARCHES[@]}; do
if [ -n "$ADDPKGS" ]; then
for pkg in $ADDPKGS; do
- _pkgfile=$(basename $pkg)
- _pkgname="$(getpkgname $pkg)"
- _pkgbase="$(getpkgbase $pkg)"
+ pkgfile=$(basename $pkg)
+ pkgname="$(getpkgname $pkg)"
+ pkgbase="$(getpkgbase $pkg)"
if ! check_pkg_arch "$pkg" "$current_arch"; then
- echo " ERROR: $_pkgfile was built for the wrong architecture"
+ echo " ERROR: $pkgfile was built for the wrong architecture"
else
- /usr/bin/svn up -q $_pkgbase
- if [ -d "$_pkgbase/repos/$svnrepo" ]; then
- . "$_pkgbase/repos/$svnrepo/PKGBUILD"
- if echo "$_pkgfile" | grep -q "$_pkgname-$pkgver-$pkgrel-$current_arch"; then
+ /usr/bin/svn up -q $pkgbase
+ if [ -d "$pkgbase/repos/$svnrepo" ]; then
+ pkgver=$(. "$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgver})
+ pkgrel=$(. "$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgrel})
+ if echo "$pkgfile" | grep -q "$pkgname-$pkgver-$pkgrel-$current_arch"; then
to_add="$to_add $pkg"
else
- echo " WARNING: $_pkgfile does not match PKGBUILD in $svnrepo"
+ echo " WARNING: $pkgfile does not match PKGBUILD in $svnrepo"
fi
else
- echo " WARNING: Package $_pkgbase not found in $svnrepo"
+ echo " WARNING: Package $pkgbase not found in $svnrepo"
fi
fi
done