asterisk: update updateScript to include python deps

This commit is contained in:
Yorick van Pelt 2022-05-24 13:49:28 +02:00
parent e527f7b181
commit 237b5838d3
No known key found for this signature in database
GPG key ID: A36E70F9DC014A15
2 changed files with 18 additions and 3 deletions

View file

@ -4,6 +4,7 @@
lua, speex, libopus, opusfile, libogg,
srtp, wget, curl, iksemel, pkg-config,
autoconf, libtool, automake,
python39, writeScript,
withOpus ? true,
}:
@ -120,6 +121,12 @@ let
};
}) (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,9 @@ 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: let
in {
passthru = (o.passthru or {}) // { inherit updateScript; };
});
} // versions

View file

@ -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")