diff --git a/bin/package_build.py b/bin/package_build.py index 45f431b3..c23d2541 100755 --- a/bin/package_build.py +++ b/bin/package_build.py @@ -349,6 +349,33 @@ def pds(q): DATA.close() print(f"Saved!\nfilename: {q}") +def zopencommunity(): + url = "https://raw.githubusercontent.com/zopencommunity/meta/main/docs/api/zopen_releases_latest.json" + try: + req = requests.get(url) + data = req.json() + if req.status_code == 404: + raise Exception("404 File not found") + except Exception as e: + print("Couldn't pull. Error: ", str(e)) + else: + zopen_list = [] + for release in data['release_data']: + for asset in data['release_data'][release]: + package_info = { + "packageName": release, + "description": f"This is a zopen community port of {release}. Visit https://github.com/zopencommunity/{release}port for more details.", + "version": asset['assets'][0]['version'] + } + zopen_list.append(package_info) + + file_name = 'zopencommunity.json' + file_path = f'{DATA_FILE_LOCATION}/{file_name}' + + with open(file_path, 'w') as file: + json.dump(zopen_list, file, indent=2) + print(f"Saved!\nfilename: {file_name}") + if __name__ == "__main__": try: @@ -380,6 +407,9 @@ def pds(q): elif file == 'RockyLinux' or file == 'rockylinux': print(f"Extracting {file} data ... ") rockylinux() + elif file == 'ZopenCommunity' or file == 'zopencommunity': + print(f"Extracting data for {file} ... ") + zopencommunity() elif file == 'IBM-Validated' or file == 'ibm-validated': print(f"Extracting {file} data ... ") getIBMValidatedOpenSourceList(oskey) @@ -394,6 +424,7 @@ def pds(q): "\n./package_build.py rockylinux\n\t\t\t[if data is from RockyLinux]" "\n./package_build.py ibm-validated\n\t\t\t[if data is from IBM Validated Open Source List]" "\n./package_build.py\n\t\t\t[for displaying this help]\n" + "\n./package_build.py zopencommunity\n\t\t\t[if data is from zopen community]" "Example:\n./package_build.py RHEL_8_Package_List.json\n./package_build.py debian") print("Thanks for using SDT!") diff --git a/src/config/supported_distros.py.example b/src/config/supported_distros.py.example index 1e0ec262..46b0b705 100644 --- a/src/config/supported_distros.py.example +++ b/src/config/supported_distros.py.example @@ -4,6 +4,7 @@ SUPPORTED_DISTROS = { 'z/OS Rocket Software': 'ZOS_Rocket_Software', 'z/OS Open Mainframe Project': 'ZOS_OMP', 'z/OS from IBM-Z-zOS': 'IBM_Z_zOS' + 'z/OS from zopen community': 'zopencommunity' }, 'IBM Z and LinuxONE Container Registry': { 'Container Images for IBM Z and LinuxONE': 'IBMZ_container_registry'