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.

75 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. system('mkdir -p downloads')
  25. system(f'mv repos/{slug}/dist/{slug}-*.zip downloads/')
  26. def delete_package(slug):
  27. system(f'rm -f downloads/{slug}-*.zip')
  28. for filename in glob.glob("manifests/*"):
  29. slug = os.path.splitext(os.path.basename(filename))[0]
  30. with open(filename, "r") as f:
  31. manifest = json.load(f)
  32. # Skip if update is not needed
  33. if 'repoVersion' not in manifest:
  34. continue
  35. if 'latestVersion' in manifest and manifest['latestVersion'] == manifest['repoVersion']:
  36. continue
  37. if not os.path.exists('repos/' + slug):
  38. continue
  39. try:
  40. build_mac(slug)
  41. move_package(slug)
  42. build_win(slug)
  43. move_package(slug)
  44. build_lin(slug)
  45. move_package(slug)
  46. except Exception as e:
  47. print(e)
  48. input("Enter to proceed")
  49. delete_package(slug)
  50. continue
  51. # Update build information
  52. manifest['latestVersion'] = manifest['repoVersion']
  53. manifest['buildTimestamp'] = round(time.time())
  54. manifest['status'] = "available"
  55. with open(filename, "w") as f:
  56. json.dump(manifest, f, indent=" ")