summaryrefslogtreecommitdiffstats
path: root/bin/pbj
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2011-08-14 21:15:27 +0200
committerJustin Davis <jrcd83@gmail.com>2011-08-14 21:15:27 +0200
commit01da7f81b3d6924d5a9a25d804a3905c6fd616ed (patch)
tree5483bc3d6dca6a45addae0710ce82d1410a343c4 /bin/pbj
downloadgenpkg-01da7f81b3d6924d5a9a25d804a3905c6fd616ed.tar.gz
genpkg-01da7f81b3d6924d5a9a25d804a3905c6fd616ed.tar.xz
Initial commit.
Diffstat (limited to 'bin/pbj')
-rwxr-xr-xbin/pbj58
1 files changed, 58 insertions, 0 deletions
diff --git a/bin/pbj b/bin/pbj
new file mode 100755
index 0000000..ac926b6
--- /dev/null
+++ b/bin/pbj
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+VERSION=0.01
+
+die() {
+ echo "error: $1"
+ exit 1
+}
+
+if [ -z "$1" ] ; then
+ die "Usage: $0 [package name]"
+fi
+
+if [ "$PBJROOT" ] ; then
+ cd "$PBJROOT"
+fi
+
+bindir="$(pwd)/bin"
+if [ ! -d "$bindir" ] ; then
+ die "$bindir does not exist"
+fi
+PATH="$PATH:$bindir"
+
+pkgroot="$(pwd)/pkg"
+if [ ! -d "$pkgroot" ] ; then
+ die "$pkgroot does not exist"
+fi
+
+jamdir="$(pwd)/pbj"
+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"
+
+# Provide values for things macros won't be able to.
+printf "+ pbjver $VERSION\n+ pkgrel ${PKGREL:-1}\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