Archived
1
0
Fork 0
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:
Mary Guillemard 2024-02-11 16:45:58 +01:00 committed by GitHub
parent cf6201a4a6
commit baf94e0e3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,32 +58,68 @@ 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'):
def create_source_from_external(name, version):
full_dir_path = Path(os.environ["NUGET_PACKAGES"]).joinpath(name).joinpath(version)
os.makedirs(full_dir_path, exist_ok=True)
filename = "{}.{}.nupkg".format(name, version)
url = "https://api.nuget.org/v3-flatcontainer/{}/{}/{}".format(
name, version, filename
)
print(f"Processing {url}...")
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 name = path.parent.parent.name
version = path.parent.name version = path.parent.name
filename = '{}.{}.nupkg'.format(name, version) filename = "{}.{}.nupkg".format(name, version)
url = 'https://api.nuget.org/v3-flatcontainer/{}/{}/{}'.format(name, version, filename) url = "https://api.nuget.org/v3-flatcontainer/{}/{}/{}".format(
name, version, filename
)
with path.open() as fp: with path.open() as fp:
sha512 = binascii.hexlify(base64.b64decode(fp.read())).decode('ascii') sha512 = binascii.hexlify(base64.b64decode(fp.read())).decode("ascii")
sources.append({ sources.append(
'type': 'file', {
'url': url, "type": "file",
'sha512': sha512, "url": url,
'dest': os.environ['NUGET_SOURCES_DESTDIR'], "sha512": sha512,
'dest-filename': filename, "dest": os.environ["NUGET_SOURCES_DESTDIR"],
}) "dest-filename": filename,
}
)
with open('flathub/nuget_sources.json', 'w') as fp: # .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) json.dump(sources, fp, indent=4)
- name: Update flatpak metadata - name: Update flatpak metadata