summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2012-06-01 19:34:51 +0200
committerJustin Davis <jrcd83@gmail.com>2012-06-01 19:34:51 +0200
commit29be38d2671db067c86e07fa6177cd14055a32ea (patch)
tree5e5dbe6b0276c76d93990af7f5ba2aa0f058da37 /bin
parentb3fb393e03a885c07647f23d1c54ad60a2adec3a (diff)
downloadgenpkg-29be38d2671db067c86e07fa6177cd14055a32ea.tar.gz
genpkg-29be38d2671db067c86e07fa6177cd14055a32ea.tar.xz
Fix error handling when prepkg fails.
Typo fixed in prepkg. Do not duplicate pkgver unless we are going to modify the package. Pipes screw up the error code returned. vervar silently ignores a missing _ver field.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/genpkg16
-rwxr-xr-xbin/prepkg2
-rwxr-xr-xbin/vervar6
3 files changed, 10 insertions, 14 deletions
diff --git a/bin/genpkg b/bin/genpkg
index ef78e29..047a07f 100755
--- a/bin/genpkg
+++ b/bin/genpkg
@@ -104,20 +104,20 @@ do
# Duplicate the version in case modpkg modifies it. vervar will remove a
# redundant ver field that is the same as pkgver.
trap 'rm -f PKGDATA' 1 2 15
- if PREPSPATH="$prepd" PKGVAR="$vard" prepkg "$pkg" | dupver > PKGDATA
- then
- echo "$pkgd/$pkg"
- else
- rm PKGDATA
- exit "$?"
- fi
+ PREPSPATH="$prepd" PKGVAR="$vard" prepkg "$pkg" > PKGDATA
+ ret=$?
+ case $ret in
+ 0) echo "$pkgd/$pkg" ;;
+ *) rm PKGDATA
+ exit $ret
+ esac
trap '' 1 2 15
mod="$modsd/$pkg"
if [ -f "$mod" -a -r "$mod" ]
then
trap 'rm -f PKGDATA.new' 1 2 15
- if modpkg "$mod" < PKGDATA > PKGDATA.new
+ if cat PKGDATA | dupver | modpkg "$mod" > PKGDATA.new
then
echo "Modified with $mod." 1>&2
mv PKGDATA.new PKGDATA
diff --git a/bin/prepkg b/bin/prepkg
index 11df1fa..0b456d8 100755
--- a/bin/prepkg
+++ b/bin/prepkg
@@ -44,7 +44,7 @@ do
exit 0 ;;
1) err "$flav encountered an error" ;;
2) ;; # loop
- *) err "$flav returned error code $metaret" ;;
+ *) err "$flav returned error code $prepret" ;;
esac
done
diff --git a/bin/vervar b/bin/vervar
index ce907da..480d98f 100755
--- a/bin/vervar
+++ b/bin/vervar
@@ -26,12 +26,8 @@ END {
if(error) {
exit(error)
}
- if(!ver){
- print prog ": error: ver field is missing (or zero)" | "cat 1>&2"
- exit(1)
- }
- if("" pkgver == ver){
+ if(!ver || "" pkgver == ver){
# Don't use the $_ver variable if $pkgver and $_ver are identical.
skipver = 1
vervar = "pkgver"