1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-30 13:17:45 +00:00

Meta+Ports: Make 'package.sh showproperty' report multiple properties

And use that to avoid shelling out multiple times for checking
properties in lint-ports.py.
This commit is contained in:
Ali Mohammad Pur 2022-01-17 13:19:23 +03:30 committed by Andreas Kling
parent 7a26f6523a
commit 63b02859bc
2 changed files with 27 additions and 22 deletions

View file

@ -543,18 +543,22 @@ do_uninstall() {
uninstall
}
do_showproperty() {
if ! declare -p "${1}" > /dev/null 2>&1; then
echo "Property '$1' is not set." >&2
exit 1
fi
property_declaration="$(declare -p "${1}")"
if [[ "$property_declaration" =~ "declare -a" ]]; then
prop_array="${1}[@]"
# Some magic to avoid empty arrays being considered unset.
echo "${!prop_array+"${!prop_array}"}"
else
echo ${!1}
fi
while [ $# -gt 0 ]; do
if ! declare -p "${1}" > /dev/null 2>&1; then
echo "Property '$1' is not set." >&2
exit 1
fi
property_declaration="$(declare -p "${1}")"
if [[ "$property_declaration" =~ "declare -a" ]]; then
prop_array="${1}[@]"
# Some magic to avoid empty arrays being considered unset.
echo "${!prop_array+"${!prop_array}"}"
else
echo ${!1}
fi
printf '\n'
shift
done
}
do_all() {
do_installdepends