diff --git a/pkgs/applications/editors/eclipse/build-eclipse.nix b/pkgs/applications/editors/eclipse/build-eclipse.nix index 2852d7649ad6..de6f6f01d8c0 100644 --- a/pkgs/applications/editors/eclipse/build-eclipse.nix +++ b/pkgs/applications/editors/eclipse/build-eclipse.nix @@ -110,6 +110,8 @@ stdenv.mkDerivation rec { perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin.*\n||' $out/eclipse/eclipse.ini ''; # */ + passthru.updateScript = ./update.sh; + meta = { homepage = "https://www.eclipse.org/"; inherit description; diff --git a/pkgs/applications/editors/eclipse/update.sh b/pkgs/applications/editors/eclipse/update.sh index 01b3ec5fa57b..fd3798cd19ea 100755 --- a/pkgs/applications/editors/eclipse/update.sh +++ b/pkgs/applications/editors/eclipse/update.sh @@ -38,36 +38,27 @@ case "$buildmonth" in '11'|'01') month='12' ;; esac -cat < $t; +mv $t $ECLIPSES_JSON; # prefetch new download hashes -echo; -echo "paste the following url + hash blocks into pkgs/applications/editors/eclipse/default.nix:"; - -for url in $(grep 'url = ' pkgs/applications/editors/eclipse/default.nix | grep arch | cut -d '"' -f 2); do - u=$(echo "$url" | sed 's/&/\\&/g'); - echo; - echo " url = \"${url}\";"; - echo " hash = {"; +for id in $(cat $ECLIPSES_JSON | jq -r '.eclipses | keys | .[]'); do for arch in x86_64 aarch64; do - us=$(eval echo "$u"); - h=$(nix store prefetch-file --json "$us" | jq -r .hash); - echo " $arch = \"${h}\";"; + if [ $(cat $ECLIPSES_JSON | jq -r ".eclipses.${id}.dropUrl") == "true" ]; then + url="https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-${id}-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz"; + else + url="https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-${id}-${year}-${month}-R-linux-gtk-${arch}.tar.gz"; + fi + + echo "prefetching ${id} ${arch}"; + h=$(nix store prefetch-file --json "$url" | jq -r .hash); + + t=$(mktemp); + cat $ECLIPSES_JSON | jq -r ".eclipses.${id}.hashes.${arch} = \"${h}\"" > $t; + mv $t $ECLIPSES_JSON; done - echo ' }.${arch};'; done