Commit 538c78c5 authored by Leo's avatar Leo

Add support dealing with AL29

parent 666df466
......@@ -67,13 +67,26 @@ remove_braces() {
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"
sed -i "{$line s|$variable|$unbraced_variable|g }" "$1"
done
}
remove_pkgname_from_source() {
[ -z "$1" ] || [ -z "$2" ] && return 0
for l in $2; do
sed -i "{$l s|\$pkgname|$pkgname|g }" "$1"
done
}
for apkbuild; do
if [ -f "$apkbuild" ]; then
# Source the apkbuild, required to get pkgname
srcdir="" . "$apkbuild" || {
echo "Failed to source APKBUILD in '$apkbuild'" ;
exit 1;
}
# Remove trailing whitespace
remove_trailing_whitespace "$apkbuild"
......@@ -148,7 +161,17 @@ for apkbuild; do
cut -d : -f4 | \
sort -rV | \
paste -sd ' ')"
[ -n "$rewrite_functions" ] && rewrite_function "$apkbuild" "$rewrite_functions"
# Replace $pkgname
pkgname_in_source="$(echo "$violations" | \
grep '\[AL29\]' | \
cut -d : -f4 | \
sort -rV | \
paste -sd ' ')"
[ -n "$pkgname_in_source" ] && remove_pkgname_from_source "$apkbuild" "$pkgname_in_source"
fi
done
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