mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-07 18:07:08 -08:00
java-utils-2.eclass: Rework wltjr's new java-pkg_gen-cp
* Use an accurate regexp rather than naive string manipulation. * Join the entries with , for a single call to java-config. * Don't export the given variable as we haven't previously. * die if the atom is invalid, particularly if the SLOT is missing. * Avoid adding duplicates because this may get called more than once.
This commit is contained in:
+11
-10
@@ -2900,14 +2900,15 @@ java-pkg_clean() {
|
||||
java-pkg_gen-cp() {
|
||||
debug-print-function ${FUNCNAME} "${@}"
|
||||
|
||||
if [[ ${CP_DEPEND} ]]; then
|
||||
local cp="${!1}"
|
||||
local p
|
||||
for p in ${CP_DEPEND}; do
|
||||
p="${p/-[0-9]*:/-}"
|
||||
cp="${cp} ${p#*/}"
|
||||
done
|
||||
cp="${cp//:/-}"
|
||||
[[ ${cp} ]] && export ${1}="${cp//-0/}"
|
||||
fi
|
||||
local atom
|
||||
for atom in ${CP_DEPEND}; do
|
||||
if [[ ${atom} =~ /(([[:alnum:]+_-]+)-[0-9]+(\.[0-9]+)*[a-z]?(_[[:alnum:]]+)?(-r[0-9]*)?|[[:alnum:]+_-]+):([[:alnum:]+_.-]+) ]]; then
|
||||
atom=${BASH_REMATCH[2]:-${BASH_REMATCH[1]}}
|
||||
[[ ${BASH_REMATCH[6]} != 0 ]] && atom+=-${BASH_REMATCH[6]}
|
||||
local regex="(^|\s|,)${atom}($|\s|,)"
|
||||
[[ ${!1} =~ ${regex} ]] || declare -g ${1}+=${!1:+,}${atom}
|
||||
else
|
||||
die "Invalid CP_DEPEND atom ${atom}, ensure a SLOT is included"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user