diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version index a66ffb750f6..75433fe4c59 100755 --- a/pkgs/common-updater/scripts/update-source-version +++ b/pkgs/common-updater/scripts/update-source-version @@ -29,6 +29,9 @@ for arg in "$@"; do die "Could not find provided file $nixFile" fi ;; + --ignore-same-hash) + ignoreSameHash="true" + ;; --help) usage exit 0 @@ -86,11 +89,15 @@ fi oldUrl=$(nix-instantiate $systemArg --eval -E "with import ./. {}; builtins.elemAt $attr.src.drvAttrs.urls 0" | tr -d '"') if [ -z "$oldUrl" ]; then - die "Couldn't evaluate source url from '$attr.name'!" + oldUrl=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.src.url" | tr -d '"') + + if [ -z "$oldUrl" ]; then + die "Couldn't evaluate source url from '$attr.src'!" + fi fi drvName=$(nix-instantiate $systemArg --eval -E "with import ./. {}; (builtins.parseDrvName $attr.name).name" | tr -d '"') -oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.version or (builtins.parseDrvName $attr.name).version" | tr -d '"') +oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.${versionKey} or (builtins.parseDrvName $attr.name).${versionKey}" | tr -d '"') if [ -z "$drvName" -o -z "$oldVersion" ]; then die "Couldn't evaluate name and version from '$attr.name'!" @@ -154,7 +161,7 @@ if [ -z "$newHash" ]; then die "Couldn't figure out new hash of '$attr.src'!" fi -if [ "$oldVersion" != "$newVersion" ] && [ "$oldHash" = "$newHash" ]; then +if [ -z "${ignoreSameHash}"] && [ "$oldVersion" != "$newVersion" ] && [ "$oldHash" = "$newHash" ]; then mv "$nixFile.bak" "$nixFile" die "Both the old and new source hashes of '$attr.src' were equivalent. Please fix the package's source URL to be dependent on '\${version}'!" fi