Better status reports

windows-boot-fixes
Vadim vtroshchinskiy 2024-12-16 13:06:29 +01:00
parent ad021122a9
commit 3acb128bfd
1 changed files with 42 additions and 3 deletions

View File

@ -44,6 +44,7 @@ from ntfs import *
import re
import uuid
from tqdm import tqdm
from kernel import parse_kernel_cmdline
class OgProgressPrinter(git.RemoteProgress):
"""
@ -72,14 +73,49 @@ class OgProgressPrinter(git.RemoteProgress):
if sys.stdin.isatty():
self.progress = tqdm()
self.progress.miniters = 1
#self.progress.ascii = False
def update(self, op_code, cur_count, max_count=None, message=""):
op = op_code & git.RemoteProgress.OP_MASK
stage = op_code & git.RemoteProgress.STAGE_MASK
op_text = "Unknown"
op_unit = "?"
if op == git.RemoteProgress.COMPRESSING:
op_text = "Compressing"
op_unit = "Obj"
elif op == git.RemoteProgress.CHECKING_OUT:
op_text = "Checking out"
op_unit = "Obj"
elif op == git.RemoteProgress.COUNTING:
op_text = "Counting"
op_unit = "Obj"
elif op == git.RemoteProgress.RECEIVING:
op_text = "Receiving"
op_unit = "B"
elif op == git.RemoteProgress.WRITING:
op_text = "Writing"
op_unit = "B"
elif op == git.RemoteProgress.RESOLVING:
op_text = "Resolving deltas"
op_unit = "Obj"
self.logger.debug(f"Progress: {op_code} {cur_count}/{max_count}: {message}")
if self.progress:
if max_count is None:
return
if not self.progress is None:
self.progress.total = max_count
self.progress.n = cur_count
self.progress.desc = message
self.progress.desc = op_text #message
self.progress.unit = op_unit
self.progress.unit_scale = True
self.progress.refresh()
def __del__(self):
@ -217,13 +253,16 @@ class OpengnsysGitLibrary:
'.gitattributes'
]
self.kernel_args = self._parse_kernel_cmdline()
self.kernel_args = parse_kernel_cmdline()
self.repo_server = self.kernel_args["ogrepo"]
self.ip_address = self.kernel_args["ip"]
if not self.repo_server:
self.logger.warning("ogrepo kernel argument wasn't passed, or was empty. Defaulting to oglive.")
self.repo_server = self.kernel_args["oglive"]
"""Add any untracked files the code might have missed.
This is a workaround for a bug and it comes with a significant
performance penalty.