build-local.sh 1.2 KB

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # build-local.sh <engine checkout> [flatpak-builder args]: builds the Flathub manifest from the working trees, e.g.
  3. # packaging/flathub/build-local.sh ../linux-wallpaperengine-kde --user --install --force-clean build-dir
  4. set -e
  5. here=$(cd "$(dirname "$0")" && pwd)
  6. engine=$(cd "$1" && pwd)
  7. shift
  8. manifest="$here/local.yml"
  9. python3 - "$here/io.github.WallpaperEngineLover.we_manager.yml" "$manifest" "$engine" "$(cd "$here/../.." && pwd)" <<'PY'
  10. import sys
  11. source, target, engine, app = sys.argv[1:]
  12. text = open(source).read()
  13. for url, path in (('https://github.com/WallpaperEngineLover/linux-wallpaperengine-kde.git', engine),
  14. ('https://github.com/WallpaperEngineLover/we_manager.git', app)):
  15. start = text.index('url: ' + url)
  16. head = text.rindex('- type: git', 0, start)
  17. end = text.index('\n', text.index('commit:', start))
  18. indent = text[text.rindex('\n', 0, head) + 1:head]
  19. extra = '\n' + indent + ' skip: [node_modules, dist, out, build, .git]' if path == app else \
  20. '\n' + indent + ' skip: [build, .git]'
  21. text = text[:head] + '- type: dir\n' + indent + ' path: ' + path + extra + text[end:]
  22. open(target, 'w').write(text)
  23. PY
  24. exec flatpak-builder "$@" "$manifest"