summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2012-04-16 01:41:19 +0200
committerJustin Davis <jrcd83@gmail.com>2012-04-16 01:41:19 +0200
commit5906da30cf09d00481d7e000dfac9149a7715cf2 (patch)
tree6dbf44f48598d4c0272168aa56b5bb9a5b3f37e2 /bin
parentbdd04c88ba2bad905134a835dc794d273bd7bf97 (diff)
downloadgenpkg-5906da30cf09d00481d7e000dfac9149a7715cf2.tar.gz
genpkg-5906da30cf09d00481d7e000dfac9149a7715cf2.tar.xz
Generate .install files from genpkg as well.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/genpkg36
1 files changed, 33 insertions, 3 deletions
diff --git a/bin/genpkg b/bin/genpkg
index 01642c2..0aabe3d 100755
--- a/bin/genpkg
+++ b/bin/genpkg
@@ -27,10 +27,11 @@ mergefile()
case "$?" in
0) ;;
- 101) echo "$prog: error: missing file in PKGTREE: $fname" 1>&2
+ 101) rm "$fname.$$"
return 101 ;;
102) continue ;; # empty section so don't echo a newline below
*) echo "$prog: unknown error from getpkgtree: $?" 1>&2
+ rm "$fname.$$"
return 1 ;;
esac
@@ -47,6 +48,16 @@ mergefile()
fi
}
+scanfield()
+{
+ awk -v fld="$1" '
+BEGIN { FS = "\n"; RS = "" }
+$1 = fld { print $2; found = 1; exit }
+END { exit !found }
+'
+ return $?
+}
+
if [ $# -lt 1 ]
then
echo "usage: $prog [package name]" 1>&2
@@ -94,10 +105,29 @@ do
# echo "Modified metapackage." 1>&2
#fi
+ # Insert PKGBUILD fields into prefix of PKGBUILD body.
cat PKGDATA | injectdigs | pbfields | putpkgtree PKGBUILD prefix body || exit "$?"
- mergefile PKGBUILD prefix build check package suffix || exit "$?"
- if ! [ "$GENPKGDBG" ] then
+ # Merge split PKGTREE files into their own separate text files.
+ mergefile PKGBUILD prefix build check package suffix
+ case $? in
+ 0) ;;
+ 101) echo "$PROG: error: missing PKGBUILD file in PKGTREE" 1>&2
+ exit 101 ;;
+ *) exit $?
+ esac
+
+ pkgname=`scanfield pkgname < PKGDATA`
+ if [ $? -ne 0 ]
+ then
+ echo "$PROG: pkgname missing from generated PKGDATA" 1>&2
+ exit 1
+ fi
+ # Ignore errors when merging .install file. We don't mind missing it.
+ mergefile "$pkgname.install" pre_install post_install pre_upgrade post_upgrade
+
+ if ! [ "$GENPKGDBG" ]
+ then
rm -rf PKGTREE
rm PKGDATA
fi