forked from Mirror/Ryujinx
infra: Force add linux-x64 apphost in flathub nuget source (#6302)
Required when building on the arm64 runner. Signed-off-by: Mary Guillemard <mary@mary.zone>
This commit is contained in:
parent
cf6201a4a6
commit
baf94e0e3e
1 changed files with 52 additions and 16 deletions
68
.github/workflows/flatpak.yml
vendored
68
.github/workflows/flatpak.yml
vendored
|
@ -58,33 +58,69 @@ jobs:
|
||||||
- name: Generate nuget_sources.json
|
- name: Generate nuget_sources.json
|
||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
|
import hashlib
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
sources = []
|
sources = []
|
||||||
|
|
||||||
for path in Path(os.environ['NUGET_PACKAGES']).glob('**/*.nupkg.sha512'):
|
|
||||||
name = path.parent.parent.name
|
|
||||||
version = path.parent.name
|
|
||||||
filename = '{}.{}.nupkg'.format(name, version)
|
|
||||||
url = 'https://api.nuget.org/v3-flatcontainer/{}/{}/{}'.format(name, version, filename)
|
|
||||||
|
|
||||||
with path.open() as fp:
|
def create_source_from_external(name, version):
|
||||||
sha512 = binascii.hexlify(base64.b64decode(fp.read())).decode('ascii')
|
full_dir_path = Path(os.environ["NUGET_PACKAGES"]).joinpath(name).joinpath(version)
|
||||||
|
os.makedirs(full_dir_path, exist_ok=True)
|
||||||
|
|
||||||
sources.append({
|
filename = "{}.{}.nupkg".format(name, version)
|
||||||
'type': 'file',
|
url = "https://api.nuget.org/v3-flatcontainer/{}/{}/{}".format(
|
||||||
'url': url,
|
name, version, filename
|
||||||
'sha512': sha512,
|
)
|
||||||
'dest': os.environ['NUGET_SOURCES_DESTDIR'],
|
|
||||||
'dest-filename': filename,
|
|
||||||
})
|
|
||||||
|
|
||||||
with open('flathub/nuget_sources.json', 'w') as fp:
|
print(f"Processing {url}...")
|
||||||
json.dump(sources, fp, indent=4)
|
response = urllib.request.urlopen(url)
|
||||||
|
sha512 = hashlib.sha512(response.read()).hexdigest()
|
||||||
|
|
||||||
|
return {
|
||||||
|
"type": "file",
|
||||||
|
"url": url,
|
||||||
|
"sha512": sha512,
|
||||||
|
"dest": os.environ["NUGET_SOURCES_DESTDIR"],
|
||||||
|
"dest-filename": filename,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
has_added_x64_apphost = False
|
||||||
|
|
||||||
|
for path in Path(os.environ["NUGET_PACKAGES"]).glob("**/*.nupkg.sha512"):
|
||||||
|
name = path.parent.parent.name
|
||||||
|
version = path.parent.name
|
||||||
|
filename = "{}.{}.nupkg".format(name, version)
|
||||||
|
url = "https://api.nuget.org/v3-flatcontainer/{}/{}/{}".format(
|
||||||
|
name, version, filename
|
||||||
|
)
|
||||||
|
|
||||||
|
with path.open() as fp:
|
||||||
|
sha512 = binascii.hexlify(base64.b64decode(fp.read())).decode("ascii")
|
||||||
|
|
||||||
|
sources.append(
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"url": url,
|
||||||
|
"sha512": sha512,
|
||||||
|
"dest": os.environ["NUGET_SOURCES_DESTDIR"],
|
||||||
|
"dest-filename": filename,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# .NET will not add current installed application host to the list, force inject it here.
|
||||||
|
if not has_added_x64_apphost and name.startswith('microsoft.netcore.app.host'):
|
||||||
|
sources.append(create_source_from_external("microsoft.netcore.app.host.linux-x64", version))
|
||||||
|
has_added_x64_apphost = True
|
||||||
|
|
||||||
|
with open("flathub/nuget_sources.json", "w") as fp:
|
||||||
|
json.dump(sources, fp, indent=4)
|
||||||
|
|
||||||
- name: Update flatpak metadata
|
- name: Update flatpak metadata
|
||||||
id: metadata
|
id: metadata
|
||||||
|
|
Loading…
Reference in a new issue