summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2011-08-21 17:50:38 +0200
committerJustin Davis <jrcd83@gmail.com>2011-08-21 17:50:38 +0200
commitbdcf7ca97a41bf34f3985e0ac865b4a4a6b8d0a4 (patch)
tree01dfe981170b6994a75f8f0d8636cf2f526b9f27 /bin
parent8379b1523ba2ac19f75ffdc68ce3cb32f0b31c6f (diff)
downloadgenpkg-bdcf7ca97a41bf34f3985e0ac865b4a4a6b8d0a4.tar.gz
genpkg-bdcf7ca97a41bf34f3985e0ac865b4a4a6b8d0a4.tar.xz
Change pbj to accept multiple argument and loop over them.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pbj55
1 files changed, 31 insertions, 24 deletions
diff --git a/bin/pbj b/bin/pbj
index d232acc..1d46d31 100755
--- a/bin/pbj
+++ b/bin/pbj
@@ -7,6 +7,33 @@ die() {
exit 1
}
+pbjtopkg()
+{
+ pkg=$1
+ rm -rf "$pkgroot/$pkg"
+ mkdir "$pkgroot/$pkg"
+ cd "$pkgroot/$pkg"
+
+ jamfile="$jamdir/$1.pbj"
+ if [ ! -f "$jamfile" ] ; then
+ die "$jamfile is missing"
+ fi
+
+ # Match the pkgname to the .pbj filename.
+ # Provide values for other things macros won't be able to.
+ printf "+ pkgname $pkg\n+ pkgrel ${PKGREL:-1}\n+ pbjver $VERSION\n" \
+ | cat - "$jamfile" \
+ | awk -v packager="${PACKAGER:-Anonymous}" -f "$bindir/pbjparse.awk" \
+ > PKGBUILD
+
+ if [ $? -ne 0 ] ; then
+ echo "Failed to write $pkgroot/$pkg/PKGBUILD"
+ exit $?
+ fi
+
+ echo "Wrote $pkgroot/$pkg/PKGBUILD."
+}
+
if [ -z "$1" ] ; then
die "Usage: $0 [package name]"
fi
@@ -36,29 +63,9 @@ if [ ! -d "$jamdir" ] ; then
die "$jamdir does not exist"
fi
-jamfile="$jamdir/$1.pbj"
-if [ ! -f "$jamfile" ] ; then
- die "$jamfile is missing"
-fi
-
-pkg=$1
-rm -rf "$pkgroot/$pkg"
-mkdir "$pkgroot/$pkg"
-cd "$pkgroot/$pkg"
-
export PATH="$PATH:$bindir/macros:$bindir/templ"
-# Match the pkgname to the .pbj filename.
-# Provide values for other things macros won't be able to.
-printf "+ pkgname $pkg\n+ pkgrel ${PKGREL:-1}\n+ pbjver $VERSION\n" \
- | cat - "$jamfile" \
- | awk -v packager="$PACKAGER" -f "$bindir/pbjparse.awk" \
- > PKGBUILD
-
-if [ $? -ne 0 ] ; then
- echo "Failed to write $pkgroot/$pkg/PKGBUILD"
- exit $?
-fi
-
-echo "Wrote $pkgroot/$pkg/PKGBUILD."
-exit 0
+while [ $# -gt 0 ] ; do
+ pbjtopkg $1
+ shift
+done