Merge remote-tracking branch 'origin/main' into macos-next

# Conflicts:
#	CHANGELOG.md
#	opencore_legacy_patcher/constants.py
This commit is contained in:
Jazzzny
2025-11-30 23:01:38 -05:00
28 changed files with 1197 additions and 803 deletions

View File

@@ -46,6 +46,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
self.title: str = title
self.parent: wx.Frame = parent
self.catalog_products = None
self.available_installers = None
self.available_installers_latest = None
@@ -135,15 +136,15 @@ class macOSInstallerDownloadFrame(wx.Frame):
# Grab installer catalog
def _fetch_installers():
logging.info(f"Fetching installer catalog: {sucatalog.SeedType.DeveloperSeed.name}")
logging.info(f"Fetching AppleDB products")
sucatalog_contents = sucatalog.CatalogURL(seed=sucatalog.SeedType.DeveloperSeed).url_contents
if sucatalog_contents is None:
logging.error("Failed to download Installer Catalog from Apple")
self.catalog_products = sucatalog.AppleDBProducts(self.constants)
if self.catalog_products.data is None:
logging.error("Failed to fetch installers from AppleDB")
return
self.available_installers = sucatalog.CatalogProducts(sucatalog_contents).products
self.available_installers_latest = sucatalog.CatalogProducts(sucatalog_contents).latest_products
self.available_installers = self.catalog_products.products
self.available_installers_latest = self.catalog_products.latest_products
thread = threading.Thread(target=_fetch_installers)
@@ -165,7 +166,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
bundles = [wx.BitmapBundle.FromBitmaps(icon) for icon in self.icons]
self.frame_modal.Destroy()
self.frame_modal = wx.Dialog(self, title="Select macOS Installer", size=(505, 500))
self.frame_modal = wx.Dialog(self, title="Select macOS Installer", size=(550, 500))
# Title: Select macOS Installer
title_label = wx.StaticText(self.frame_modal, label="Select macOS Installer", pos=(-1,-1))
@@ -177,19 +178,19 @@ class macOSInstallerDownloadFrame(wx.Frame):
self.list = wx.ListCtrl(self.frame_modal, id, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_NO_HEADER | wx.BORDER_SUNKEN)
self.list.SetSmallImages(bundles)
self.list.InsertColumn(0, "Title", width=175)
self.list.InsertColumn(1, "Version", width=50)
self.list.InsertColumn(0, "Title", width=190 if show_full else 150)
self.list.InsertColumn(1, "Version", width=80 if show_full else 50)
self.list.InsertColumn(2, "Build", width=75)
self.list.InsertColumn(3, "Size", width=75)
self.list.InsertColumn(4, "Release Date", width=100)
installers = self.available_installers_latest if show_full is False else self.available_installers
if show_full is False:
self.frame_modal.SetSize((490, 370))
self.frame_modal.SetSize((480, 370))
if installers:
locale.setlocale(locale.LC_TIME, '')
logging.info(f"Available installers on SUCatalog ({'All entries' if show_full else 'Latest only'}):")
logging.info(f"Available installers from AppleDB ({'All entries' if show_full else 'Latest only'}):")
for item in installers:
logging.info(f"- {item['Title']} ({item['Version']} - {item['Build']}):\n - Size: {utilities.human_fmt(item['InstallAssistant']['Size'])}\n - Link: {item['InstallAssistant']['URL']}\n")
index = self.list.InsertItem(self.list.GetItemCount(), f"{item['Title']}")
@@ -199,8 +200,8 @@ class macOSInstallerDownloadFrame(wx.Frame):
self.list.SetItem(index, 3, utilities.human_fmt(item['InstallAssistant']['Size']))
self.list.SetItem(index, 4, item['PostDate'].strftime("%x"))
else:
logging.error("No installers found on SUCatalog")
wx.MessageDialog(self.frame_modal, "Failed to download Installer Catalog from Apple", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
logging.error("No installers found from AppleDB")
wx.MessageDialog(self.frame_modal, "Failed to fetch installers from AppleDB", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
if show_full is False:
self.list.Select(-1)
@@ -319,7 +320,11 @@ class macOSInstallerDownloadFrame(wx.Frame):
self.frame_modal.Close()
download_obj = network_handler.DownloadObject(selected_installer['InstallAssistant']['URL'], self.constants.payload_path / "InstallAssistant.pkg")
expected_checksum, checksum_algo = self.catalog_products.checksum_for_product(selected_installer)
download_obj = network_handler.DownloadObject(
selected_installer["InstallAssistant"]["URL"], self.constants.payload_path / "InstallAssistant.pkg", checksum_algo=checksum_algo
)
gui_download.DownloadFrame(
self,
@@ -334,24 +339,31 @@ class macOSInstallerDownloadFrame(wx.Frame):
self.on_return_to_main_menu()
return
self._validate_installer(selected_installer['InstallAssistant']['IntegrityDataURL'])
self._validate_installer(expected_checksum, download_obj.checksum)
def _validate_installer(self, chunklist_link: str) -> None:
def _validate_installer(self, expected_checksum: str, calculated_checksum: str) -> None:
"""
Validate macOS installer
"""
if expected_checksum != calculated_checksum:
logging.error(f"Checksum validation failed: Expected {expected_checksum}, got {calculated_checksum}")
wx.MessageBox(f"Checksum validation failed!\n\nThis generally happens when downloading on unstable connections such as WiFi or cellular.\n\nPlease try redownloading again on a stable connection (ie. Ethernet)", "Corrupted Installer!", wx.OK | wx.ICON_ERROR)
self.on_return_to_main_menu()
return
self.SetSize((300, 200))
for child in self.GetChildren():
child.Destroy()
# Title: Validating macOS Installer
title_label = wx.StaticText(self, label="Validating macOS Installer", pos=(-1,5))
logging.info("macOS installer validated")
title_label = wx.StaticText(self, label="Extracting macOS Installer", pos=(-1,5))
title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD))
title_label.Centre(wx.HORIZONTAL)
# Label: Validating chunk 0 of 0
chunk_label = wx.StaticText(self, label="Validating chunk 0 of 0", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
chunk_label = wx.StaticText(self, label="May take a few minutes...", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
chunk_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
chunk_label.Centre(wx.HORIZONTAL)
@@ -363,39 +375,6 @@ class macOSInstallerDownloadFrame(wx.Frame):
self.SetSize((-1, progress_bar.GetPosition()[1] + progress_bar.GetSize()[1] + 40))
self.Show()
chunklist_stream = network_handler.NetworkUtilities().get(chunklist_link).content
if chunklist_stream:
logging.info("Validating macOS installer")
utilities.disable_sleep_while_running()
chunk_obj = integrity_verification.ChunklistVerification(self.constants.payload_path / Path("InstallAssistant.pkg"), chunklist_stream)
if chunk_obj.chunks:
progress_bar.SetValue(chunk_obj.current_chunk)
progress_bar.SetRange(chunk_obj.total_chunks)
wx.App.Get().Yield()
chunk_obj.validate()
while chunk_obj.status == integrity_verification.ChunklistStatus.IN_PROGRESS:
progress_bar.SetValue(chunk_obj.current_chunk)
chunk_label.SetLabel(f"Validating chunk {chunk_obj.current_chunk} of {chunk_obj.total_chunks}")
chunk_label.Centre(wx.HORIZONTAL)
wx.App.Get().Yield()
if chunk_obj.status == integrity_verification.ChunklistStatus.FAILURE:
logging.error(f"Chunklist validation failed: Hash mismatch on {chunk_obj.current_chunk}")
wx.MessageBox(f"Chunklist validation failed: Hash mismatch on {chunk_obj.current_chunk}\n\nThis generally happens when downloading on unstable connections such as WiFi or cellular.\n\nPlease try redownloading again on a stable connection (ie. Ethernet)", "Corrupted Installer!", wx.OK | wx.ICON_ERROR)
self.on_return_to_main_menu()
return
logging.info("macOS installer validated")
# Extract installer
title_label.SetLabel("Extracting macOS Installer")
title_label.Centre(wx.HORIZONTAL)
chunk_label.SetLabel("May take a few minutes...")
chunk_label.Centre(wx.HORIZONTAL)
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
progress_bar_animation.start_pulse()