logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

outdated.py (1404B)


  1. import collections
  2. import json
  3. import os
  4. import subprocess
  5. import sys
  6. import urllib.request
  7. names = {
  8. 'awk': 'nawk',
  9. 'lpeg': 'lua:lpeg',
  10. 'sshfs': 'fusefs:sshfs',
  11. 'st': 'st-term',
  12. 'terminus-font': 'fonts:terminus',
  13. 'the_silver_searcher': 'the-silver-searcher',
  14. 'tz': 'tzdata',
  15. 'wpa_supplicant': 'wpa-supplicant',
  16. }
  17. skip = set([
  18. 'adobe-source-fonts',
  19. 'cproc',
  20. 'libutp',
  21. 'openbsd',
  22. 'qbe',
  23. 'sbase',
  24. 'sdhcp',
  25. 'skeleton',
  26. 'st',
  27. 'swc',
  28. 'ubase',
  29. 'velox',
  30. 'wld',
  31. ])
  32. p = subprocess.Popen(['git', '-C', 'pkg', 'ls-tree', 'HEAD'], stdout=subprocess.PIPE)
  33. for line in p.stdout:
  34. fields = line.decode().split()
  35. if fields[1] != 'tree' or fields[3] in skip:
  36. continue
  37. name = fields[3]
  38. try:
  39. with open('pkg/{}/ver'.format(name), 'r') as f:
  40. oldver = f.read().rsplit(maxsplit=1)[0]
  41. except FileNotFoundError:
  42. continue
  43. proj = names.get(name, name)
  44. with urllib.request.urlopen('https://repology.org/api/v1/project/{}'.format(proj)) as response:
  45. pkgs = json.loads(response.read())
  46. newest = collections.Counter()
  47. for pkg in pkgs:
  48. if pkg['status'] in ('newest', 'unique'):
  49. newest[pkg['version']] += 1
  50. if not newest:
  51. print('could not find newest version of {}'.format(proj), file=sys.stderr)
  52. continue
  53. newver = newest.most_common(1)[0][0]
  54. if oldver != newver:
  55. print('{:20} {:16} => {:16}'.format(name, oldver, newver))
  56. if p.wait():
  57. raise CalledProcessError(p.retcode, p.args)