mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +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:
parent
7a26f6523a
commit
63b02859bc
2 changed files with 27 additions and 22 deletions
|
@ -197,16 +197,17 @@ def get_port_properties(port):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
props = {}
|
props = {}
|
||||||
for prop in PORT_PROPERTIES:
|
package_sh_command = f"./package.sh showproperty {' '.join(PORT_PROPERTIES)}"
|
||||||
res = subprocess.run(f"cd {port}; exec ./package.sh showproperty {prop}", shell=True, capture_output=True)
|
res = subprocess.run(f"cd {port}; exec {package_sh_command}", shell=True, capture_output=True)
|
||||||
if res.returncode == 0:
|
if res.returncode == 0:
|
||||||
props[prop] = res.stdout.decode('utf-8').strip()
|
results = res.stdout.decode('utf-8').split('\n\n')
|
||||||
|
props = {prop: results[i].strip() for i, prop in enumerate(PORT_PROPERTIES)}
|
||||||
else:
|
else:
|
||||||
print((
|
print((
|
||||||
f'Executing "./package.sh showproperty {prop}" script for port {port} failed with '
|
f'Executing "{package_sh_command}" script for port {port} failed with '
|
||||||
f'exit code {res.returncode}, output from stderr:\n{res.stderr.decode("utf-8").strip()}'
|
f'exit code {res.returncode}, output from stderr:\n{res.stderr.decode("utf-8").strip()}'
|
||||||
))
|
))
|
||||||
props[prop] = ''
|
props = {x: '' for x in PORT_PROPERTIES}
|
||||||
return props
|
return props
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -543,6 +543,7 @@ do_uninstall() {
|
||||||
uninstall
|
uninstall
|
||||||
}
|
}
|
||||||
do_showproperty() {
|
do_showproperty() {
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
if ! declare -p "${1}" > /dev/null 2>&1; then
|
if ! declare -p "${1}" > /dev/null 2>&1; then
|
||||||
echo "Property '$1' is not set." >&2
|
echo "Property '$1' is not set." >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -555,6 +556,9 @@ do_showproperty() {
|
||||||
else
|
else
|
||||||
echo ${!1}
|
echo ${!1}
|
||||||
fi
|
fi
|
||||||
|
printf '\n'
|
||||||
|
shift
|
||||||
|
done
|
||||||
}
|
}
|
||||||
do_all() {
|
do_all() {
|
||||||
do_installdepends
|
do_installdepends
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue