You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.9KB

  1. import glob
  2. import json
  3. import time
  4. import os
  5. def system(cmd):
  6. if os.system(cmd):
  7. raise Exception(f"Failed command: {cmd}")
  8. def build_mac(slug):
  9. env = f'CC=x86_64-apple-darwin15-clang CXX=x86_64-apple-darwin15-clang++-libc++ STRIP=x86_64-apple-darwin15-strip RACK_DIR=../../Rack-SDK'
  10. make = f'{env} make -j$(nproc) -C repos/{slug}'
  11. system(f'{make} clean')
  12. system(f'{make} dist')
  13. def build_win(slug):
  14. env = f'CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ STRIP=x86_64-w64-mingw32-strip RACK_DIR=../../Rack-SDK'
  15. make = f'{env} make -j$(nproc) -C repos/{slug}'
  16. system(f'{make} clean')
  17. system(f'{make} dist')
  18. def build_lin(slug):
  19. env = f'-e RACK_DIR=../../Rack-SDK'
  20. make = f'make -j$(nproc) -C repos/{slug}'
  21. system(f'docker run --rm -v $(pwd):/mnt -u vortico {env} a0b9c87ec456 {make} clean')
  22. system(f'docker run --rm -v $(pwd):/mnt -u vortico {env} a0b9c87ec456 {make} dist')
  23. def move_package(slug):
  24. os.system('mkdir -p downloads')
  25. if os.system(f'mv repos/{slug}/dist/{slug}-*.zip downloads/'):
  26. raise Exception(f"No package found for {slug}")
  27. for filename in glob.glob("manifests/*"):
  28. slug = os.path.splitext(os.path.basename(filename))[0]
  29. with open(filename, "r") as f:
  30. manifest = json.load(f)
  31. # Skip if update is not needed
  32. if 'repoVersion' not in manifest:
  33. continue
  34. if 'latestVersion' in manifest and manifest['latestVersion'] == manifest['repoVersion']:
  35. continue
  36. if not os.path.exists('repos/' + slug):
  37. continue
  38. try:
  39. build_mac(slug)
  40. move_package(slug)
  41. build_win(slug)
  42. move_package(slug)
  43. build_lin(slug)
  44. move_package(slug)
  45. except Exception as e:
  46. print(e)
  47. input("Enter to proceed")
  48. continue
  49. # Update build information
  50. manifest['latestVersion'] = manifest['repoVersion']
  51. manifest['buildTimestamp'] = round(time.time())
  52. manifest['status'] = "available"
  53. with open(filename, "w") as f:
  54. json.dump(manifest, f, indent=" ")