Testing: Modules

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2023-12-13 19:33:36 +09:00
parent a46dff6e76
commit 055bc3c8f0
1 changed files with 36 additions and 3 deletions

View File

@ -44,34 +44,44 @@ class BuildBase:
Base class for building ISOs.
"""
def __init__(self, sbase, sarch, desktop_helper):
""" init the building process"""
self.sbase = sbase
self.sarch = sarch
self.change_to_fusato_root_and_build(desktop_helper)
def change_to_fusato_root_and_build(self, desktop_helper):
""" Change to the fusato root and build the ISO """
os.chdir(HOME_FOLDER + FUSATO_ROOT)
self.build_system(desktop_helper)
def lb_helper(self):
""" Helper to seto of the lb commands for live-build"""
lbsetup = None
if self.sbase in ["deb", "dev"]:
arch_suffix = self.sarch[1:]
if arch_suffix in ["64", "32", "arm"]:
lbsetup = getattr(conf, f"LBSET_{self.sbase.upper()}{arch_suffix}")
lbsetup = getattr(
conf, f"LBSET_{self.sbase.upper()}{arch_suffix}"
)
os.system(lbsetup)
return lbsetup
def infra_helper(self):
infra_methods = [infra.ChrootFolders, infra.BinaryFolders, infra.ArchitectureFiles, infra.Archive]
""" Get the build infrastucture ready """
infra_methods = [infra.ChrootFolders, infra.BinaryFolders,
infra.ArchitectureFiles, infra.Archive
]
for method in infra_methods:
method(self.sbase, self.sarch)
def cleanup_helper(self):
""" Clean and Move the comleted ISO """
finish_cleanup.make_check_sum()
finish_cleanup.check_build_type()
finish_cleanup.kill_old_iso()
def build_system(self, desktop_helper):
""" The actual building process """
current_working_directory = os.getcwd()
dir_current = WRKING_DIR + current_working_directory
logger.info(f"Building a {self.sbase}{self.sarch[1:]} bit ISO")
@ -86,7 +96,13 @@ class BuildBase:
run_cmd = 'sudo lb build'
os.chdir(HOME_FOLDER + FUSATO_ROOT)
desktop_name = desktop_helper.__name__.split('_')[-1]
inflate_bubble.make_bld(self.sbase, self.sarch[1:], desktop_name)
if desktop_name == 'xfce':
inflate_bubble.make_bld_xfce(self.sbase, self.sarch[1:])
elif desktop_name == 'gfb':
inflate_bubble.make_bld_gnomeflashback(self.sbase, self.sarch[1:])
else:
# Handle the case where the desktop type is not recognized
raise ValueError(f"Unknown desktop type: {desktop_name}")
logger.info(dir_current)
os.system(run_cmd)
logger.info(BUILD_COMPLETED)
@ -96,10 +112,17 @@ class BuildBase:
class BuildXfce(BuildBase):
""" This class will ensure the xfce builds are built """
def __init__(self, sbase, sarch):
""" i
nit the building, super will
ensure that the method resolution order (MRO) is followed
correctly, allowing for a smooth inheritance hierarchy.
"""
super().__init__(sbase, sarch, self.xfce_helper)
def xfce_helper(self):
""" The helper functions to ensure the xfce requirements are used """
arch_suffix = self.sarch[1:]
cmd_list = None
if arch_suffix in ["64", "32", "arm"]:
@ -110,10 +133,20 @@ class BuildXfce(BuildBase):
return cmd_list
class BuildGflashback(BuildBase):
""" This class will ensure the gnomeflashback builds are built """
def __init__(self, sbase, sarch):
"""
init the building, super will
ensure that the method resolution order (MRO) is followed
correctly, allowing for a smooth inheritance hierarchy
"""
super().__init__(sbase, sarch, self.gfb_helper)
def gfb_helper(self):
"""
The helper functions to ensure the gnome flashback requirements
are used
"""
arch_suffix = self.sarch[1:]
cmd_list = None
if arch_suffix in ["64", "32", "arm"]: