From bffec0e719db667efd1b793f8d977b6dfddcde25 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 31 Jan 2014 11:04:25 -0500 Subject: [PATCH] devscript: refactor list_ids_in_pkg into functions --- developer/bin/list_ids_in_pkg | 37 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/developer/bin/list_ids_in_pkg b/developer/bin/list_ids_in_pkg index 01afc94d9b..c7e4e97413 100755 --- a/developer/bin/list_ids_in_pkg +++ b/developer/bin/list_ids_in_pkg @@ -7,6 +7,27 @@ set -e # exit on any uncaught error set +o histexpand # don't expand history expressions shopt -s nocasematch # case-insensitive regular expressions +bundle_id_source_1 () { + /usr/bin/find "$tmpdir" -name PackageInfo -print0 | \ + /usr/bin/xargs -0 /usr/bin/perl -0777 -ne \ + 'while (m{/dev/null 2>&1 && printf " (+)"; printf "\n"' +} + _list_ids_in_pkg () { local tmpdir=`/usr/bin/mktemp -d -t list_ids_in_pkg` @@ -14,15 +35,13 @@ _list_ids_in_pkg () { /usr/sbin/pkgutil --expand "$1" "$tmpdir/unpack" - /usr/bin/find "$tmpdir" -name PackageInfo -print0 | \ - /usr/bin/xargs -0 /usr/bin/perl -0777 -ne \ - 'while (m{/dev/null 2>&1 && printf " (+)"; printf "\n"' + { + # emit strings that look like bundle ids + bundle_id_source_1; + } | \ + merge_sources | \ + clean_sources | \ + mark_up_sources }