Troubleshoot: Module

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2023-12-12 13:33:12 +09:00
parent 2f11b4b388
commit c7b541e2bd
1 changed files with 47 additions and 40 deletions

View File

@ -55,20 +55,26 @@ class BuildXfce:
def lb_helper(self): def lb_helper(self):
""" """Helper for the lb setup shared for all builds"""
Helper for the lb setup this is shared for all builds # Define a dictionary to map sbase and sarch[1:] to lbsetup values
""" lbsetups = {
lbset_dict = { ("deb", "64"): conf.LBSET_DEB64,
"deb": {"64": conf.LBSET_DEB64, "32": conf.LBSET_DEB32, ("deb", "32"): conf.LBSET_DEB32,
"arm": conf.LBSET_DEBARM}, ("deb", "arm"): conf.LBSET_DEBARM,
"dev": {"64": conf.LBSET_DEV64, "32": conf.LBSET_DEV32, ("dev", "64"): conf.LBSET_DEV64,
"arm": conf.LBSET_DEVARM}, ("dev", "32"): conf.LBSET_DEV32,
("dev", "arm"): conf.LBSET_DEVARM,
} }
lbsetup = lbset_dict.get(self.sbase, {}).get(self.sarch[1:])
# Get lbsetup based on sbase and sarch[1:]
lbsetup = lbsetups.get((self.sbase, self.sarch[1:]))
if lbsetup: if lbsetup:
os.system(lbsetup) os.system(lbsetup)
else: else:
raise ValueError(f"Unsupported combination: {self.sbase},{self.sarch}") # Handle unsupported cases, e.g., raise an exception
raise ValueError(f"Unsupported combination: sbase={self.sbase}, sarch={self.sarch[1:]}")
def infra_helper(self): def infra_helper(self):
""" """
@ -84,17 +90,29 @@ class BuildXfce:
""" """
Helper for the xfce desktop shared for all builds Helper for the xfce desktop shared for all builds
""" """
cmd_list = { if self.sarch[1:] == "64":
"64": conf.build64_xfce_build, cmd_list = collections.deque(conf.build64_xfce_build)
"32": conf.build32_xfce_build, list_size = len(cmd_list)
"arm": conf.buildarm_xfce_build, for _ in range(list_size):
} i = cmd_list.popleft()
arch_cmds = cmd_list.get(self.sarch[1:]) execute = i + '()'
if arch_cmds: exec(execute)
for command in arch_cmds: elif self.sarch[1:] == "32":
print(f"Executing command: {command}") cmd_list = collections.deque(conf.build32_xfce_build)
getattr(getattr(conf, 'inflate_bubble'), 'set_fusato_structure')() list_size = len(cmd_list)
for _ in range(list_size):
i = cmd_list.popleft()
execute = i + '()'
exec(execute)
elif self.sarch[1:] == "arm":
cmd_list = collections.deque(conf.buildarm_xfce_build)
list_size = len(cmd_list)
for _ in range(list_size):
i = cmd_list.popleft()
execute = i + '()'
exec(execute)
else:
cmd_list = None
def cleanup_helper(self): def cleanup_helper(self):
@ -105,47 +123,36 @@ class BuildXfce:
def build_system(self): def build_system(self):
"""Builds the ISO XFCE Depending on the Arch""" """ Builds the ISO XFCE Depedning on the Arch """
current_working_directory = os.getcwd() current_working_directory = os.getcwd()
dir_current = WRKING_DIR + current_working_directory dir_current = WRKING_DIR + current_working_directory
logger.info(f"Building a {self.sbase}{self.sarch[1:]} bit ISO") logger.info(f"Building a {self.sbase}{self.sarch[1:]} bit ISO")
logger.info(dir_current) logger.info(dir_current)
# Set the config tree # Set the config tree
self.lb_helper() self.lb_helper()
# Start with the XFCE stuff # Start with the XFCE stuff
self.xfce_helper() self.xfce_helper()
# Run the specific classes # Run the specific classes
self.infra_helper() self.infra_helper()
# Run the Build # Run the Build
logger.info(CFG_READY) logger.info(CFG_READY)
logger.info(START_LIVEBUILD) logger.info(START_LIVEBUILD)
logger.info(dir_current) logger.info(dir_current)
self.lb_helper()
run_cmd = 'sudo lb build' run_cmd = 'sudo lb build'
current_working_directory = os.getcwd()
# Set the build indicator os.chdir(HOME_FOLDER + FUSATO_ROOT)
# Set the build inidcator
inflate_bubble.make_bld_xfce(self.sbase, self.sarch[1:]) inflate_bubble.make_bld_xfce(self.sbase, self.sarch[1:])
logger.info(dir_current) logger.info(dir_current)
os.chdir(HOME_FOLDER + FUSATO_ROOT)
current_working_directory = os.getcwd()
# Execute the build command
os.system(run_cmd) os.system(run_cmd)
logger.info(BUILD_COMPLETED) logger.info(BUILD_COMPLETED)
logger.info(dir_current) logger.info(dir_current)
# Perform cleanup
self.cleanup_helper() self.cleanup_helper()
logger.info(BUILD_COMPLETED) logger.info(BUILD_COMPLETED)
class BuildGflashback: class BuildGflashback:
""" """
Determine what base to use and then build the ISO Determine what base to use and then build the ISO