diff options
Diffstat (limited to 'pkgs/common-updater/scripts/update-source-version')
-rwxr-xr-x | pkgs/common-updater/scripts/update-source-version | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version index bc2c68feaeaa6..e1eece1fbf408 100755 --- a/pkgs/common-updater/scripts/update-source-version +++ b/pkgs/common-updater/scripts/update-source-version @@ -109,13 +109,13 @@ if [ "$oldVersion" = "$newVersion" ]; then fi # Escape regex metacharacter that are allowed in store path names -oldVersion=$(echo "$oldVersion" | sed -re 's|[.+]|\\&|g') -oldUrl=$(echo "$oldUrl" | sed -re 's|[${}.+]|\\&|g') +oldVersionEscaped=$(echo "$oldVersion" | sed -re 's|[.+]|\\&|g') +oldUrlEscaped=$(echo "$oldUrl" | sed -re 's|[${}.+]|\\&|g') -if [ $(grep -c -E "^\s*(let\b)?\s*$versionKey\s*=\s*\"$oldVersion\"" "$nixFile") = 1 ]; then - pattern="/\b$versionKey\b\s*=/ s|\"$oldVersion\"|\"$newVersion\"|" -elif [ $(grep -c -E "^\s*(let\b)?\s*name\s*=\s*\"[^\"]+-$oldVersion\"" "$nixFile") = 1 ]; then - pattern="/\bname\b\s*=/ s|-$oldVersion\"|-$newVersion\"|" +if [ $(grep -c -E "^\s*(let\b)?\s*$versionKey\s*=\s*\"$oldVersionEscaped\"" "$nixFile") = 1 ]; then + pattern="/\b$versionKey\b\s*=/ s|\"$oldVersionEscaped\"|\"$newVersion\"|" +elif [ $(grep -c -E "^\s*(let\b)?\s*name\s*=\s*\"[^\"]+-$oldVersionEscaped\"" "$nixFile") = 1 ]; then + pattern="/\bname\b\s*=/ s|-$oldVersionEscaped\"|-$newVersion\"|" else die "Couldn't figure out where out where to patch in new version in '$attr'!" fi @@ -128,7 +128,7 @@ fi # Replace new URL if [ -n "$newUrl" ]; then - sed -i "$nixFile" -re "s|\"$oldUrl\"|\"$newUrl\"|" + sed -i "$nixFile" -re "s|\"$oldUrlEscaped\"|\"$newUrl\"|" if cmp -s "$nixFile" "$nixFile.bak"; then die "Failed to replace source URL '$oldUrl' to '$newUrl' in '$attr'!" |