about summary refs log tree commit diff
path: root/nixpkgs/pkgs/common-updater
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-04-22 21:15:06 +0000
committerAlyssa Ross <hi@alyssa.is>2019-04-22 21:18:23 +0000
commitb935ae5f3cfb2bb4f9a3746d284f156a6dece505 (patch)
tree5efe4e2e7a7723a737d0130a333b057c5e76df40 /nixpkgs/pkgs/common-updater
parentdc9566e91c9453378c24e98b5737234364670df5 (diff)
parentd26027792812fbfad4d0f451b5f47fdabf7fdeb9 (diff)
downloadnixlib-b935ae5f3cfb2bb4f9a3746d284f156a6dece505.tar
nixlib-b935ae5f3cfb2bb4f9a3746d284f156a6dece505.tar.gz
nixlib-b935ae5f3cfb2bb4f9a3746d284f156a6dece505.tar.bz2
nixlib-b935ae5f3cfb2bb4f9a3746d284f156a6dece505.tar.lz
nixlib-b935ae5f3cfb2bb4f9a3746d284f156a6dece505.tar.xz
nixlib-b935ae5f3cfb2bb4f9a3746d284f156a6dece505.tar.zst
nixlib-b935ae5f3cfb2bb4f9a3746d284f156a6dece505.zip
Merge commit 'd26027792812fbfad4d0f451b5f47fdabf7fdeb9'
Diffstat (limited to 'nixpkgs/pkgs/common-updater')
-rwxr-xr-xnixpkgs/pkgs/common-updater/scripts/update-source-version13
1 files changed, 10 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/common-updater/scripts/update-source-version b/nixpkgs/pkgs/common-updater/scripts/update-source-version
index a66ffb750f6e..75433fe4c596 100755
--- a/nixpkgs/pkgs/common-updater/scripts/update-source-version
+++ b/nixpkgs/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