Improve check_app_version script to use the app_version file

This commit is contained in:
Taylor Helsper 2020-11-26 13:19:51 -06:00
parent 49ed22a554
commit 84c41cf37d

View File

@ -16,6 +16,20 @@ apps = [{"name": "bitcoin/bitcoin", "current_version": "
{"name": "lnbits/lnbits", "current_version": "6cf4881"},
{"name": "apotdevin/thunderhub", "current_version": "v0.10.1"}
]
apps = [{"name": "bitcoin/bitcoin", "current_version_variable": "BTC_VERSION"},
{"name": "lightningnetwork/lnd", "current_version_variable": "LND_VERSION"},
{"name": "lightninglabs/loop", "current_version_variable": "LOOP_VERSION"},
{"name": "lightninglabs/pool", "current_version_variable": "POOL_VERSION"},
{"name": "romanz/electrs", "current_version": "v0.8.5"},
{"name": "Ride-The-Lightning/RTL", "current_version_variable": "RTL_VERSION"},
{"name": "janoside/btc-rpc-explorer", "current_version_variable": "BTCRPCEXPLORER_VERSION"},
{"name": "BlueWallet/LndHub", "current_version_variable": "LNDHUB_VERSION"},
{"name": "btcpayserver/btcpayserver", "current_version": "v1.0.5.9"},
{"name": "unchained-capital/caravan", "current_version_variable": "CARAVAN_VERSION"},
{"name": "cryptoadvance/specter-desktop", "current_version_variable": "SPECTER_VERSION"},
{"name": "lnbits/lnbits", "current_version": "6cf4881"},
{"name": "apotdevin/thunderhub", "current_version_variable": "THUNDERHUB_VERSION"}
]
# Apps that don't work or are not on GitHub
# - Samourai Whirlpool
@ -23,19 +37,41 @@ apps = [{"name": "bitcoin/bitcoin", "current_version": "
# -
def needs_update(current, latest):
if current != latest:
# Remove "v" since some variables are inconsistent in v1.2.3 vs 1.2.3
c = current.replace("v","")
l = latest.replace("v","")
if c != l:
return "X"
return ""
def get_current_version_from_variable(version_variable):
try:
with open("../rootfs/standard/usr/share/mynode/mynode_app_versions.sh", "r") as f:
lines = f.readlines()
for line in lines:
if version_variable in line:
parts = line.split("=")
version = parts[1]
version = version.replace("\"","").strip()
return version
except:
return "UNKNOWN FAIL"
return "UNKNOWN " + version_variable
def check_app_versions():
data=[]
for app in apps:
# Lookup current version from mynode_app_version.sh file
current_version = "UNKNOWN"
if "current_version_variable" in app:
current_version = get_current_version_from_variable(app["current_version_variable"])
else:
current_version = app["current_version"]
# Get data from github
github_url = "https://api.github.com/repos/" + app["name"] + "/releases/latest"
github_tag_url = "https://api.github.com/repos/" + app["name"] + "/tags"
row=[]
current_version = app["current_version"]
try:
r = requests.get(github_url)
j = r.json()