Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mareksapota:branches:X11:XOrg
amdvlk
update-version.py
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File update-version.py of Package amdvlk
#!/usr/bin/env python3 import argparse import http.client import os import urllib.request import xml.etree.ElementTree as ET def read_default_xml(default_xml): data = ET.fromstring(default_xml) projects = data.findall("project") version = {} for p in projects: name = p.get("name") revision = p.get("revision") version[name] = revision return version def get_latest_github_release(project, repo): connection = http.client.HTTPSConnection("github.com") connection.request("GET", f"/{project}/{repo}/releases/latest") response = connection.getresponse() connection.close() if response.status != 302 or "location" not in response.headers: raise RuntimeError( f"Failed to fetch latest github release for {project}/{repo}" ) else: return response.headers["location"].rsplit("/", 1)[-1] def update_obs_service_xml(obs_service_xml_path, new_rev): data = ET.parse(obs_service_xml_path) for obs_scm in data.findall("service[@name='obs_scm']"): name = obs_scm.findtext("param[@name='filename']") revision = obs_scm.find("param[@name='revision']") if name in new_rev: if revision.text != new_rev[name]: print(f"Updating {name} to {new_rev[name]}") revision.text = new_rev[name] else: print(f"{name} does not need to be updated") else: print(f"{name} not recognized, not updating") data.write(obs_service_xml_path, "utf-8") if __name__ == "__main__": parser = argparse.ArgumentParser(description="Scripts that updates amdvlk version.") parser.add_argument( "--obs-dir", default=".", help="Location of the obs amdvlk repo" ) args = parser.parse_args() amdvlk_release = get_latest_github_release("GPUOpen-Drivers", "AMDVLK") print(f"Latest AMDVLK version: {amdvlk_release}") default_xml_url = f"https://raw.githubusercontent.com/GPUOpen-Drivers/AMDVLK/{amdvlk_release}/default.xml" print(f"Reading versions from URL: {default_xml_url}") with urllib.request.urlopen(default_xml_url) as req: default_xml = req.read().decode("utf-8") versions = read_default_xml(default_xml) versions["amdvlk"] = f"refs/tags/{amdvlk_release}" versions["DirectXShaderCompiler"] = get_latest_github_release( "microsoft", "DirectXShaderCompiler" ) versions["glslang"] = get_latest_github_release("KhronosGroup", "glslang") obs_service_xml_path = os.path.join(args.obs_dir, "_service") print(f"Updating OBS _service file: {obs_service_xml_path}") update_obs_service_xml(obs_service_xml_path, versions)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor