asterisk: add update script
This commit is contained in:
parent
f1d1ed4f02
commit
ab3980e73a
@ -90,7 +90,16 @@ let
|
||||
sha256 = "1s9idx2miwk178sa731ig9r4fzx4gy1q8xazfqyd7q4lfd70s1cy";
|
||||
};
|
||||
|
||||
in rec {
|
||||
# auto-generated by update.py
|
||||
versions = lib.mapAttrs (_: {version, sha256}: common {
|
||||
inherit version sha256;
|
||||
externals = {
|
||||
"externals_cache/pjproject-2.10.tar.bz2" = pjproject_2_10;
|
||||
"addons/mp3" = mp3-202;
|
||||
};
|
||||
}) (builtins.fromJSON (builtins.readFile ./versions.json));
|
||||
|
||||
in {
|
||||
# Supported releases (as of 2020-10-26).
|
||||
# Source: https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions
|
||||
# Exact version can be found at https://www.asterisk.org/downloads/asterisk/all-asterisk-versions/
|
||||
@ -100,43 +109,8 @@ in rec {
|
||||
# 16.x LTS 2018-10-09 2022-10-09 2023-10-09
|
||||
# 17.x Standard 2019-10-28 2020-10-28 2021-10-28
|
||||
# 18.x LTS 2020-10-20 2024-10-20 2025-10-20
|
||||
asterisk-lts = asterisk_18;
|
||||
asterisk-stable = asterisk_18;
|
||||
asterisk = asterisk_18;
|
||||
asterisk-lts = versions.asterisk_18;
|
||||
asterisk-stable = versions.asterisk_18;
|
||||
asterisk = versions.asterisk_18;
|
||||
|
||||
asterisk_13 = common {
|
||||
version = "13.38.2";
|
||||
sha256 = "1v7wgsa9vf7qycg3xpvmn2bkandkfh3x15pr8ylg0w0gvfkkf5b9";
|
||||
externals = {
|
||||
"externals_cache/pjproject-2.10.tar.bz2" = pjproject_2_10;
|
||||
"addons/mp3" = mp3-202;
|
||||
};
|
||||
};
|
||||
|
||||
asterisk_16 = common {
|
||||
version = "16.17.0";
|
||||
sha256 = "1bzlsk9k735qf8a693b6sa548my7m9ahavmdicwmc14px70wrvnw";
|
||||
externals = {
|
||||
"externals_cache/pjproject-2.10.tar.bz2" = pjproject_2_10;
|
||||
"addons/mp3" = mp3-202;
|
||||
};
|
||||
};
|
||||
|
||||
asterisk_17 = common {
|
||||
version = "17.9.3";
|
||||
sha256 = "0nhk0izrxx24pz806fwnhidjmciwrkcrsvxvhrdvibiqyvfk8yk7";
|
||||
externals = {
|
||||
"externals_cache/pjproject-2.10.tar.bz2" = pjproject_2_10;
|
||||
"addons/mp3" = mp3-202;
|
||||
};
|
||||
};
|
||||
|
||||
asterisk_18 = common {
|
||||
version = "18.3.0";
|
||||
sha256 = "1xb953i9ay82vcdv8izi5dd5xnspcsvg10ajiyph377jw2xnd5fb";
|
||||
externals = {
|
||||
"externals_cache/pjproject-2.10.tar.bz2" = pjproject_2_10;
|
||||
"addons/mp3" = mp3-202;
|
||||
};
|
||||
};
|
||||
}
|
||||
} // versions
|
||||
|
36
pkgs/servers/asterisk/update.py
Executable file
36
pkgs/servers/asterisk/update.py
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python3 -p python39 python39.pkgs.packaging python39.pkgs.beautifulsoup4 python39.pkgs.requests
|
||||
from packaging import version
|
||||
from bs4 import BeautifulSoup
|
||||
import re, requests, json
|
||||
|
||||
URL = "https://downloads.asterisk.org/pub/telephony/asterisk"
|
||||
|
||||
page = requests.get(URL)
|
||||
changelog = re.compile("^ChangeLog-\d+\.\d+\.\d+$")
|
||||
changelogs = [a.get_text() for a in BeautifulSoup(page.text, 'html.parser').find_all('a') if changelog.match(a.get_text())]
|
||||
major_versions = {}
|
||||
for changelog in changelogs:
|
||||
v = version.parse(changelog.removeprefix("ChangeLog-"))
|
||||
major_versions.setdefault(v.major, []).append(v)
|
||||
|
||||
out = {}
|
||||
for mv in major_versions.keys():
|
||||
v = max(major_versions[mv])
|
||||
sha = requests.get(f"{URL}/asterisk-{v}.sha256").text.split()[0]
|
||||
out["asterisk_" + str(mv)] = {
|
||||
"version": str(v),
|
||||
"sha256": sha
|
||||
}
|
||||
|
||||
try:
|
||||
with open("versions.json", "r") as in_file:
|
||||
in_data = json.loads(in_file.read())
|
||||
for v in in_data.keys():
|
||||
print(v + ":", in_data[v]["version"], "->", out[v]["version"])
|
||||
except:
|
||||
# nice to have for the PR, not a requirement
|
||||
pass
|
||||
|
||||
with open("versions.json", "w") as out_file:
|
||||
out_file.write(json.dumps(out, sort_keys=True, indent=2))
|
18
pkgs/servers/asterisk/versions.json
Normal file
18
pkgs/servers/asterisk/versions.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"asterisk_13": {
|
||||
"sha256": "1v7wgsa9vf7qycg3xpvmn2bkandkfh3x15pr8ylg0w0gvfkkf5b9",
|
||||
"version": "13.38.2"
|
||||
},
|
||||
"asterisk_16": {
|
||||
"sha256": "1bzlsk9k735qf8a693b6sa548my7m9ahavmdicwmc14px70wrvnw",
|
||||
"version": "16.17.0"
|
||||
},
|
||||
"asterisk_17": {
|
||||
"sha256": "0nhk0izrxx24pz806fwnhidjmciwrkcrsvxvhrdvibiqyvfk8yk7",
|
||||
"version": "17.9.3"
|
||||
},
|
||||
"asterisk_18": {
|
||||
"sha256": "1xb953i9ay82vcdv8izi5dd5xnspcsvg10ajiyph377jw2xnd5fb",
|
||||
"version": "18.3.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user