yourkit-java: 2023.9-b107 -> 2023.9-b109

This commit is contained in:
Guanpeng Xu 2024-02-24 10:19:40 -08:00
parent 7142e28c8b
commit 956a23b5d2
2 changed files with 69 additions and 10 deletions

View File

@ -9,12 +9,19 @@
let
vPath = v: lib.elemAt (lib.splitString "-" v) 0;
arch = let inherit (stdenv.targetPlatform) system;
in if system == "x86_64-linux" then "x64"
else if system == "aarch64=linux" then "arm64"
else throw "Unsupported system";
version = "2023.9-b109";
version = "2023.9-b107";
arches = {
aarch64-linux = "arm64";
x86_64-linux = "x64";
};
arch = arches.${stdenv.targetPlatform.system} or (throw "Unsupported system");
hashes = {
arm64 = "sha256-t6ly8Beu6Hrqy1W2pG9Teks+QSZxbN/KeVxKvCDuTmg=";
x64 = "sha256-utV8x2V8MXkG0H/fJ9sScykH5OtPqxbx+RW+1ePYUog=";
};
desktopItem = makeDesktopItem {
name = "YourKit Java Profiler";
@ -27,14 +34,14 @@ let
startupWMClass = "YourKit Java Profiler";
};
in
stdenv.mkDerivation rec {
stdenv.mkDerivation {
inherit version;
pname = "yourkit-java";
src = fetchzip {
url = "https://download.yourkit.com/yjp/${vPath version}/YourKit-JavaProfiler-${version}-${arch}.zip";
hash = "sha256-vlYmGAp8wURcNN+0Qxj+fWjLXwkAgkRnRdUMvg2TM+k=";
hash = hashes.${arch};
};
nativeBuildInputs = [ copyDesktopItems imagemagick ];
@ -50,7 +57,8 @@ stdenv.mkDerivation rec {
cp -pr bin lib license.html license-redist.txt probes samples $out
cp ${./forbid-desktop-item-creation} $out/bin/forbid-desktop-item-creation
for i in attach integrate; do
sed -i -e 's|profiler.sh|yourkit-java-profiler|' $out/bin/$i.sh
substituteInPlace $out/bin/$i.sh \
--replace profiler.sh yourkit-java-profiler
done
for i in attach integrate profiler; do
mv $out/bin/$i.sh $out/bin/yourkit-java-$i
@ -60,8 +68,8 @@ stdenv.mkDerivation rec {
-size 256x256 \
$out/share/icons/yourkit-java-profiler.png
rm $out/bin/profiler.ico
sed -i -e 's|JAVA_EXE="$YD/jre64/bin/java"|JAVA_EXE=${jre}/bin/java|' \
$out/bin/yourkit-java-profiler
substituteInPlace $out/bin/yourkit-java-profiler \
--replace 'JAVA_EXE="$YD/jre64/bin/java"' JAVA_EXE=${jre}/bin/java
# Use our desktop item, which will be purged when this package
# gets removed
sed -i -e "/^YD=/isource $out/bin/forbid-desktop-item-creation\\

View File

@ -0,0 +1,51 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused gawk nix-prefetch
set -euo pipefail
ROOT="$(dirname "$(readlink -f "$0")")"
NIX_DRV="$ROOT/package.nix"
if [[ ! -f "$NIX_DRV" ]]; then
echo "ERROR: cannot find default.nix in $ROOT"
exit 1
fi
function retrieve_latest_version () {
curl https://www.yourkit.com/java/profiler/download/ \
| grep -Eo '(Version|Build): ([a-z0-9#.-])+' \
| awk '{ print $2 }' \
| tr -d '\n' \
| sed 's/#/-b/'
}
function calc_hash () {
local version=$1
local url=$2
nix-prefetch "{ stdenv, fetchzip }:
stdenv.mkDerivation {
pname = \"yourkit-java-source\";
version = \"$version\";
src = fetchzip {
url = \"$url\";
};
}"
}
function update_hash () {
local arch=$1
local version=$2
local date=$(echo $version | sed 's/-.*//')
local url=https://download.yourkit.com/yjp/$date/YourKit-JavaProfiler-$version-$arch.zip
local hash=$(calc_hash $version $url)
sed -i -e "s|^.*$arch.*=.*\"sha256-.*$| $arch = \"$hash\";|" $NIX_DRV
}
version=$(retrieve_latest_version)
for arch in arm64 x64; do
update_hash $arch $version
done
# Local variables:
# mode: shell-script
# eval: (sh-set-shell "bash")
# End: