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."
|
"${@}" || 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 --
|
# -- POSIX compat --
|
||||||
|
|
||||||
# Check whether 'local' is supported.
|
# Check whether 'local' is supported.
|
||||||
@ -97,7 +107,7 @@ is_package_removal() {
|
|||||||
local dir olist
|
local dir olist
|
||||||
for dir in ${list}; do
|
for dir in ${list}; do
|
||||||
# 2) These removes have to remove whole directories.
|
# 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
|
done
|
||||||
|
|
||||||
[ -z "${olist}" ] && return 1
|
[ -z "${olist}" ] && return 1
|
||||||
@ -142,7 +152,7 @@ find_ebuilds() {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
SC_CP=${SC_CP:+${SC_CP}, }${category}${pkg}
|
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
|
done
|
||||||
|
|
||||||
SC_ROOT=${category:+../}
|
SC_ROOT=${category:+../}
|
||||||
@ -151,7 +161,7 @@ find_ebuilds() {
|
|||||||
# relative to SC_ROOT.
|
# relative to SC_ROOT.
|
||||||
SC_CHANGE_LIST=
|
SC_CHANGE_LIST=
|
||||||
for pkg in ${SC_REMOVED_PACKAGE_LIST}; do
|
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
|
done
|
||||||
|
|
||||||
local sdir
|
local sdir
|
||||||
@ -324,14 +334,14 @@ main() {
|
|||||||
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
commitmsg=${commitmsg+${commitmsg} }${@}
|
array_append commitmsg "${@}"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
die "Unknown option: ${1}; see --help." >&2
|
die "Unknown option: ${1}; see --help." >&2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
commitmsg=${commitmsg+${commitmsg} }${1}
|
array_append commitmsg "${1}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
@ -464,7 +474,7 @@ main() {
|
|||||||
local pkg regex
|
local pkg regex
|
||||||
regex=
|
regex=
|
||||||
for pkg in ${SC_REMOVED_PACKAGE_LIST}; do
|
for pkg in ${SC_REMOVED_PACKAGE_LIST}; do
|
||||||
regex="${regex:+${regex}\|}${pkg}"
|
regex=${regex:+${regex}\|}${pkg}
|
||||||
done
|
done
|
||||||
|
|
||||||
say "${GREEN}Grepping for package references...${RESET}"
|
say "${GREEN}Grepping for package references...${RESET}"
|
||||||
|
Loading…
Reference in New Issue
Block a user