nixpkgs/pkgs/development/rocm-modules/5/hsa-amd-aqlprofile-bin/update.nix
Madoura a593ca3973
rocmPackages.hsa-amd-aqlprofile-bin: 5.7.0 -> 5.7.1
Added update script that actually works
2023-10-23 16:04:00 -05:00

51 lines
1.6 KiB
Nix

{ lib
, writeScript
}:
{ version }:
let
prefix = "hsa-amd-aqlprofile";
extVersion = lib.strings.concatStrings (lib.strings.intersperse "0" (lib.versions.splitVersion version));
major = lib.versions.major version;
minor = lib.versions.minor version;
patch = lib.versions.patch version;
updateScript = writeScript "update.sh" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts
apt="https://repo.radeon.com/rocm/apt"
pool="pool/main/h/${prefix}/"
url="$apt/latest/$pool"
res="$(curl -sL "$url")"
deb="${prefix}$(echo "$res" | grep -o -P "(?<=href=\"${prefix}).*(?=\">)" | tail -1)"
patch="${patch}"
# Try up to 10 patch versions
for i in {1..10}; do
((patch++))
extVersion="$(echo "$deb" | grep -o -P "(?<=\.....).*(?=\..*-)")"
if (( ''${#extVersion} == 5 )) && (( $extVersion <= ${extVersion} )); then
url="https://repo.radeon.com/rocm/apt/${major}.${minor}.$patch/pool/main/h/${prefix}/"
res="$(curl -sL "$url")"
deb="${prefix}$(echo "$res" | grep -o -P "(?<=href=\"${prefix}).*(?=\">)" | tail -1)"
else
break
fi
done
extVersion="$(echo $deb | grep -o -P "(?<=\.....).*(?=\..*-)")"
version="$(echo $extVersion | sed "s/0/./1" | sed "s/0/./1")"
if (( ''${#extVersion} == 5 )); then
repoVersion="$version"
if (( ''${version:4:1} == 0 )); then
repoVersion=''${version:0:3}
fi
update-source-version rocmPackages_5.${prefix}-bin "$version" "" "$apt/$repoVersion/$pool$deb" --ignore-same-hash
fi
'';
in [ updateScript ]