added experimental PKGBUILD parser
authorHarvie <tomas@mudrunka.cz>
Mon, 23 Aug 2010 22:54:05 +0000 (00:54 +0200)
committerHarvie <tomas@mudrunka.cz>
Mon, 23 Aug 2010 22:54:05 +0000 (00:54 +0200)
bash/pkgbuild-parser.sh [new file with mode: 0755]

diff --git a/bash/pkgbuild-parser.sh b/bash/pkgbuild-parser.sh
new file mode 100755 (executable)
index 0000000..94a72bc
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+echo '<?php'
+. PKGBUILD
+
+get_function() {
+       export -f "$1" || exit 1;
+       bash -c 'env' | tr '\n' '\0' | sed 's/.*'"$1"'=() {\(.*\)}.*/\1/g' | tr '\0' '\n'
+}
+
+echo '$packages=array('
+echo "${pkgname[*]}" | egrep -o '[a-z0-9-]'* | while read pkg; do echo "'$pkg', "; done
+echo ');'
+
+echo "${pkgname[*]}" | egrep -o '[a-z0-9-]'* | while read pkg; do
+       get_function package_"$pkg" | while read i; do eval "$i" &>/dev/null; echo '$pkgdescs['"'$pkg']='$pkgdesc';"; done | tail -n1
+done;
+
This page took 0.088007 seconds and 4 git commands to generate.