__package_pip: install not found extras

Compares the explorer against the parameters and install those extras
that are not already installed.
This commit is contained in:
matze 2021-02-11 13:49:53 +01:00
parent 4717e5ceff
commit 8dc6ab9738
1 changed files with 12 additions and 8 deletions

View File

@ -2,6 +2,7 @@
# #
# 2012 Nico Schottelius (nico-cdist at schottelius.org) # 2012 Nico Schottelius (nico-cdist at schottelius.org)
# 2016 Darko Poljak (darko.poljak at gmail.com) # 2016 Darko Poljak (darko.poljak at gmail.com)
# 2021 Matthias Stecher (matthiasstecher at gmx.de)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -58,14 +59,17 @@ case "$state_should" in
present) present)
if [ -f "$__object/parameter/extra" ] if [ -f "$__object/parameter/extra" ]
then then
while read -r extra mkdir "$__object/files"
do # sort and generalize all extras
if [ "$extras" ]; then sed 's/,/\n/g' "$__object/parameter/extra" | sort > "$__object/files/extras-params"
extras="$extras,$extra" sort "$__object/explorer/extras" > "$__object/files/extras-explorer"
else
extras="$extra" # assemble extras
fi # all extras are passed to pip in a comma-separated list
done < "$__object/parameter/extra" extras="$(comm -23 \
"$__object/files/extras-params" "$__object/files/extras-explorer" \
| sed ':a; $!N; s/\n/,/; ta' # loops through all input lines and add commas between them
)"
name="${name}[${extras}]" name="${name}[${extras}]"
fi fi