Introduce array_append() function, in favor of inline assignments.
This commit is contained in:
parent
a23f1fdb9b
commit
176fcaecef
@ -26,6 +26,16 @@ req() {
|
||||
"${@}" || die "'${@}' failed."
|
||||
}
|
||||
|
||||
# Append the arguments to an IFS-separated list variable whose name was
|
||||
# passed as the first arg.
|
||||
array_append() {
|
||||
local varname
|
||||
varname=${1}
|
||||
shift
|
||||
|
||||
eval "set -- \${${varname}} \"\${@}\"; ${varname}=\${*}"
|
||||
}
|
||||
|
||||
# -- POSIX compat --
|
||||
|
||||
# Check whether 'local' is supported.
|
||||
@ -97,7 +107,7 @@ is_package_removal() {
|
||||
local dir olist
|
||||
for dir in ${list}; do
|
||||
# 2) These removes have to remove whole directories.
|
||||
is_whole_dir_removed ${dir} && olist=${olist+${olist} }${dir}
|
||||
is_whole_dir_removed ${dir} && array_append olist "${dir}"
|
||||
done
|
||||
|
||||
[ -z "${olist}" ] && return 1
|
||||
@ -142,7 +152,7 @@ find_ebuilds() {
|
||||
esac
|
||||
fi
|
||||
SC_CP=${SC_CP:+${SC_CP}, }${category}${pkg}
|
||||
SC_REMOVED_PACKAGE_LIST=${SC_REMOVED_PACKAGE_LIST:+${SC_REMOVED_PACKAGE_LIST} }${category}${pkg}
|
||||
array_append SC_REMOVED_PACKAGE_LIST "${category}${pkg}"
|
||||
done
|
||||
|
||||
SC_ROOT=${category:+../}
|
||||
@ -151,7 +161,7 @@ find_ebuilds() {
|
||||
# relative to SC_ROOT.
|
||||
SC_CHANGE_LIST=
|
||||
for pkg in ${SC_REMOVED_PACKAGE_LIST}; do
|
||||
SC_CHANGE_LIST=${SC_CHANGE_LIST+${SC_CHANGE_LIST} }${SC_ROOT}${pkg}
|
||||
array_append SC_CHANGE_LIST "${SC_ROOT}${pkg}"
|
||||
done
|
||||
|
||||
local sdir
|
||||
@ -324,14 +334,14 @@ main() {
|
||||
|
||||
--)
|
||||
shift
|
||||
commitmsg=${commitmsg+${commitmsg} }${@}
|
||||
array_append commitmsg "${@}"
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
die "Unknown option: ${1}; see --help." >&2
|
||||
;;
|
||||
*)
|
||||
commitmsg=${commitmsg+${commitmsg} }${1}
|
||||
array_append commitmsg "${1}"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
@ -464,7 +474,7 @@ main() {
|
||||
local pkg regex
|
||||
regex=
|
||||
for pkg in ${SC_REMOVED_PACKAGE_LIST}; do
|
||||
regex="${regex:+${regex}\|}${pkg}"
|
||||
regex=${regex:+${regex}\|}${pkg}
|
||||
done
|
||||
|
||||
say "${GREEN}Grepping for package references...${RESET}"
|
||||
|
Loading…
Reference in New Issue
Block a user