diff options
author | Matt McHenry <github@matt.mchenryfamily.org> | 2023-07-20 21:32:16 -0400 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2023-09-29 20:34:05 +0200 |
commit | 8a77077879c91eae16b74f6ecc771a9a09afa584 (patch) | |
tree | 49fb955cabbc673a722509f30a1cb9d4661a7ccd /pkgs/applications/editors/eclipse | |
parent | ca0c8dc60891214290f5038407e88c7298740a2f (diff) | |
download | nixlib-8a77077879c91eae16b74f6ecc771a9a09afa584.tar nixlib-8a77077879c91eae16b74f6ecc771a9a09afa584.tar.gz nixlib-8a77077879c91eae16b74f6ecc771a9a09afa584.tar.bz2 nixlib-8a77077879c91eae16b74f6ecc771a9a09afa584.tar.lz nixlib-8a77077879c91eae16b74f6ecc771a9a09afa584.tar.xz nixlib-8a77077879c91eae16b74f6ecc771a9a09afa584.tar.zst nixlib-8a77077879c91eae16b74f6ecc771a9a09afa584.zip |
eclipses: create minimal update.sh
this isn't complete enough to use as a formal updateScript yet, but it's definitely an improvement over the current purely-manual process. Co-authored-by: Robert Helgesson <robert@rycee.net>
Diffstat (limited to 'pkgs/applications/editors/eclipse')
-rw-r--r-- | pkgs/applications/editors/eclipse/default.nix | 5 | ||||
-rwxr-xr-x | pkgs/applications/editors/eclipse/update.sh | 72 |
2 files changed, 74 insertions, 3 deletions
diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix index 686ec3681183..99ac442d5cb1 100644 --- a/pkgs/applications/editors/eclipse/default.nix +++ b/pkgs/applications/editors/eclipse/default.nix @@ -6,10 +6,9 @@ , callPackage }: -# https://download.eclipse.org/eclipse/downloads/ is the main place to -# find the downloads needed for new versions +# use ./update.sh to help with updating for each quarterly release # -# to test: +# then, to test: # for e in cpp modeling platform sdk java jee committers rcp; do for s in pkgs pkgsCross.aarch64-multiplatform; do echo; echo $s $e; nix build -f default.nix ${s}.eclipses.eclipse-${e} -o eclipse-${s}-${e}; done; done let diff --git a/pkgs/applications/editors/eclipse/update.sh b/pkgs/applications/editors/eclipse/update.sh new file mode 100755 index 000000000000..7e100ccfbcd7 --- /dev/null +++ b/pkgs/applications/editors/eclipse/update.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash --pure -p curl cacert libxml2 yq nix jq +#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/3c7487575d9445185249a159046cc02ff364bff8.tar.gz +# ^ +# | +# nixos-unstable ~ 2023-07-06 -----------------/ + +set -o errexit +set -o nounset + +# scrape the downloads page for release info + +curl -s -o eclipse-dl.html https://download.eclipse.org/eclipse/downloads/ +trap "rm eclipse-dl.html" EXIT + +dlquery() { + q=$1 + xmllint --html eclipse-dl.html --xmlout 2>/dev/null | xq -r ".html.body.main.div.table[3].tr[1].td[0].a${q}"; +} + +# extract release info from download page HTML + +platform_major=$(dlquery '."#text" | split(".") | .[0]' -r); +platform_minor=$(dlquery '."#text" | split(".") | .[1]' -r); + +year=$(dlquery '."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[0:4]') +buildmonth=$(dlquery '."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[4:6]') +builddaytime=$(dlquery '."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[6:12]') +timestamp="${year}${buildmonth}${builddaytime}"; + +# account for possible release-month vs. build-month mismatches + +month=$buildmonth; +case "$buildmonth" in + '02'|'04') month='03' ;; + '05'|'07') month='06' ;; + '08'|'10') month='09' ;; + '11'|'01') month='12' ;; +esac + +cat <<EOF + +paste the following into the 'let' block near the top of pkgs/applications/editors/eclipse/default.nix: + + platform_major = "${platform_major}"; + platform_minor = "${platform_minor}"; + year = "${year}"; + month = "${month}"; #release month + buildmonth = "${buildmonth}"; #sometimes differs from release month + timestamp = "\${year}\${buildmonth}${builddaytime}"; +EOF + +# strip existing download hashes + +sed -i 's/64 = ".*";$/64 = "";/g' pkgs/applications/editors/eclipse/default.nix + +# prefetch new download hashes + +echo; +echo "paste the following url + hash blocks into pkgs/applications/editors/eclipse/default.nix:"; + +for u in $(grep 'url = ' pkgs/applications/editors/eclipse/default.nix | grep arch | cut -d '"' -f 2 | sed 's/&/\\&/g'); do + echo; + echo " url = \"${u}\";"; + echo " hash = {"; + for arch in x86_64 aarch64; do + us=$(eval echo "$u"); + h=$(nix store prefetch-file --json "$us" | jq -r .hash); + echo " $arch = \"${h}\";"; + done + echo ' }.${arch};'; +done |