Skip to content

Commit 9a1976a

Browse files
committed
[update] : Simplify package exclusion process
1 parent b9fe019 commit 9a1976a

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

tools/pkglist.sh

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ _help() {
3939
echo " --line Line break the output"
4040
}
4141

42-
# Usage: getclm <number>
43-
# 標準入力から値を受けとり、引数で指定された列を抽出します。
44-
getclm() {
45-
echo "$(cat -)" | cut -d " " -f "${1}"
46-
}
47-
4842
# Execute command for each module
4943
# It will be executed with {} replaced with the module name.
5044
# for_module <command>
@@ -213,16 +207,9 @@ fi
213207
_pkglist=($(printf "%s\n" "${_pkglist[@]}" | sort | uniq | tr "\n" " "))
214208

215209
#-- excludeに記述されたパッケージを除外 --#
216-
# _pkglistを_subpkglistにコピーしexcludeのパッケージを除外し再代入
217-
_subpkglist=(${_pkglist[@]})
218-
unset _pkglist
219-
for _pkg in ${_subpkglist[@]}; do
220-
# もし変数_pkgの値が配列_excludelistに含まれていなかったらpkglistに追加する
221-
if printf '%s\n' "${_excludelist[@]}" | grep -qx "${_pkg}" 2>&1 1> /dev/null ; then
222-
_pkglist+=("${_pkg}")
223-
fi
210+
for _pkg in "${_excludelist[@]}"; do
211+
_pkglist=($(printf "%s\n" "${_pkglist[@]}" | grep -xv "${_pkg}" | tr "\n" " "))
224212
done
225-
unset _subpkglist
226213

227214
#-- excludeされたパッケージを表示 --#
228215
if (( "${#_excludelist[@]}" >= 1 )); then
@@ -232,7 +219,6 @@ else
232219
msg_debug "No packages are excluded."
233220
fi
234221

235-
236222
OLD_IFS="${IFS}"
237223
if [[ "${line}" = true ]]; then
238224
IFS=$'\n'

0 commit comments

Comments
 (0)