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 (1411B)


  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. 'mc',
  22. 'openbsd',
  23. 'qbe',
  24. 'sbase',
  25. 'sdhcp',
  26. 'skeleton',
  27. 'st',
  28. 'swc',
  29. 'ubase',
  30. 'velox',
  31. 'wld',
  32. ])
  33. p = subprocess.Popen(['git', '-C', 'pkg', 'ls-tree', 'HEAD'], stdout=subprocess.PIPE)
  34. for line in p.stdout:
  35. fields = line.decode().split()
  36. if fields[1] != 'tree' or fields[3] in skip:
  37. continue
  38. name = fields[3]
  39. try:
  40. with open('pkg/{}/ver'.format(name), 'r') as f:
  41. oldver = f.read().rsplit(maxsplit=1)[0]
  42. except FileNotFoundError:
  43. continue
  44. proj = names.get(name, name)
  45. with urllib.request.urlopen('https://repology.org/api/v1/project/{}'.format(proj)) as response:
  46. pkgs = json.loads(response.read())
  47. newest = collections.Counter()
  48. for pkg in pkgs:
  49. if pkg['status'] in ('newest', 'unique'):
  50. newest[pkg['version']] += 1
  51. if not newest:
  52. print('could not find newest version of {}'.format(proj), file=sys.stderr)
  53. continue
  54. newver = newest.most_common(1)[0][0]
  55. if oldver != newver:
  56. print('{:20} {:16} => {:16}'.format(name, oldver, newver))
  57. if p.wait():
  58. raise CalledProcessError(p.retcode, p.args)