diff --git a/.ci/ci-generate-srcinfo.py b/.ci/ci-generate-srcinfo.py index d4d94088bd..b2a9b07ac0 100644 --- a/.ci/ci-generate-srcinfo.py +++ b/.ci/ci-generate-srcinfo.py @@ -29,6 +29,7 @@ import hashlib import time import shlex import subprocess +import gzip from concurrent.futures import ThreadPoolExecutor from functools import partial @@ -198,7 +199,7 @@ def main(argv: List[str]) -> Optional[Union[int, str]]: parser.add_argument('mode', choices=['msys', 'mingw'], help="The type of the repo") parser.add_argument("msys2_root", help="The path to MSYS2") parser.add_argument("repo_path", help="The path to GIT repo") - parser.add_argument("json_cache", help="The path to the json file used to fetch/store the results") + parser.add_argument("json_cache", help="The path to the json.gz file used to fetch/store the results") parser.add_argument("--time-limit", action="store", type=int, dest="time_limit", default=0, help='time after which it will stop and save, 0 means no limit') @@ -210,7 +211,7 @@ def main(argv: List[str]) -> Optional[Union[int, str]]: cache: Cache = {} try: with open(srcinfo_path, "rb") as h: - cache = json.loads(h.read()) + cache = json.loads(gzip.decompress(h.read())) except FileNotFoundError: pass @@ -226,7 +227,7 @@ def main(argv: List[str]) -> Optional[Union[int, str]]: srcinfos_dict = OrderedDict(sorted(srcinfos)) with open(srcinfo_path, "wb") as h: - h.write(json.dumps(srcinfos_dict, indent=2).encode("utf-8")) + h.write(gzip.compress(json.dumps(srcinfos_dict, indent=2).encode("utf-8"))) return None diff --git a/.github/workflows/generate-srcinfo.yml b/.github/workflows/generate-srcinfo.yml index c11c549355..4e1e032f90 100644 --- a/.github/workflows/generate-srcinfo.yml +++ b/.github/workflows/generate-srcinfo.yml @@ -27,24 +27,24 @@ jobs: msystem: MSYS update: true - - name: Download srcinfo.json and set up the environment + - name: Download srcinfo.json.gz and set up the environment shell: msys2 {0} run: | # XXX: linting PKGBUILDs takes a loooong time, this skips it sed -i s/^lint_pkgbuild/#lint_pkgbuild/g /usr/bin/makepkg # makepkg requires strip in PATH even if it wont be used touch /usr/bin/strip.exe - curl --fail -L --retry 5 -o srcinfo.json "https://github.com/$GITHUB_REPOSITORY/releases/download/srcinfo-cache/srcinfo.json" + curl --fail -L --retry 5 -o srcinfo.json.gz "https://github.com/$GITHUB_REPOSITORY/releases/download/srcinfo-cache/srcinfo.json.gz" - - name: Parse PKGBUILDs and update srcinfo.json + - name: Parse PKGBUILDs and update srcinfo.json.gz run: | $MSYS2_ROOT=(msys2 -c 'cygpath -w /') - python -u .ci/ci-generate-srcinfo.py --time-limit 19800 mingw "$MSYS2_ROOT" . srcinfo.json + python -u .ci/ci-generate-srcinfo.py --time-limit 19800 mingw "$MSYS2_ROOT" . srcinfo.json.gz - uses: actions/upload-artifact@v3 with: name: result - path: srcinfo.json + path: srcinfo.json.gz upload-srcinfo: needs: update-srcinfo @@ -56,9 +56,9 @@ jobs: with: name: result - - name: Upload srcinfo.json + - name: Upload srcinfo.json.gz run: | - gh release upload srcinfo-cache srcinfo.json --clobber --repo "$GITHUB_REPOSITORY" + gh release upload srcinfo-cache srcinfo.json.gz --clobber --repo "$GITHUB_REPOSITORY" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}