[openstack-nova] update-patches.sh: handle unexpected failures

Pádraig Brady pbrady at fedoraproject.org
Tue May 22 09:42:13 UTC 2012


commit 57bbf4ba5e5280a6d039b34866bfe88903f4bf0c
Author: Pádraig Brady <P at draigBrady.com>
Date:   Tue May 22 10:26:48 2012 +0100

    update-patches.sh: handle unexpected failures

 update-patches.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/update-patches.sh b/update-patches.sh
index 4906348..a24c659 100755
--- a/update-patches.sh
+++ b/update-patches.sh
@@ -18,6 +18,8 @@
 #   $> git push fedora-openstack +master-patches:master
 #
 
+set -e # exit on failure
+
 git status -uno --porcelain | grep . && {
     echo "The repo is not clean. Aborting" >&2
     exit 1
@@ -72,6 +74,8 @@ sed -i '/^\(Patch\|%patch\)[0-9][0-9]*/d' "${spec}"
 patches_list=$(mktemp)
 patches_apply=$(mktemp)
 
+trap "rm '${patches_list}' '${patches_apply}'" EXIT
+
 i=1;
 for p in ${new_patches}; do
     printf "Patch%.4d: %s\n" "${i}" "${p}" >> "${patches_list}"
@@ -82,8 +86,6 @@ done
 sed -i -e "/# patches_base/ { N; r ${patches_list}" -e "}" "${spec}"
 sed -i -e "/%setup -q / { N; r ${patches_apply}" -e "}" "${spec}"
 
-rm "${patches_list}" "${patches_apply}"
-
 #
 # Update the original commit to include the new set of patches
 #


More information about the scm-commits mailing list