git.iko.soy/typeable/nixpkgs
on master help sign in
update-source-version: Fixes, add --ignore-same-hash

--ignore-same-hash allows ignoring if the same has is used. This gives the ability to run update-source-version multiple times to change multiple keys. Fix version-key, which was not being used to determine the oldVersion variable. If $attr.src.drvAttrs.urls is not found, look for $attr.src.drvAttrs.url since it is being used like that in fetchgit

commitcce486838b6c52dedfec1c93f60ebadb72c48431 authorTim Steinbach <tim@nequissimus.com> dateSat 6 Apr 2019, 19:40 (8 years ago) parentb248553
1 file changed+10−3
pkgs/common-updater/scripts/update-source-version+10−3
pkgs/common-updater/scripts/update-source-version+10−3
@@ -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