update-source-version: Escape plus sign if it occurs in version

This commit is contained in:
Tuomas Tynkkynen 2017-11-19 03:33:06 +02:00
parent d6cc334d6b
commit e3b0c03507

View file

@ -39,8 +39,8 @@ if [ "$oldVersion" = "$newVersion" ]; then
exit 0
fi
# Escape dots, there should not be any other regex characters allowed in store path names
oldVersion=$(echo "$oldVersion" | sed -re 's|\.|\\.|g')
# Escape regex metacharacter that are allowed in store path names
oldVersion=$(echo "$oldVersion" | sed -re 's|[.+]|\\&|g')
if [ $(grep -c -E "^\s*(let\b)?\s*version\s+=\s+\"$oldVersion\"" "$nixFile") = 1 ]; then
pattern="/\bversion\b\s*=/ s|\"$oldVersion\"|\"$newVersion\"|"