stackage: fix url substitution

Fixes https://github.com/tuna/issues/issues/1379
This commit is contained in:
Zenithal 2021-11-18 18:55:09 +08:00
parent 7f47e5cbc0
commit 0775ccadbc
No known key found for this signature in database
GPG Key ID: 1189C659F3D04C1C
2 changed files with 15 additions and 3 deletions

View File

@ -16,6 +16,7 @@ BASE_URL = os.getenv("TUNASYNC_UPSTREAM_URL", "https://api.github.com/repos/")
WORKING_DIR = os.getenv("TUNASYNC_WORKING_DIR")
REPOS = [
# owner/repo, tree, tree, tree, blob
## for stackage
["fpco/minghc", "master", "bin", "7z.exe"],
["fpco/minghc", "master", "bin", "7z.dll"],
]

View File

@ -53,12 +53,23 @@ class StackageSession(object):
)
if 'msys2' in d:
for os in d['msys2']:
print(os)
d['msys2'][os]['url'] = d['msys2'][os]['url'].replace(
if 'windows32' in d['msys2']:
print('windows32')
d['msys2']['windows32']['url'] = d['msys2']['windows32']['url'].replace(
'https://github.com/fpco/stackage-content/releases/download/',
'https://mirrors.tuna.tsinghua.edu.cn/github-release/commercialhaskell/stackage-content/msys2-')
if 'windows64' in d['msys2']:
print('windows64')
d['msys2']['windows64']['url'] = d['msys2']['windows64']['url'].replace(
'https://github.com/commercialhaskell/stackage-content/releases/download/',
'https://mirrors.tuna.tsinghua.edu.cn/github-release/commercialhaskell/stackage-content/')
if 'sevenzexe-info' in d:
d['sevenzexe-info']['url'] = 'https://mirrors.tuna.tsinghua.edu.cn/github-raw/fpco/minghc/master/bin/7z.exe'
if 'sevenzdll-info' in d:
d['sevenzdll-info']['url'] = 'https://mirrors.tuna.tsinghua.edu.cn/github-raw/fpco/minghc/master/bin/7z.dll'
for i in ['portable-git', 'stack', 'ghcjs']:
del d[i]
with open(self._base_path / 'stack-setup.yaml', 'w') as f: