3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #160115 from steinybot/fix/jetbrains-apple-m1

This commit is contained in:
Ben Siraphob 2022-03-12 17:57:19 -08:00 committed by GitHub
commit 2e5f3cde8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 512 additions and 180 deletions

View file

@ -0,0 +1,37 @@
{ lib
, stdenvNoCC
, undmg
, ...
}:
{ meta
, name
, product
, productShort ? product
, src
, version
, ...
}:
let
loname = lib.toLower productShort;
in
stdenvNoCC.mkDerivation {
inherit meta src version;
desktopName = product;
installPhase = ''
runHook preInstall
APP_DIR="$out/Applications/${product}.app"
mkdir -p "$APP_DIR"
cp -Tr "${product}.app" "$APP_DIR"
mkdir -p "$out/bin"
cat << EOF > "$out/bin/${loname}"
open -na '$APP_DIR' --args "\$@"
EOF
chmod +x "$out/bin/${loname}"
runHook postInstall
'';
nativeBuildInputs = [ undmg ];
pname = lib.concatStringsSep "-" (lib.init (lib.splitString "-" name));
sourceRoot = ".";
}

View file

@ -10,7 +10,18 @@
with lib;
let
mkJetBrainsProduct = callPackage ./common.nix { inherit vmopts; };
platforms = lib.platforms.linux ++ [ "x86_64-darwin" "aarch64-darwin" ];
ideaPlatforms = [ "x86_64-darwin" "i686-darwin" "i686-linux" "x86_64-linux" "aarch64-darwin" ];
inherit (stdenv.hostPlatform) system;
versions = builtins.fromJSON (readFile (./versions.json));
versionKey = if stdenv.isLinux then "linux" else system;
products = versions.${versionKey} or (throw "Unsupported system: ${system}");
package = if stdenv.isDarwin then ./darwin.nix else ./linux.nix;
mkJetBrainsProduct = callPackage package { inherit vmopts; };
# Sorted alphabetically
buildClion = { name, version, src, license, description, wmClass, ... }:
@ -19,13 +30,12 @@ let
product = "CLion";
meta = with lib; {
homepage = "https://www.jetbrains.com/clion/";
inherit description license;
inherit description license platforms;
longDescription = ''
Enhancing productivity for every C and C++
developer on Linux, macOS and Windows.
'';
maintainers = with maintainers; [ edwtjo mic92 ];
platforms = platforms.linux;
};
}).overrideAttrs (attrs: {
nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ optionals (stdenv.isLinux) [
@ -58,14 +68,13 @@ let
product = "DataGrip";
meta = with lib; {
homepage = "https://www.jetbrains.com/datagrip/";
inherit description license;
inherit description license platforms;
longDescription = ''
DataGrip is a new IDE from JetBrains built for database admins.
It allows you to quickly migrate and refactor relational databases,
construct efficient, statically checked SQL queries and much more.
'';
maintainers = with maintainers; [ ];
platforms = platforms.linux;
};
});
@ -75,7 +84,7 @@ let
product = "Goland";
meta = with lib; {
homepage = "https://www.jetbrains.com/go/";
inherit description license;
inherit description license platforms;
longDescription = ''
Goland is the codename for a new commercial IDE by JetBrains
aimed at providing an ergonomic environment for Go development.
@ -83,10 +92,9 @@ let
and tool integrations specific for the Go language
'';
maintainers = [ maintainers.miltador ];
platforms = platforms.linux;
};
}).overrideAttrs (attrs: {
postFixup = (attrs.postFixup or "") + ''
postFixup = (attrs.postFixup or "") + lib.optionalString stdenv.isLinux ''
interp="$(cat $NIX_CC/nix-support/dynamic-linker)"
patchelf --set-interpreter $interp $out/goland*/plugins/go/lib/dlv/linux/dlv
@ -98,10 +106,10 @@ let
'';
});
buildIdea = { name, version, src, license, description, wmClass, ... }:
buildIdea = { name, version, src, license, description, wmClass, product, ... }:
(mkJetBrainsProduct {
inherit name version src wmClass jdk;
product = "IDEA";
inherit name version src wmClass jdk product;
productShort = "IDEA";
extraLdPath = [ zlib ];
extraWrapperArgs = [
''--set M2_HOME "${maven}/maven"''
@ -116,18 +124,18 @@ let
with JUnit, TestNG, popular SCMs, Ant & Maven. Also known
as IntelliJ.
'';
maintainers = with maintainers; [ edwtjo gytis-ivaskevicius ];
platforms = [ "x86_64-darwin" "i686-darwin" "i686-linux" "x86_64-linux" ];
maintainers = with maintainers; [ edwtjo gytis-ivaskevicius steinybot ];
platforms = ideaPlatforms;
};
});
buildMps = { name, version, src, license, description, wmClass, ... }:
buildMps = { name, version, src, license, description, wmClass, product, ... }:
(mkJetBrainsProduct rec {
inherit name version src wmClass jdk;
product = "MPS";
inherit name version src wmClass jdk product;
productShort = "MPS";
meta = with lib; {
homepage = "https://www.jetbrains.com/mps/";
inherit license description;
inherit license description platforms;
longDescription = ''
A metaprogramming system which uses projectional editing
which allows users to overcome the limits of language
@ -135,7 +143,6 @@ let
diagrams.
'';
maintainers = with maintainers; [ rasendubi ];
platforms = platforms.linux;
};
});
@ -145,24 +152,23 @@ let
product = "PhpStorm";
meta = with lib; {
homepage = "https://www.jetbrains.com/phpstorm/";
inherit description license;
inherit description license platforms;
longDescription = ''
PhpStorm provides an editor for PHP, HTML and JavaScript
with on-the-fly code analysis, error prevention and
automated refactorings for PHP and JavaScript code.
'';
maintainers = with maintainers; [ schristo ma27 ];
platforms = platforms.linux;
};
});
buildPycharm = { name, version, src, license, description, wmClass, ... }:
buildPycharm = { name, version, src, license, description, wmClass, product, ... }:
(mkJetBrainsProduct {
inherit name version src wmClass jdk;
product = "PyCharm";
inherit name version src wmClass jdk product;
productShort = "PyCharm";
meta = with lib; {
homepage = "https://www.jetbrains.com/pycharm/";
inherit description license;
inherit description license platforms;
longDescription = ''
Python IDE with complete set of tools for productive
development with Python programming language. In addition, the
@ -177,11 +183,8 @@ let
and productive development!
'';
maintainers = with maintainers; [ ];
platforms = platforms.linux;
};
}).override {
propagatedUserEnvPkgs = [ python3 ];
};
});
buildRider = { name, version, src, license, description, wmClass, ... }:
(mkJetBrainsProduct {
@ -189,7 +192,7 @@ let
product = "Rider";
meta = with lib; {
homepage = "https://www.jetbrains.com/rider/";
inherit description license;
inherit description license platforms;
longDescription = ''
JetBrains Rider is a new .NET IDE based on the IntelliJ
platform and ReSharper. Rider supports .NET Core,
@ -199,7 +202,6 @@ let
ASP.NET Core web applications.
'';
maintainers = [ maintainers.miltador ];
platforms = platforms.linux;
};
}).overrideAttrs (attrs: {
postPatch = lib.optionalString (!stdenv.isDarwin) (attrs.postPatch + ''
@ -215,10 +217,9 @@ let
product = "RubyMine";
meta = with lib; {
homepage = "https://www.jetbrains.com/ruby/";
inherit description license;
inherit description license platforms;
longDescription = description;
maintainers = with maintainers; [ edwtjo ];
platforms = platforms.linux;
};
});
@ -228,14 +229,13 @@ let
product = "WebStorm";
meta = with lib; {
homepage = "https://www.jetbrains.com/webstorm/";
inherit description license;
inherit description license platforms;
longDescription = ''
WebStorm provides an editor for HTML, JavaScript (incl. Node.js),
and CSS with on-the-fly code analysis, error prevention and
automated refactorings for JavaScript code.
'';
maintainers = with maintainers; [ abaldeau ];
platforms = platforms.linux;
};
}).overrideAttrs (attrs: {
postPatch = (attrs.postPatch or "") + optionalString (stdenv.isLinux) ''
@ -244,6 +244,7 @@ let
rm -r jbr
'';
});
in
{
@ -251,12 +252,12 @@ in
clion = buildClion rec {
name = "clion-${version}";
version = "2021.3.3"; /* updated by script */
version = products.clion.version;
description = "C/C++ IDE. New. Intelligent. Cross-platform";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/cpp/CLion-${version}.tar.gz";
sha256 = "03gil00srq3jljc13iyb7v1yc6l6yhdhqm9d1ld2j2pympl6p61m"; /* updated by script */
url = products.clion.url;
sha256 = products.clion.sha256;
};
wmClass = "jetbrains-clion";
update-channel = "CLion RELEASE"; # channel's id as in http://www.jetbrains.com/updates/updates.xml
@ -264,12 +265,12 @@ in
datagrip = buildDataGrip rec {
name = "datagrip-${version}";
version = "2021.3.4"; /* updated by script */
version = products.datagrip.version;
description = "Your Swiss Army Knife for Databases and SQL";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/datagrip/${name}.tar.gz";
sha256 = "09dkxj5vn99gkgc1yd18w7gqkw2vzci0z9q2fcih0zn7lvqp0im3"; /* updated by script */
url = products.datagrip.url;
sha256 = products.datagrip.sha256;
};
wmClass = "jetbrains-datagrip";
update-channel = "DataGrip RELEASE";
@ -277,12 +278,12 @@ in
goland = buildGoland rec {
name = "goland-${version}";
version = "2021.3.3"; /* updated by script */
version = products.goland.version;
description = "Up and Coming Go IDE";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/go/${name}.tar.gz";
sha256 = "18z4mvxhds5fgdwcfywc4pj8s9ifvsknhradgzmxsvji0fbp0awx"; /* updated by script */
url = products.goland.url;
sha256 = products.goland.sha256;
};
wmClass = "jetbrains-goland";
update-channel = "GoLand RELEASE";
@ -290,12 +291,13 @@ in
idea-community = buildIdea rec {
name = "idea-community-${version}";
version = "2021.3.2"; /* updated by script */
product = "IntelliJ IDEA CE";
version = products.idea-community.version;
description = "Integrated Development Environment (IDE) by Jetbrains, community edition";
license = lib.licenses.asl20;
src = fetchurl {
url = "https://download.jetbrains.com/idea/ideaIC-${version}.tar.gz";
sha256 = "1j889b2r950bl9wiqq1z8v8s2qicidfcdar300cy666i8rc25qlr"; /* updated by script */
url = products.idea-community.url;
sha256 = products.idea-community.sha256;
};
wmClass = "jetbrains-idea-ce";
update-channel = "IntelliJ IDEA RELEASE";
@ -303,12 +305,13 @@ in
idea-ultimate = buildIdea rec {
name = "idea-ultimate-${version}";
version = "2021.3.2"; /* updated by script */
product = "IntelliJ IDEA";
version = products.idea-ultimate.version;
description = "Integrated Development Environment (IDE) by Jetbrains, requires paid license";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/idea/ideaIU-${version}-no-jbr.tar.gz";
sha256 = "0w36qnqgkvw6j1ks09h515237bhqfaixrimzg2r494ic98amvkps"; /* updated by script */
url = products.idea-ultimate.url;
sha256 = products.idea-ultimate.sha256;
};
wmClass = "jetbrains-idea";
update-channel = "IntelliJ IDEA RELEASE";
@ -316,13 +319,13 @@ in
mps = buildMps rec {
name = "mps-${version}";
version = "2021.3"; /* updated by script */
versionMajorMinor = "2021.3"; /* updated by script */
product = "MPS ${products.mps.version-major-minor}";
version = products.mps.version;
description = "Create your own domain-specific language";
license = lib.licenses.asl20;
src = fetchurl {
url = "https://download.jetbrains.com/mps/${versionMajorMinor}/MPS-${version}.tar.gz";
sha256 = "0zw5xqdlhjfg0smfjl8xy7drf9spiwqbmqq8z22x4zb61lpvdbp9"; /* updated by script */
url = products.mps.url;
sha256 = products.mps.sha256;
};
wmClass = "jetbrains-mps";
update-channel = "MPS RELEASE";
@ -330,12 +333,12 @@ in
phpstorm = buildPhpStorm rec {
name = "phpstorm-${version}";
version = "2021.3.2"; /* updated by script */
version = products.phpstorm.version;
description = "Professional IDE for Web and PHP developers";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/webide/PhpStorm-${version}.tar.gz";
sha256 = "1qi0zq3gzcfnikky37g2dqgmzm7r1883k6asris8nph389qk86vn"; /* updated by script */
url = products.phpstorm.url;
sha256 = products.phpstorm.sha256;
};
wmClass = "jetbrains-phpstorm";
update-channel = "PhpStorm RELEASE";
@ -343,12 +346,13 @@ in
pycharm-community = buildPycharm rec {
name = "pycharm-community-${version}";
version = "2021.3.2"; /* updated by script */
product = "PyCharm CE";
version = products.pycharm-community.version;
description = "PyCharm Community Edition";
license = lib.licenses.asl20;
src = fetchurl {
url = "https://download.jetbrains.com/python/${name}.tar.gz";
sha256 = "1s36basydp7cxgbgdapjhkslx0x9vv3639xhm84ny76hf7s03bpi"; /* updated by script */
url = products.pycharm-community.url;
sha256 = products.pycharm-community.sha256;
};
wmClass = "jetbrains-pycharm-ce";
update-channel = "PyCharm RELEASE";
@ -356,12 +360,13 @@ in
pycharm-professional = buildPycharm rec {
name = "pycharm-professional-${version}";
version = "2021.3.2"; /* updated by script */
product = "PyCharm";
version = products.pycharm-professional.version;
description = "PyCharm Professional Edition";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/python/${name}.tar.gz";
sha256 = "0rwykngqgby05mh47kls8wzi68gfka2z04k6kdmsxwn1hhx5gnbb"; /* updated by script */
url = products.pycharm-professional.url;
sha256 = products.pycharm-professional.sha256;
};
wmClass = "jetbrains-pycharm";
update-channel = "PyCharm RELEASE";
@ -369,12 +374,12 @@ in
rider = buildRider rec {
name = "rider-${version}";
version = "2021.3.3"; /* updated by script */
version = products.rider.version;
description = "A cross-platform .NET IDE based on the IntelliJ platform and ReSharper";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/rider/JetBrains.Rider-${version}.tar.gz";
sha256 = "13q6hk5l3fqmz818z5wj014jd5iglpdcpi8zlpgaim1jg5fpvi8x"; /* updated by script */
url = products.rider.url;
sha256 = products.rider.sha256;
};
wmClass = "jetbrains-rider";
update-channel = "Rider RELEASE";
@ -382,12 +387,12 @@ in
ruby-mine = buildRubyMine rec {
name = "ruby-mine-${version}";
version = "2021.3.2"; /* updated by script */
version = products.ruby-mine.version;
description = "The Most Intelligent Ruby and Rails IDE";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/ruby/RubyMine-${version}.tar.gz";
sha256 = "18ny40zl9hgkynkc5yyy2xqngl9diifh2gqrfnz7rfq14kp10xb9"; /* updated by script */
url = products.ruby-mine.url;
sha256 = products.ruby-mine.sha256;
};
wmClass = "jetbrains-rubymine";
update-channel = "RubyMine RELEASE";
@ -395,12 +400,12 @@ in
webstorm = buildWebStorm rec {
name = "webstorm-${version}";
version = "2021.3.2"; /* updated by script */
version = products.webstorm.version;
description = "Professional IDE for Web and JavaScript development";
license = lib.licenses.unfree;
src = fetchurl {
url = "https://download.jetbrains.com/webstorm/WebStorm-${version}.tar.gz";
sha256 = "0q2hn48499hv7licpl84ly0bhiizya8a69dl2vjvgscj3cdkr98q"; /* updated by script */
url = products.webstorm.url;
sha256 = products.webstorm.sha256;
};
wmClass = "jetbrains-webstorm";
update-channel = "WebStorm RELEASE";

View file

@ -3,17 +3,15 @@
, vmopts ? null
}:
{ name, product, version, src, wmClass, jdk, meta, extraLdPath ? [], extraWrapperArgs ? [] }@args:
{ name, product, productShort ? product, version, src, wmClass, jdk, meta, extraLdPath ? [], extraWrapperArgs ? [] }@args:
with lib;
let loName = toLower product;
hiName = toUpper product;
let loName = toLower productShort;
hiName = toUpper productShort;
mainProgram = concatStringsSep "-" (init (splitString "-" name));
vmoptsName = loName
+ ( if (with stdenv.hostPlatform; (is32bit || isDarwin))
then ""
else "64" )
+ lib.optionalString stdenv.hostPlatform.is64bit "64"
+ ".vmoptions";
in
@ -36,7 +34,7 @@ with stdenv; lib.makeOverridable mkDerivation (rec {
nativeBuildInputs = [ makeWrapper patchelf unzip ];
postPatch = lib.optionalString (!stdenv.isDarwin) ''
postPatch = ''
get_file_size() {
local fname="$1"
echo $(ls -l $fname | cut -d ' ' -f5)
@ -73,7 +71,7 @@ with stdenv; lib.makeOverridable mkDerivation (rec {
item=${desktopItem}
makeWrapper "$out/$name/bin/${loName}.sh" "$out/bin/${mainProgram}" \
--prefix PATH : "$out/libexec/${name}:${lib.optionalString (stdenv.isDarwin) "${jdk}/jdk/Contents/Home/bin:"}${lib.makeBinPath [ jdk coreutils gnugrep which git ]}" \
--prefix PATH : "$out/libexec/${name}:${lib.makeBinPath [ jdk coreutils gnugrep which git ]}" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath ([
# Some internals want libstdc++.so.6
stdenv.cc.cc.lib libsecret e2fsprogs

View file

@ -1,101 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i perl -p perl perlPackages.LWPProtocolHttps perlPackages.FileSlurp
use strict;
use List::Util qw(reduce);
use File::Slurp;
use LWP::Simple;
my $only_free = grep { $_ eq "--only-free" } @ARGV;
sub semantic_less {
my ($a, $b) = @_;
$a =~ s/\b(\d+)\b/sprintf("%010s", $1)/eg;
$b =~ s/\b(\d+)\b/sprintf("%010s", $1)/eg;
return $a lt $b;
}
sub get_latest_versions {
my @channels = get("https://www.jetbrains.com/updates/updates.xml") =~ /(<channel .+?<\/channel>)/gs;
my %h = {};
for my $ch (@channels) {
my ($id) = $ch =~ /^<channel id="[^"]+" name="([^"]+)"/;
my @builds = $ch =~ /(<build .+?<\/build>)/gs;
my $latest_build = reduce {
my ($aversion) = $a =~ /^<build [^>]*version="([^"]+)"/; die "no version in $a" unless $aversion;
my ($bversion) = $b =~ /^<build [^>]*version="([^"]+)"/; die "no version in $b" unless $bversion;
semantic_less($aversion, $bversion) ? $b : $a;
} @builds;
next unless $latest_build;
# version as in download url
my ($version) = $latest_build =~ /^<build [^>]*version="([^"]+)"/;
my ($fullNumber) = $latest_build =~ /^<build [^>]*fullNumber="([^"]+)"/;
my $latest_version_full1 = "$version-$fullNumber";
$latest_version_full1 =~ s/\s*EAP//;
my ($latest_version) = $latest_build =~ /^<build [^>]*version="([^"]+)"/;
($latest_version) = $latest_build =~ /^<build [^>]*fullNumber="([^"]+)"/ if $latest_version =~ / /;
$h{$id} = $latest_version;
$h{"full1_" . $id} = $latest_version_full1;
}
return %h;
}
my %latest_versions = get_latest_versions();
# for my $ch (sort keys %latest_versions) {
# print("$ch $latest_versions{$ch}\n");
# }
sub update_nix_block {
my ($block) = @_;
my ($channel) = $block =~ /update-channel\s*=\s*"([^"]+)"/;
if ($channel) {
if ($latest_versions{$channel}) {
my ($version) = $block =~ /version\s*=\s*"([^"]+)"/;
die "no version in $block" unless $version;
if ($version eq $latest_versions{$channel}) {
print("$channel is up to date at $version\n");
} elsif ($only_free && $block =~ /licenses\.unfree/) {
print("$channel is unfree, skipping\n");
} else {
my $version_string = $latest_versions{$channel};
my $versionMajorMinor = $version_string =~ s/^([0-9]+[.][0-9]+).*/$1/r;
print("updating $channel: $version -> $version_string\n");
my ($url) = $block =~ /url\s*=\s*"([^"]+)"/;
# try to interpret some nix
my ($name) = $block =~ /name\s*=\s*"([^"]+)"/;
$name =~ s/\$\{version\}/$version_string/;
# Some url pattern contain variables more than once
$url =~ s/\$\{name\}/$name/g;
$url =~ s/\$\{version\}/$version_string/g;
$url =~ s/\$\{versionMajorMinor\}/$versionMajorMinor/g;
die "$url still has some interpolation" if $url =~ /\$/;
my ($sha256) = get("$url.sha256") =~ /^([0-9a-f]{64})/;
unless ( $sha256 ) {
my $full_version = $latest_versions{"full1_" . $channel};
$url =~ s/$version_string/$full_version/;
($sha256) = get("$url.sha256") =~ /^([0-9a-f]{64})/;
$version_string = $full_version;
}
die "invalid sha256 in $url.sha256" unless $sha256;
my ($sha256Base32) = readpipe("nix-hash --type sha256 --to-base32 $sha256");
chomp $sha256Base32;
print "Jetbrains published SHA256: $sha256\n";
print "Conversion into base32 yields: $sha256Base32\n";
$block =~ s#version\s*=\s*"([^"]+)".+$#version = "$version_string"; /* updated by script */#m;
$block =~ s#versionMajorMinor\s*=\s*"([^"]+)".+$#versionMajorMinor = "$versionMajorMinor"; /* updated by script */#m;
$block =~ s#sha256\s*=\s*"([^"]+)".+$#sha256 = "$sha256Base32"; /* updated by script */#m;
}
} else {
warn "unknown update-channel $channel";
}
}
return $block;
}
my $nix = read_file 'default.nix';
$nix =~ s/(= build\w+ rec \{.+?\n \};\n)/update_nix_block($1)/gse;
write_file 'default.nix', $nix;

View file

@ -0,0 +1,97 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3 python3.pkgs.packaging python3.pkgs.requests python3.pkgs.xmltodict
import hashlib
import json
import pathlib
import logging
import requests
import sys
import xmltodict
from packaging import version
updates_url = "https://www.jetbrains.com/updates/updates.xml"
versions_file_path = pathlib.Path(__file__).parent.joinpath("versions.json").resolve()
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
def one_or_more(x):
return x if isinstance(x, list) else [x]
def download_channels():
logging.info("Checking for updates from %s", updates_url)
updates_response = requests.get(updates_url)
updates_response.raise_for_status()
root = xmltodict.parse(updates_response.text)
products = root["products"]["product"]
return {
channel["@name"]: channel
for product in products
for channel in one_or_more(product["channel"])
}
def build_version(build):
return version.parse(build["@version"])
def latest_build(channel):
builds = one_or_more(channel["build"])
latest = max(builds, key=build_version)
return latest
def download_sha256(url):
download_response = requests.get(url)
download_response.raise_for_status()
h = hashlib.sha256()
h.update(download_response.content)
return h.hexdigest()
channels = download_channels()
def update_product(name, product):
update_channel = product["update-channel"]
logging.info("Updating %s", name)
channel = channels.get(update_channel)
if channel is None:
logging.error("Failed to find channel %s.", update_channel)
logging.error("Check that the update-channel in %s matches the name in %s", versions_file_path, updates_url)
else:
try:
build = latest_build(channel)
version = build["@version"]
parsed_version = build_version(build)
version_major_minor = f"{parsed_version.major}.{parsed_version.minor}"
download_url = product["url-template"].format(version = version, versionMajorMinor = version_major_minor)
product["url"] = download_url
product["version-major-minor"] = version_major_minor
if "sha256" not in product or product.get("version") != version:
logging.info("Found a newer version %s.", version)
product["version"] = version
product["sha256"] = download_sha256(download_url)
else:
logging.info("Already at the latest version %s.", version)
except Exception as e:
logging.exception("Update failed:", exc_info=e)
logging.warning("Skipping %s due to the above error.", name)
logging.warning("It may be out-of-date. Fix the error and rerun.")
def update_products(products):
for name, product in products.items():
update_product(name, product)
with open(versions_file_path, "r") as versions_file:
versions = json.load(versions_file)
for products in versions.values():
update_products(products)
with open(versions_file_path, "w") as versions_file:
json.dump(versions, versions_file, indent=2)
versions_file.write("\n")

View file

@ -0,0 +1,296 @@
{
"linux": {
"clion": {
"update-channel": "CLion RELEASE",
"url-template": "https://download.jetbrains.com/cpp/CLion-{version}.tar.gz",
"version": "2021.3.3",
"sha256": "35986be8adfe0a291a0d2d550c1bf4861ae6c33ecbc71198a472e0ac01a0f10d",
"url": "https://download.jetbrains.com/cpp/CLion-2021.3.3.tar.gz",
"version-major-minor": "2021.3"
},
"datagrip": {
"update-channel": "DataGrip RELEASE",
"url-template": "https://download.jetbrains.com/datagrip/datagrip-{version}.tar.gz",
"version": "2021.3.4",
"sha256": "a34670f1a6c77e00237302a70f22fb5bf089dfe128341fd89b2f25bb8becb325",
"url": "https://download.jetbrains.com/datagrip/datagrip-2021.3.4.tar.gz",
"version-major-minor": "2021.3"
},
"goland": {
"update-channel": "GoLand RELEASE",
"url-template": "https://download.jetbrains.com/go/goland-{version}.tar.gz",
"version": "2021.3.3",
"sha256": "9d2b709703516eddeb7f4d6568a7de2e268de4258c7bc7787baee806fbaee4a3",
"url": "https://download.jetbrains.com/go/goland-2021.3.3.tar.gz",
"version-major-minor": "2021.3"
},
"idea-community": {
"update-channel": "IntelliJ IDEA RELEASE",
"url-template": "https://download.jetbrains.com/idea/ideaIC-{version}.tar.gz",
"version": "2021.3.2",
"sha256": "99e2225846d118e3190023abc65c8b2c62a1d1463f601c79a20b9494c54a08c9",
"url": "https://download.jetbrains.com/idea/ideaIC-2021.3.2.tar.gz",
"version-major-minor": "2021.3"
},
"idea-ultimate": {
"update-channel": "IntelliJ IDEA RELEASE",
"url-template": "https://download.jetbrains.com/idea/ideaIU-{version}-no-jbr.tar.gz",
"version": "2021.3.2",
"sha256": "face5d154a2c9244b278bfc6dca37218ae3344090526a0679086eff9b0c56670",
"url": "https://download.jetbrains.com/idea/ideaIU-2021.3.2-no-jbr.tar.gz",
"version-major-minor": "2021.3"
},
"mps": {
"update-channel": "MPS RELEASE",
"url-template": "https://download.jetbrains.com/mps/{versionMajorMinor}/MPS-{version}.tar.gz",
"version": "2021.3",
"sha256": "e9aeb62f0d667dd285f808e3ba308f572797dbf11d51e9aa06cf49481bee857f",
"url": "https://download.jetbrains.com/mps/2021.3/MPS-2021.3.tar.gz",
"version-major-minor": "2021.3"
},
"phpstorm": {
"update-channel": "PhpStorm RELEASE",
"url-template": "https://download.jetbrains.com/webide/PhpStorm-{version}.tar.gz",
"version": "2021.3.2",
"sha256": "761b347142035e8b74cc5a9939100af9d45f1f6ee29de1e78cd6b1ff06fe20e2",
"url": "https://download.jetbrains.com/webide/PhpStorm-2021.3.2.tar.gz",
"version-major-minor": "2021.3"
},
"pycharm-community": {
"update-channel": "PyCharm RELEASE",
"url-template": "https://download.jetbrains.com/python/pycharm-community-{version}.tar.gz",
"version": "2021.3.2",
"sha256": "f1ae01f471d01c6f09aab0a761c6dea9834ef584f2aaf6d6ebecdce6b55a66e8",
"url": "https://download.jetbrains.com/python/pycharm-community-2021.3.2.tar.gz",
"version-major-minor": "2021.3"
},
"pycharm-professional": {
"update-channel": "PyCharm RELEASE",
"url-template": "https://download.jetbrains.com/python/pycharm-professional-{version}.tar.gz",
"version": "2021.3.2",
"sha256": "6bd9573a84c1f2ae6b9b6612f0859aee21133f479ace43602dc0af879f9d9e67",
"url": "https://download.jetbrains.com/python/pycharm-professional-2021.3.2.tar.gz",
"version-major-minor": "2021.3"
},
"rider": {
"update-channel": "Rider RELEASE",
"url-template": "https://download.jetbrains.com/rider/JetBrains.Rider-{version}.tar.gz",
"version": "2021.3.3",
"sha256": "1dc57d5d7932d4a8dea51fc5cbdaa52f9626490092978f02fa15bb41cb84068f",
"url": "https://download.jetbrains.com/rider/JetBrains.Rider-2021.3.3.tar.gz",
"version-major-minor": "2021.3"
},
"ruby-mine": {
"update-channel": "RubyMine RELEASE",
"url-template": "https://download.jetbrains.com/ruby/RubyMine-{version}.tar.gz",
"version": "2021.3.2",
"sha256": "697510ee2401bb7cbe75193f015d8c2dd1677117defbc2a6f5f3c1443f20dea2",
"url": "https://download.jetbrains.com/ruby/RubyMine-2021.3.2.tar.gz",
"version-major-minor": "2021.3"
},
"webstorm": {
"update-channel": "WebStorm RELEASE",
"url-template": "https://download.jetbrains.com/webstorm/WebStorm-{version}.tar.gz",
"version": "2021.3.2",
"sha256": "18a53c1b1b92e9b7e516b425a390f23f46b880a704d1cb223d1ba64410b15060",
"url": "https://download.jetbrains.com/webstorm/WebStorm-2021.3.2.tar.gz",
"version-major-minor": "2021.3"
}
},
"x86_64-darwin": {
"clion": {
"update-channel": "CLion RELEASE",
"url-template": "https://download.jetbrains.com/cpp/CLion-{version}.dmg",
"version": "2021.3.3",
"sha256": "342a4d8549ae4623a5edfa7f9737887cf0a25c1a61bb414b54b742b1c5a1a84d",
"url": "https://download.jetbrains.com/cpp/CLion-2021.3.3.dmg",
"version-major-minor": "2021.3"
},
"datagrip": {
"update-channel": "DataGrip RELEASE",
"url-template": "https://download.jetbrains.com/datagrip/datagrip-{version}.dmg",
"version": "2021.3.4",
"sha256": "27e709d2ced66d37a615d8c56885828e49a08962708e28df1a20f324c626bf52",
"url": "https://download.jetbrains.com/datagrip/datagrip-2021.3.4.dmg",
"version-major-minor": "2021.3"
},
"goland": {
"update-channel": "GoLand RELEASE",
"url-template": "https://download.jetbrains.com/go/goland-{version}.dmg",
"version": "2021.3.3",
"sha256": "4b245b6fe0cf588adbf36e68f12397d5fd311b0b6d49f17ba374ebaa10d207c9",
"url": "https://download.jetbrains.com/go/goland-2021.3.3.dmg",
"version-major-minor": "2021.3"
},
"idea-community": {
"update-channel": "IntelliJ IDEA RELEASE",
"url-template": "https://download.jetbrains.com/idea/ideaIC-{version}.dmg",
"version": "2021.3.2",
"sha256": "20d8cee2bbedaeb0ea388f795e13d08eca5b59e59d4e980ac2d8bc07c9fed3e9",
"url": "https://download.jetbrains.com/idea/ideaIC-2021.3.2.dmg",
"version-major-minor": "2021.3"
},
"idea-ultimate": {
"update-channel": "IntelliJ IDEA RELEASE",
"url-template": "https://download.jetbrains.com/idea/ideaIU-{version}.dmg",
"version": "2021.3.2",
"sha256": "9f574562b866e6ccc3d2f9b4c245c45844d1d0fd54be3dbdcc893d40ba1cf54a",
"url": "https://download.jetbrains.com/idea/ideaIU-2021.3.2.dmg",
"version-major-minor": "2021.3"
},
"mps": {
"update-channel": "MPS RELEASE",
"url-template": "https://download.jetbrains.com/mps/{versionMajorMinor}/MPS-{version}-macos.dmg",
"version": "2021.3",
"sha256": "2c5517518fec31ac960e4309fa848ad831f9048ef15df1b362e12aa8f41d9dbd",
"url": "https://download.jetbrains.com/mps/2021.3/MPS-2021.3-macos.dmg",
"version-major-minor": "2021.3"
},
"phpstorm": {
"update-channel": "PhpStorm RELEASE",
"url-template": "https://download.jetbrains.com/webide/PhpStorm-{version}.dmg",
"version": "2021.3.2",
"sha256": "596a9d5fdc30d5fba65ddd482da90f9d555fed748b930587562022bfe7df4e14",
"url": "https://download.jetbrains.com/webide/PhpStorm-2021.3.2.dmg",
"version-major-minor": "2021.3"
},
"pycharm-community": {
"update-channel": "PyCharm RELEASE",
"url-template": "https://download.jetbrains.com/python/pycharm-community-{version}.dmg",
"version": "2021.3.2",
"sha256": "b8f41f5dddeda0ed5f5c81ba57d2560ccc6e227987882fb6bf305b5d1d8c6909",
"url": "https://download.jetbrains.com/python/pycharm-community-2021.3.2.dmg",
"version-major-minor": "2021.3"
},
"pycharm-professional": {
"update-channel": "PyCharm RELEASE",
"url-template": "https://download.jetbrains.com/python/pycharm-professional-{version}.dmg",
"version": "2021.3.2",
"sha256": "188b998660e7cfb7ac1364c818c008a5608ab2aeb17c6cc19d1d9dda547d3775",
"url": "https://download.jetbrains.com/python/pycharm-professional-2021.3.2.dmg",
"version-major-minor": "2021.3"
},
"rider": {
"update-channel": "Rider RELEASE",
"url-template": "https://download.jetbrains.com/rider/JetBrains.Rider-{version}.dmg",
"version": "2021.3.3",
"sha256": "41a0939cb6258a0fb303268c5a466a663cf3588af14bcbb351be4c3a1d158094",
"url": "https://download.jetbrains.com/rider/JetBrains.Rider-2021.3.3.dmg",
"version-major-minor": "2021.3"
},
"ruby-mine": {
"update-channel": "RubyMine RELEASE",
"url-template": "https://download.jetbrains.com/ruby/RubyMine-{version}.dmg",
"version": "2021.3.2",
"sha256": "ba27c14b21d66ca96a64ceb7dc5d9f0952254a5f405b3201f51d2ad3cc749a96",
"url": "https://download.jetbrains.com/ruby/RubyMine-2021.3.2.dmg",
"version-major-minor": "2021.3"
},
"webstorm": {
"update-channel": "WebStorm RELEASE",
"url-template": "https://download.jetbrains.com/webstorm/WebStorm-{version}.dmg",
"version": "2021.3.2",
"sha256": "932d4920f831d1ceae68a474444c37d986277d8d3288d3aab93dd43d99336a36",
"url": "https://download.jetbrains.com/webstorm/WebStorm-2021.3.2.dmg",
"version-major-minor": "2021.3"
}
},
"aarch64-darwin": {
"clion": {
"update-channel": "CLion RELEASE",
"url-template": "https://download.jetbrains.com/cpp/CLion-{version}-aarch64.dmg",
"version": "2021.3.3",
"sha256": "fbf651fa4a5925fe729be30ca8a6fa3be84dc4d7827dbcf74f4d28c52b903cc2",
"url": "https://download.jetbrains.com/cpp/CLion-2021.3.3-aarch64.dmg",
"version-major-minor": "2021.3"
},
"datagrip": {
"update-channel": "DataGrip RELEASE",
"url-template": "https://download.jetbrains.com/datagrip/datagrip-{version}-aarch64.dmg",
"version": "2021.3.4",
"sha256": "7a77ba9fce56c781ae6a4fc65eaab4bcc10780b6bd679b04d74146719e42890a",
"url": "https://download.jetbrains.com/datagrip/datagrip-2021.3.4-aarch64.dmg",
"version-major-minor": "2021.3"
},
"goland": {
"update-channel": "GoLand RELEASE",
"url-template": "https://download.jetbrains.com/go/goland-{version}-aarch64.dmg",
"version": "2021.3.3",
"sha256": "54397d48e20fb534206e13f84b35868b1eaea13175176487b1239b23db4e13db",
"url": "https://download.jetbrains.com/go/goland-2021.3.3-aarch64.dmg",
"version-major-minor": "2021.3"
},
"idea-community": {
"update-channel": "IntelliJ IDEA RELEASE",
"url-template": "https://download.jetbrains.com/idea/ideaIC-{version}-aarch64.dmg",
"version": "2021.3.2",
"sha256": "79e540fb0cd480837b3a954e4802f4f252073955393e8927c9c1b28c37112d51",
"url": "https://download.jetbrains.com/idea/ideaIC-2021.3.2-aarch64.dmg",
"version-major-minor": "2021.3"
},
"idea-ultimate": {
"update-channel": "IntelliJ IDEA RELEASE",
"url-template": "https://download.jetbrains.com/idea/ideaIU-{version}-aarch64.dmg",
"version": "2021.3.2",
"sha256": "511c6aed9c5cd4c7665a9bac9ba94582977013244cbe88b820eb5464fce91a1c",
"url": "https://download.jetbrains.com/idea/ideaIU-2021.3.2-aarch64.dmg",
"version-major-minor": "2021.3"
},
"mps": {
"update-channel": "MPS RELEASE",
"url-template": "https://download.jetbrains.com/mps/{versionMajorMinor}/MPS-{version}-macos-aarch64.dmg",
"version": "2021.3",
"url": "https://download.jetbrains.com/mps/2021.3/MPS-2021.3-macos-aarch64.dmg",
"sha256": "3ace6d45db718dffd80bf126a76735fb65099de292112a01cc078aa61c475a70",
"version-major-minor": "2021.3"
},
"phpstorm": {
"update-channel": "PhpStorm RELEASE",
"url-template": "https://download.jetbrains.com/webide/PhpStorm-{version}-aarch64.dmg",
"version": "2021.3.2",
"sha256": "ba15c3f843c85141a9adaec1c4611224a853bd98649148751e34ac304591a314",
"url": "https://download.jetbrains.com/webide/PhpStorm-2021.3.2-aarch64.dmg",
"version-major-minor": "2021.3"
},
"pycharm-community": {
"update-channel": "PyCharm RELEASE",
"url-template": "https://download.jetbrains.com/python/pycharm-community-{version}-aarch64.dmg",
"version": "2021.3.2",
"sha256": "407bf395cfb6d61f1c0861c7679b197238780e82a019e10162b8cd7130edb15a",
"url": "https://download.jetbrains.com/python/pycharm-community-2021.3.2-aarch64.dmg",
"version-major-minor": "2021.3"
},
"pycharm-professional": {
"update-channel": "PyCharm RELEASE",
"url-template": "https://download.jetbrains.com/python/pycharm-professional-{version}-aarch64.dmg",
"version": "2021.3.2",
"sha256": "12fa34d1e60a555bac230acea9cd46c7adfe9ca42ff3e458c79d33e5b88eb8db",
"url": "https://download.jetbrains.com/python/pycharm-professional-2021.3.2-aarch64.dmg",
"version-major-minor": "2021.3"
},
"rider": {
"update-channel": "Rider RELEASE",
"url-template": "https://download.jetbrains.com/rider/JetBrains.Rider-{version}-aarch64.dmg",
"version": "2021.3.3",
"sha256": "65603860d1fd3134c5659f5a06de7cac17f3183a01056b79cfe72242b99adb37",
"url": "https://download.jetbrains.com/rider/JetBrains.Rider-2021.3.3-aarch64.dmg",
"version-major-minor": "2021.3"
},
"ruby-mine": {
"update-channel": "RubyMine RELEASE",
"url-template": "https://download.jetbrains.com/ruby/RubyMine-{version}-aarch64.dmg",
"version": "2021.3.2",
"sha256": "33773222b2fa14300de5ed12ca96c3442b933f66cef67cebc9610e5cef51c75e",
"url": "https://download.jetbrains.com/ruby/RubyMine-2021.3.2-aarch64.dmg",
"version-major-minor": "2021.3"
},
"webstorm": {
"update-channel": "WebStorm RELEASE",
"url-template": "https://download.jetbrains.com/webstorm/WebStorm-{version}-aarch64.dmg",
"version": "2021.3.2",
"sha256": "f4788ec0c55123b1f4e14934792f65bf8040e2a2ee673e985b50b8feded60408",
"url": "https://download.jetbrains.com/webstorm/WebStorm-2021.3.2-aarch64.dmg",
"version-major-minor": "2021.3"
}
}
}