Commit 063555ec authored by Leo's avatar Leo

Make apkbuild-fixer capable of fixing AL32

parent b4ff6350
......@@ -61,6 +61,16 @@ rewrite_function() {
done
}
# Remove braces from a variable in a line
remove_braces() {
[ -z "$1" ] || [ -z "$2" ] && return 0
printf "%s\\n" "$2" | while read -r line variable; do
# Make variable without braces
unbraced_variable="$(printf "%s\\n" "$variable" | sed 's|[{}]||g')"
sed -i " {$line s|$variable|$unbraced_variable|g }" "$1"
done
}
for apkbuild; do
if [ -f "$apkbuild" ]; then
......@@ -80,8 +90,14 @@ for apkbuild; do
cut -d : -f4 | \
sort -rV | \
paste -sd ' ')"
remove_braces="$(echo "$violations" | \
grep -F '[AL32]' | \
awk -F: '{print $4" "$6}' | \
sort -rV)"
[ -n "$rewrite_functions" ] && rewrite_function "$apkbuild" "$rewrite_functions"
[ -n "$remove_braces" ] && remove_braces "$apkbuild" "$remove_braces"
# Remove || return 1 (might delete lines)
return_1_lines="$(echo "$violations" | \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment