@@ -29,6 +29,9 @@ for arg in "$@"; do
2929 die "Could not find provided file $nixFile"
3030 fi
3131 ;;
32+ --ignore-same-hash)
33+ ignoreSameHash="true"
34+ ;;
3235 --help)
3336 usage
3437 exit 0
@@ -86,11 +89,15 @@ fi
8689oldUrl=$(nix-instantiate $systemArg --eval -E "with import ./. {}; builtins.elemAt $attr.src.drvAttrs.urls 0" | tr -d '"')
8790
8891if [ -z "$oldUrl" ]; then
89− die "Couldn't evaluate source url from '$attr.name'!"
92+ oldUrl=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.src.url" | tr -d '"')
93+
94+ if [ -z "$oldUrl" ]; then
95+ die "Couldn't evaluate source url from '$attr.src'!"
96+ fi
9097fi
9198
9299drvName=$(nix-instantiate $systemArg --eval -E "with import ./. {}; (builtins.parseDrvName $attr.name).name" | tr -d '"')
93−oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.version or (builtins.parseDrvName $attr.name).version" | tr -d '"')
100+oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.${versionKey} or (builtins.parseDrvName $attr.name).${versionKey}" | tr -d '"')
94101
95102if [ -z "$drvName" -o -z "$oldVersion" ]; then
96103 die "Couldn't evaluate name and version from '$attr.name'!"
@@ -154,7 +161,7 @@ if [ -z "$newHash" ]; then
154161 die "Couldn't figure out new hash of '$attr.src'!"
155162fi
156163
157−if [ "$oldVersion" != "$newVersion" ] && [ "$oldHash" = "$newHash" ]; then
164+if [ -z "${ignoreSameHash}"] && [ "$oldVersion" != "$newVersion" ] && [ "$oldHash" = "$newHash" ]; then
158165 mv "$nixFile.bak" "$nixFile"
159166 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}'!"
160167fi