lol

Merge pull request #259749 from doronbehar/pkg/uhd

uhd: 4.4.0.0 -> 4.5.0.0

authored by

Doron Behar and committed by
GitHub
d48c7318 43140284

+45 -6
+18 -6
pkgs/applications/radio/uhd/default.nix
··· 49 49 50 50 stdenv.mkDerivation (finalAttrs: { 51 51 pname = "uhd"; 52 - # UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz 53 - # and xxx.yyy.zzz. Hrmpf... style keeps changing 54 - version = "4.4.0.0"; 52 + # NOTE: Use the following command to update the package, and the uhdImageSrc attribute: 53 + # 54 + # nix-shell maintainers/scripts/update.nix --argstr package uhd --argstr commit true 55 + # 56 + version = "4.5.0.0"; 55 57 56 58 outputs = [ "out" "dev" ]; 57 59 ··· 59 61 owner = "EttusResearch"; 60 62 repo = "uhd"; 61 63 rev = "v${finalAttrs.version}"; 62 - sha256 = "sha256-khVOHlvacZc4EMg4m55rxEqPvLY1xURpAfOW905/3jg="; 64 + # The updateScript relies on the `src` using `hash`, and not `sha256. To 65 + # update the correct hash for the `src` vs the `uhdImagesSrc` 66 + hash = "sha256-0EqMBaQiNr8PE542YNkPvX3o1HhnhrO0Kz1euphY6Ps="; 63 67 }; 64 68 # Firmware images are downloaded (pre-built) from the respective release on Github 65 69 uhdImagesSrc = fetchurl { 66 70 url = "https://github.com/EttusResearch/uhd/releases/download/v${finalAttrs.version}/uhd-images_${finalAttrs.version}.tar.xz"; 67 - sha256 = "V8ldW8bvYWbrDAvpWpHcMeLf9YvF8PIruDAyNK/bru4="; 71 + # Please don't convert this to a hash, in base64, see comment near src's 72 + # hash. 73 + sha256 = "13cn41wv7vldk4vx7vy3jbb3wb3a5vpfg3ay893klpi6vzxc1dly"; 68 74 }; 69 - # TODO: Add passthru.updateScript that will update both of the above hashes... 75 + passthru = { 76 + updateScript = [ 77 + ./update.sh 78 + # Pass it this file name as argument 79 + (builtins.unsafeGetAttrPos "pname" finalAttrs.finalPackage).file 80 + ]; 81 + }; 70 82 71 83 cmakeFlags = [ 72 84 "-DENABLE_LIBUHD=ON"
+27
pkgs/applications/radio/uhd/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p jq nix nix-prefetch-github 3 + 4 + set -euo pipefail 5 + echoerr() { echo "$@" 1>&2; } 6 + 7 + fname="$1" 8 + echoerr got fname $fname 9 + shift 10 + latest_release=$(curl --silent https://api.github.com/repos/EttusResearch/uhd/releases/latest) 11 + version=$(jq -r '.tag_name' <<<"$latest_release" | cut -c2-) 12 + # Update version, if needed 13 + if grep -q 'version = "'$version $fname; then 14 + echoerr Current version $version is the latest available 15 + exit 0; 16 + fi 17 + echoerr got version $version 18 + sed -i -E 's/(version = ").*(";)/\1'$version'\2/g' $fname 19 + # Verify the sed command above did not fail 20 + grep -q $version $fname 21 + # Update srcHash 22 + srcHash="$(nix-prefetch-github EttusResearch uhd --rev v${version} | jq --raw-output .hash)" 23 + sed -i -E 's#(hash = ").*(";)#\1'$srcHash'\2#g' $fname 24 + grep -q $srcHash $fname 25 + imageHash="$(nix-prefetch-url https://github.com/EttusResearch/uhd/releases/download/v${version}/uhd-images_${version}.tar.xz)" 26 + sed -i -E 's#(sha256 = ").*(";)#\1'$imageHash'\2#g' $fname 27 + grep -q $imageHash $fname