logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 020a443e3b98c15165bbbd378c5c876e7b1aa928
parent f9a9ca97042e50b283f940cdad73f1edd9344957
Author: Michael Forney <mforney@mforney.org>
Date:   Tue, 19 Mar 2019 01:19:40 -0700

Add script to check for out-of-date packages

Diffstat:

Ascripts/outdated.py57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+), 0 deletions(-)

diff --git a/scripts/outdated.py b/scripts/outdated.py @@ -0,0 +1,57 @@ +import collections +import json +import os +import subprocess +import sys +import urllib.request + +names = { + 'awk': 'nawk', + 'bc': 'bc-gh', + 'hostap': 'wpa-supplicant', + 'lua': 'lua52', + 'python': 'python3', + 'st': 'st-term', + 'terminus-font': 'fonts:terminus', + 'the_silver_searcher': 'the-silver-searcher', + 'tz': 'tzdata', +} +skip = set([ + 'adobe-source-fonts', + 'mc', + 'openbsd', + 'plan9port', + 'qbe', + 'sbase', + 'sdhcp', + 'skeleton', + 'st', + 'swc', + 'ubase', + 'velox', + 'wld', +]) + +p = subprocess.Popen(['git', '-C', 'pkg', 'ls-tree', 'HEAD'], stdout=subprocess.PIPE) +for line in p.stdout: + fields = line.decode().split() + if fields[1] != 'tree' or fields[3] in skip: + continue + name = fields[3] + with open('pkg/{}/ver'.format(name), 'r') as f: + oldver = f.read().rsplit(maxsplit=1)[0] + proj = names.get(name, name) + with urllib.request.urlopen('https://repology.org/api/v1/project/{}'.format(proj)) as response: + pkgs = json.loads(response.read()) + newest = collections.Counter() + for pkg in pkgs: + if pkg['status'] == 'newest': + newest[pkg['version']] += 1 + if not newest: + print('could not find newest version of {}'.format(proj), file=sys.stderr) + continue + newver = newest.most_common(1)[0][0] + if oldver != newver: + print('{:20} {:16} => {:16}'.format(name, oldver, newver)) +if p.wait(): + raise CalledProcessError(p.retcode, p.args)