From 403b894424286b13fcdd3e0f5e38af0005dd24ad Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Sat, 17 Jul 2021 00:07:37 +0300 Subject: Add scripts folder with script Signed-off-by: Konstantin Aladyshev --- scripts/replace_guids.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/replace_guids.py (limited to 'scripts') diff --git a/scripts/replace_guids.py b/scripts/replace_guids.py new file mode 100644 index 0000000..c2d22ea --- /dev/null +++ b/scripts/replace_guids.py @@ -0,0 +1,34 @@ +from shutil import copyfile + +GUIDS_FILE_PATH = "Build/OvmfX64/DEBUG_GCC5/FV/Guid.xref" +EXTRA_GUIDS_FILE_PATH = "" +LOG_IN_FILE_PATH = "debug.log" +LOG_OUT_FILE_PATH = "debug_parsed.log" + +guids = {} + +with open(GUIDS_FILE_PATH) as p: + for line in p: + l = line.split(" ") + if len(l)==2: + guids[l[0].upper()] = l[1][:-1] + +if EXTRA_GUIDS_FILE_PATH: + with open(EXTRA_GUIDS_FILE_PATH) as p: + for line in p: + l = line.split(" ") + if len(l)==2: + guids[l[0].upper()] = l[1][:-1] + +copyfile(LOG_IN_FILE_PATH, LOG_OUT_FILE_PATH) + +f = open(LOG_OUT_FILE_PATH, 'r') +filedata = f.read() +f.close() + +for key,val in guids.items(): + filedata = filedata.replace(key, val) + +f = open(LOG_OUT_FILE_PATH, 'w') +f.write(filedata) +f.close() -- cgit v1.2.3-18-g5258