jetbrains: update script fixes
This commit is contained in:
parent
3635410a48
commit
efe5ba0c4f
|
@ -260,7 +260,7 @@ in
|
|||
sha256 = products.clion.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-clion";
|
||||
update-channel = "CLion RELEASE"; # channel's id as in http://www.jetbrains.com/updates/updates.xml
|
||||
update-channel = products.clion.update-channel;
|
||||
};
|
||||
|
||||
datagrip = buildDataGrip rec {
|
||||
|
@ -273,7 +273,7 @@ in
|
|||
sha256 = products.datagrip.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-datagrip";
|
||||
update-channel = "DataGrip RELEASE";
|
||||
update-channel = products.datagrip.update-channel;
|
||||
};
|
||||
|
||||
goland = buildGoland rec {
|
||||
|
@ -286,7 +286,7 @@ in
|
|||
sha256 = products.goland.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-goland";
|
||||
update-channel = "GoLand RELEASE";
|
||||
update-channel = products.goland.update-channel;
|
||||
};
|
||||
|
||||
idea-community = buildIdea rec {
|
||||
|
@ -300,7 +300,7 @@ in
|
|||
sha256 = products.idea-community.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-idea-ce";
|
||||
update-channel = "IntelliJ IDEA RELEASE";
|
||||
update-channel = products.idea-community.update-channel;
|
||||
};
|
||||
|
||||
idea-ultimate = buildIdea rec {
|
||||
|
@ -314,12 +314,12 @@ in
|
|||
sha256 = products.idea-ultimate.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-idea";
|
||||
update-channel = "IntelliJ IDEA RELEASE";
|
||||
update-channel = products.idea-ultimate.update-channel;
|
||||
};
|
||||
|
||||
mps = buildMps rec {
|
||||
pname = "mps";
|
||||
product = "MPS ${products.mps.version-major-minor}";
|
||||
product = "MPS ${products.mps.version}";
|
||||
version = products.mps.version;
|
||||
description = "Create your own domain-specific language";
|
||||
license = lib.licenses.asl20;
|
||||
|
@ -328,7 +328,7 @@ in
|
|||
sha256 = products.mps.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-mps";
|
||||
update-channel = "MPS RELEASE";
|
||||
update-channel = products.mps.update-channel;
|
||||
};
|
||||
|
||||
phpstorm = buildPhpStorm rec {
|
||||
|
@ -341,7 +341,7 @@ in
|
|||
sha256 = products.phpstorm.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-phpstorm";
|
||||
update-channel = "PhpStorm RELEASE";
|
||||
update-channel = products.phpstorm.update-channel;
|
||||
};
|
||||
|
||||
pycharm-community = buildPycharm rec {
|
||||
|
@ -355,7 +355,7 @@ in
|
|||
sha256 = products.pycharm-community.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-pycharm-ce";
|
||||
update-channel = "PyCharm RELEASE";
|
||||
update-channel = products.pycharm-community.update-channel;
|
||||
};
|
||||
|
||||
pycharm-professional = buildPycharm rec {
|
||||
|
@ -369,7 +369,7 @@ in
|
|||
sha256 = products.pycharm-professional.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-pycharm";
|
||||
update-channel = "PyCharm RELEASE";
|
||||
update-channel = products.pycharm-professional.update-channel;
|
||||
};
|
||||
|
||||
rider = buildRider rec {
|
||||
|
@ -382,7 +382,7 @@ in
|
|||
sha256 = products.rider.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-rider";
|
||||
update-channel = "Rider RELEASE";
|
||||
update-channel = products.rider.update-channel;
|
||||
};
|
||||
|
||||
ruby-mine = buildRubyMine rec {
|
||||
|
@ -395,7 +395,7 @@ in
|
|||
sha256 = products.ruby-mine.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-rubymine";
|
||||
update-channel = "RubyMine RELEASE";
|
||||
update-channel = products.ruby-mine.update-channel;
|
||||
};
|
||||
|
||||
webstorm = buildWebStorm rec {
|
||||
|
@ -408,7 +408,7 @@ in
|
|||
sha256 = products.webstorm.sha256;
|
||||
};
|
||||
wmClass = "jetbrains-webstorm";
|
||||
update-channel = "WebStorm RELEASE";
|
||||
update-channel = products.webstorm.update-channel;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#! /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
|
||||
|
@ -33,7 +32,8 @@ def download_channels():
|
|||
|
||||
|
||||
def build_version(build):
|
||||
return version.parse(build["@version"])
|
||||
build_number = build["@fullNumber"] if "@fullNumber" in build else build["@number"]
|
||||
return version.parse(build_number)
|
||||
|
||||
|
||||
def latest_build(channel):
|
||||
|
@ -43,11 +43,10 @@ def latest_build(channel):
|
|||
|
||||
|
||||
def download_sha256(url):
|
||||
url = f"{url}.sha256"
|
||||
download_response = requests.get(url)
|
||||
download_response.raise_for_status()
|
||||
h = hashlib.sha256()
|
||||
h.update(download_response.content)
|
||||
return h.hexdigest()
|
||||
return download_response.content.decode('UTF-8').split(' ')[0]
|
||||
|
||||
|
||||
channels = download_channels()
|
||||
|
@ -63,18 +62,22 @@ def update_product(name, product):
|
|||
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)
|
||||
new_version = build["@version"]
|
||||
new_build_number = build["@fullNumber"]
|
||||
if "EAP" not in channel["@name"]:
|
||||
version_or_build_number = new_version
|
||||
else:
|
||||
version_or_build_number = new_build_number
|
||||
version_number = new_version.split(' ')[0]
|
||||
download_url = product["url-template"].format(version=version_or_build_number, versionMajorMinor=version_number)
|
||||
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
|
||||
if "sha256" not in product or product.get("build_number") != new_build_number:
|
||||
logging.info("Found a newer version %s with build number %s.", new_version, new_build_number)
|
||||
product["version"] = new_version
|
||||
product["build_number"] = new_build_number
|
||||
product["sha256"] = download_sha256(download_url)
|
||||
else:
|
||||
logging.info("Already at the latest version %s.", version)
|
||||
logging.info("Already at the latest version %s with build number %s.", new_version, new_build_number)
|
||||
except Exception as e:
|
||||
logging.exception("Update failed:", exc_info=e)
|
||||
logging.warning("Skipping %s due to the above error.", name)
|
||||
|
|
Loading…
Reference in a new issue