summaryrefslogtreecommitdiffstats
path: root/bin/genpkg
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2012-05-14 02:40:10 +0200
committerJustin Davis <jrcd83@gmail.com>2012-05-14 02:40:10 +0200
commitaeeb51372863bd95b5126691c16851d52082ac92 (patch)
tree7be6aef8b78fcb12e266450d1307e5a9c27c28c2 /bin/genpkg
parentce30a8af59f163bc09be80955d38b56039785735 (diff)
downloadgenpkg-aeeb51372863bd95b5126691c16851d52082ac92.tar.gz
genpkg-aeeb51372863bd95b5126691c16851d52082ac92.tar.xz
Add feature to replace ver-strings with $pkgver.
Alot of logic was added to allow changing versions in mods while still preserving the version in the $_ver custom variable.
Diffstat (limited to 'bin/genpkg')
-rwxr-xr-xbin/genpkg22
1 files changed, 20 insertions, 2 deletions
diff --git a/bin/genpkg b/bin/genpkg
index b3fa6c8..470cd5f 100755
--- a/bin/genpkg
+++ b/bin/genpkg
@@ -58,6 +58,18 @@ END { exit !found }
return $?
}
+# Create an extra "ver" field in case the packager needs to modify
+# the version.
+dupver()
+{
+ awk '
+BEGIN { OFS = FS = "\n"; RS = ""; ORS = "\n\n" }
+$1 == "pkgver" { pkgver = $2 }
+1
+END { print "ver", pkgver }
+'
+}
+
if [ $# -lt 1 ]
then
echo "usage: $prog [package name]" 1>&2
@@ -98,20 +110,26 @@ do
rm PKGDATA
exit "$?"
fi
+ trap '' 1 2 15
mod="$modsd/$pkg"
if [ -f "$mod" -a -r "$mod" ]
then
- if modpkg "$mod"
+ trap 'rm PKGDATA.new' 1 2 15
+ if cat PKGDATA | dupver | modpkg "$mod" > PKGDATA.new
then
echo "Modified with $mod." 1>&2
+ mv PKGDATA.new PKGDATA
else
echo "$prog: modpkg failed." 1>&2
+ [ "$GENPKGDBG" ] || rm PKGDATA.new
fi
+ trap '' 1 2 15
fi
# Insert PKGBUILD fields into prefix of PKGBUILD body.
- cat PKGDATA | injectdigs | pbfields | putpkgtree PKGBUILD prefix body || exit "$?"
+ cat PKGDATA | vervar | injectdigs | pbfields |\
+ putpkgtree PKGBUILD prefix body || exit "$?"
# Merge split PKGTREE files into their own separate text files.
mergefile PKGBUILD prefix build check package suffix