mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
common-updater-scripts/u-s-v: support --ignore-same-version
This is useful when updating multiple source attributes for a single version.
This commit is contained in:
parent
051f920625
commit
bcb2f57f18
@ -12,9 +12,10 @@ usage() {
|
|||||||
echo "Usage: $scriptName <attr> <version> [<new-source-hash>] [<new-source-url>]"
|
echo "Usage: $scriptName <attr> <version> [<new-source-hash>] [<new-source-url>]"
|
||||||
echo " [--version-key=<version-key>] [--source-key=<source-key>]"
|
echo " [--version-key=<version-key>] [--source-key=<source-key>]"
|
||||||
echo " [--system=<system>] [--file=<file-to-update>] [--rev=<revision>]"
|
echo " [--system=<system>] [--file=<file-to-update>] [--rev=<revision>]"
|
||||||
echo " [--ignore-same-hash] [--print-changes]"
|
echo " [--ignore-same-hash] [--ignore-same-version] [--print-changes]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ignoreSameVersion=
|
||||||
args=()
|
args=()
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
@ -41,6 +42,9 @@ for arg in "$@"; do
|
|||||||
--ignore-same-hash)
|
--ignore-same-hash)
|
||||||
ignoreSameHash="true"
|
ignoreSameHash="true"
|
||||||
;;
|
;;
|
||||||
|
--ignore-same-version)
|
||||||
|
ignoreSameVersion="true"
|
||||||
|
;;
|
||||||
--print-changes)
|
--print-changes)
|
||||||
printChanges="true"
|
printChanges="true"
|
||||||
;;
|
;;
|
||||||
@ -139,7 +143,7 @@ if [[ -z "$oldVersion" ]]; then
|
|||||||
die "Couldn't find out the old version of '$attr'!"
|
die "Couldn't find out the old version of '$attr'!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$oldVersion" = "$newVersion" ]]; then
|
if [[ -z "$ignoreSameVersion" && "$oldVersion" = "$newVersion" ]]; then
|
||||||
echo "$scriptName: New version same as old version, nothing to do." >&2
|
echo "$scriptName: New version same as old version, nothing to do." >&2
|
||||||
if [ -n "$printChanges" ]; then
|
if [ -n "$printChanges" ]; then
|
||||||
printf '[]\n'
|
printf '[]\n'
|
||||||
@ -198,10 +202,12 @@ fi
|
|||||||
oldHashEscaped=$(echo "$oldHash" | sed -re 's|[+]|\\&|g')
|
oldHashEscaped=$(echo "$oldHash" | sed -re 's|[+]|\\&|g')
|
||||||
tempHashEscaped=$(echo "$tempHash" | sed -re 's|[+]|\\&|g')
|
tempHashEscaped=$(echo "$tempHash" | sed -re 's|[+]|\\&|g')
|
||||||
|
|
||||||
# Replace new version
|
if [[ "$oldVersion" != "$newVersion" ]]; then
|
||||||
sed -i.cmp "$nixFile" -re "$pattern"
|
# Replace new version
|
||||||
if cmp -s "$nixFile" "$nixFile.cmp"; then
|
sed -i.cmp "$nixFile" -re "$pattern"
|
||||||
die "Failed to replace version '$oldVersion' to '$newVersion' in '$attr'!"
|
if cmp -s "$nixFile" "$nixFile.cmp"; then
|
||||||
|
die "Failed to replace version '$oldVersion' to '$newVersion' in '$attr'!"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Replace new URL
|
# Replace new URL
|
||||||
|
Loading…
Reference in New Issue
Block a user