From dd9c7a967e420bd0d5ca7ce5e7fc915abe867df1 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Wed, 12 Jun 2019 23:51:09 +0200 Subject: [PATCH] xbps-src: less forking in get_subpkgs and unset_package_funcs --- common/xbps-src/shutils/common.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh index 76776fabfa0..11be7c8adfe 100644 --- a/common/xbps-src/shutils/common.sh +++ b/common/xbps-src/shutils/common.sh @@ -258,21 +258,24 @@ run_pkg_hooks() { unset_package_funcs() { local f - for f in $(typeset -F|grep -E '_package$'); do - eval unset -f $f + for f in "$(typeset -F)"; do + case "$f" in + *_package) + unset -f "$f" + ;; + esac done } get_subpkgs() { - local args list + local f - args="$(typeset -F|grep -E '_package$')" - set -- ${args} - while [ $# -gt 0 ]; do - list+=" ${3%_package}"; shift 3 - done - for f in ${list}; do - echo "$f" + for f in $(typeset -F); do + case "$f" in + *_package) + echo "${f%_package}" + ;; + esac done }