From 26d4f804d8cd1dc194d79fef925a945beb552223 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 31 Jan 2014 11:05:29 -0500 Subject: [PATCH] devscript: hoist $tmpdir to make clear it is shared between functions --- developer/bin/list_apps_in_pkg | 3 ++- developer/bin/list_ids_in_pkg | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/developer/bin/list_apps_in_pkg b/developer/bin/list_apps_in_pkg index a0953da800..4e7e536d6d 100755 --- a/developer/bin/list_apps_in_pkg +++ b/developer/bin/list_apps_in_pkg @@ -9,6 +9,7 @@ shopt -s nocasematch # case-insensitive regular expressions opt_lax='' opt_pkg='' +tmpdir='' warn () { local message="$@" @@ -105,7 +106,7 @@ See CONTRIBUTING.md and 'man pkgutil' for more information. _list_apps_in_pkg () { - local tmpdir=`/usr/bin/mktemp -d -t list_apps_in_pkg` + tmpdir=`/usr/bin/mktemp -d -t list_apps_in_pkg` trap "/bin/rm -rf '$tmpdir'" EXIT /usr/sbin/pkgutil --expand "$opt_pkg" "$tmpdir/unpack" diff --git a/developer/bin/list_ids_in_pkg b/developer/bin/list_ids_in_pkg index c7e4e97413..292d942658 100755 --- a/developer/bin/list_ids_in_pkg +++ b/developer/bin/list_ids_in_pkg @@ -7,6 +7,8 @@ set -e # exit on any uncaught error set +o histexpand # don't expand history expressions shopt -s nocasematch # case-insensitive regular expressions +tmpdir='' + bundle_id_source_1 () { /usr/bin/find "$tmpdir" -name PackageInfo -print0 | \ /usr/bin/xargs -0 /usr/bin/perl -0777 -ne \ @@ -30,7 +32,7 @@ mark_up_sources () { _list_ids_in_pkg () { - local tmpdir=`/usr/bin/mktemp -d -t list_ids_in_pkg` + tmpdir=`/usr/bin/mktemp -d -t list_ids_in_pkg` trap "/bin/rm -rf '$tmpdir'" EXIT /usr/sbin/pkgutil --expand "$1" "$tmpdir/unpack"