diff --git a/pkgs/servers/asterisk/default.nix b/pkgs/servers/asterisk/default.nix index eb8560a98b35..eeefe0dcd14f 100644 --- a/pkgs/servers/asterisk/default.nix +++ b/pkgs/servers/asterisk/default.nix @@ -4,6 +4,7 @@ lua, speex, libopus, opusfile, libogg, srtp, wget, curl, iksemel, pkg-config, autoconf, libtool, automake, + python39, writeScript, withOpus ? true, }: @@ -92,9 +93,9 @@ let }; }; - pjproject_2_10 = fetchurl { - url = "https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.10/pjproject-2.10.tar.bz2"; - sha256 = "14qmddinm4bv51rl0wwg5133r64x5bd6inwbx27ahb2n0151m2if"; + pjproject_2_12 = fetchurl { + url = "https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.12/pjproject-2.12.tar.bz2"; + hash = "sha256-T3q4r/4WCAZCNGnULxMnNKH9wEK7gkseV/sV8IPasHQ="; }; mp3-202 = fetchsvn { @@ -115,11 +116,17 @@ let versions = lib.mapAttrs (_: {version, sha256}: common { inherit version sha256; externals = { - "externals_cache/pjproject-2.10.tar.bz2" = pjproject_2_10; + "externals_cache/pjproject-2.12.tar.bz2" = pjproject_2_12; "addons/mp3" = mp3-202; }; }) (lib.importJSON ./versions.json); + updateScript_python = python39.withPackages (p: with p; [ packaging beautifulsoup4 requests ]); + updateScript = writeScript "asterisk-update" '' + #!/usr/bin/env bash + exec ${updateScript_python}/bin/python ${toString ./update.py} + ''; + in { # Supported releases (as of 2022-04-05). # Source: https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions @@ -131,6 +138,8 @@ in { # 19.x Standard 2021-11-02 2022-11-02 2023-11-02 asterisk-lts = versions.asterisk_18; asterisk-stable = versions.asterisk_19; - asterisk = versions.asterisk_19; + asterisk = versions.asterisk_19.overrideAttrs (o: { + passthru = (o.passthru or {}) // { inherit updateScript; }; + }); } // versions diff --git a/pkgs/servers/asterisk/update.py b/pkgs/servers/asterisk/update.py index 5a7fabf9d676..f8804744956f 100755 --- a/pkgs/servers/asterisk/update.py +++ b/pkgs/servers/asterisk/update.py @@ -1,8 +1,11 @@ #!/usr/bin/env nix-shell #!nix-shell -i python3 -p python39 python39.pkgs.packaging python39.pkgs.beautifulsoup4 python39.pkgs.requests +# mirrored in ./default.nix from packaging import version from bs4 import BeautifulSoup import re, requests, json +import os, sys +from pathlib import Path URL = "https://downloads.asterisk.org/pub/telephony/asterisk" @@ -23,8 +26,10 @@ for mv in major_versions.keys(): "sha256": sha } +versions_path = Path(sys.argv[0]).parent / "versions.json" + try: - with open("versions.json", "r") as in_file: + with open(versions_path, "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"]) @@ -32,5 +37,5 @@ except: # nice to have for the PR, not a requirement pass -with open("versions.json", "w") as out_file: +with open(versions_path, "w") as out_file: out_file.write(json.dumps(out, sort_keys=True, indent=2) + "\n") diff --git a/pkgs/servers/asterisk/versions.json b/pkgs/servers/asterisk/versions.json index f11f5547c3ef..77023dac2c28 100644 --- a/pkgs/servers/asterisk/versions.json +++ b/pkgs/servers/asterisk/versions.json @@ -1,14 +1,14 @@ { "asterisk_16": { - "sha256": "379c5529b9957c28734192999543486a0b0b24f6671b2e02e77cc809774e7ba9", - "version": "16.25.1" + "sha256": "201c92e591fc1db2c71b264907beef594d62d660168d42b5e83f9dc593b1bce0", + "version": "16.26.1" }, "asterisk_18": { - "sha256": "9db0e94e005a91a5433fc11173247065a5c40c9a7ca946577908f65d130b888e", - "version": "18.11.1" + "sha256": "acbb58e5c3cd2b9c7c4506fa80b717c3c3c550ce9722ff0177b4f11f98725563", + "version": "18.12.1" }, "asterisk_19": { - "sha256": "3e1fa31ef1de7813365dd8b98ef93744ff87902255472814d0232b955c794706", - "version": "19.3.1" + "sha256": "6b0b985163f20fcc8f8878069b8a9ee725eef4cfbdb1c1031fe3840fb32d7abe", + "version": "19.4.1" } }