mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 11:02:03 -08:00
Developer UI: Add break option in "Find broken Patches"
Adds a option in "Find broken patches" to break after one reject file was found.
This commit is contained in:
parent
3c53be2a45
commit
0b650d8dfd
1 changed files with 20 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ def into_camoufox_dir():
|
||||||
def reset_camoufox():
|
def reset_camoufox():
|
||||||
"""Reset the Camoufox source"""
|
"""Reset the Camoufox source"""
|
||||||
with temp_cd('..'):
|
with temp_cd('..'):
|
||||||
run('make clean')
|
run('make revert')
|
||||||
|
|
||||||
|
|
||||||
def run_patches(reverse=False):
|
def run_patches(reverse=False):
|
||||||
|
|
@ -230,10 +230,27 @@ def handle_choice(choice):
|
||||||
case "Find broken patches (resets workspace)":
|
case "Find broken patches (resets workspace)":
|
||||||
reset_camoufox()
|
reset_camoufox()
|
||||||
|
|
||||||
|
get_all = None
|
||||||
|
|
||||||
broken_patches = []
|
broken_patches = []
|
||||||
for patch_file in list_patches():
|
for patch_file in list_patches():
|
||||||
|
print(f'Testing: {patch_file}')
|
||||||
if reject_files := get_rejects(patch_file):
|
if reject_files := get_rejects(patch_file):
|
||||||
|
# Add the patch to the list
|
||||||
broken_patches.append((patch_file, reject_files))
|
broken_patches.append((patch_file, reject_files))
|
||||||
|
# If get_all is None, ask the user if they want to get all the rejects
|
||||||
|
if get_all is None:
|
||||||
|
get_all = easygui.ynbox(
|
||||||
|
f"Reject was found: {patch_file}.\nGet the rest of them?",
|
||||||
|
"Get All Rejects",
|
||||||
|
choices=["Yes", "No"]
|
||||||
|
)
|
||||||
|
# If the user closed the dialog, return
|
||||||
|
if get_all is None:
|
||||||
|
return
|
||||||
|
# If the user said no, break the patch loop
|
||||||
|
if not get_all:
|
||||||
|
break
|
||||||
|
|
||||||
if not broken_patches:
|
if not broken_patches:
|
||||||
easygui.msgbox("All patches applied successfully.", "Patching Result")
|
easygui.msgbox("All patches applied successfully.", "Patching Result")
|
||||||
|
|
@ -249,10 +266,9 @@ def handle_choice(choice):
|
||||||
for patch_file, rejects in broken_patches:
|
for patch_file, rejects in broken_patches:
|
||||||
message += f"Patch: {patch_file[len('../patches/'):]}\nRejects:\n"
|
message += f"Patch: {patch_file[len('../patches/'):]}\nRejects:\n"
|
||||||
for reject in rejects:
|
for reject in rejects:
|
||||||
message += f"{reject}\n"
|
|
||||||
with open(reject, 'r') as f:
|
with open(reject, 'r') as f:
|
||||||
message += f.read()
|
count = len(re.findall('^@@.*', f.read(), re.MULTILINE))
|
||||||
message += "-" * 62 + "\n"
|
message += f"{count} reject(s) > {reject}\n"
|
||||||
message += '\n'
|
message += '\n'
|
||||||
easygui.textbox("Patching Result", "Failed Patches", message)
|
easygui.textbox("Patching Result", "Failed Patches", message)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue