Update: refractored build_iso code
Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
parent
b1479f9b5f
commit
7abceec209
|
@ -48,12 +48,18 @@ class BuildXfce:
|
|||
def __init__(self, sbase, sarch):
|
||||
self.sbase = sbase
|
||||
self.sarch = sarch
|
||||
# Change to the root of Fusato
|
||||
# then run the buils
|
||||
|
||||
|
||||
def initialize(self):
|
||||
os.chdir(HOME_FOLDER + FUSATO_ROOT)
|
||||
|
||||
|
||||
def run_build(self):
|
||||
self.build_system()
|
||||
|
||||
|
||||
|
||||
|
||||
def lb_helper(self):
|
||||
"""Helper for the lb setup shared for all builds"""
|
||||
# Define a dictionary to map sbase and sarch[1:] to lbsetup values
|
||||
|
@ -65,10 +71,8 @@ class BuildXfce:
|
|||
("dev", "32"): conf.LBSET_DEV32,
|
||||
("dev", "arm"): conf.LBSET_DEVARM,
|
||||
}
|
||||
|
||||
# Get lbsetup based on sbase and sarch[1:]
|
||||
lbsetup = lbsetups.get((self.sbase, self.sarch[1:]))
|
||||
|
||||
if lbsetup:
|
||||
os.system(lbsetup)
|
||||
else:
|
||||
|
@ -120,7 +124,7 @@ class BuildXfce:
|
|||
finish_cleanup.make_check_sum()
|
||||
finish_cleanup.check_build_type_xfce()
|
||||
finish_cleanup.kill_old_iso()
|
||||
|
||||
|
||||
|
||||
def build_system(self):
|
||||
"""Builds the ISO XFCE Depending on the Arch"""
|
||||
|
@ -143,19 +147,17 @@ class BuildXfce:
|
|||
# Cleanup after build
|
||||
self.cleanup_helper()
|
||||
|
||||
|
||||
def run_iso_build(self):
|
||||
"""Run the ISO build process"""
|
||||
run_cmd = 'sudo lb build'
|
||||
current_working_directory = os.getcwd()
|
||||
os.chdir(HOME_FOLDER + FUSATO_ROOT)
|
||||
|
||||
# Set the build indicator
|
||||
inflate_bubble.make_bld_xfce(self.sbase, self.sarch[1:])
|
||||
logger.info(current_working_directory)
|
||||
|
||||
# Execute the build command
|
||||
os.system(run_cmd)
|
||||
|
||||
logger.info(BUILD_COMPLETED)
|
||||
logger.info(current_working_directory)
|
||||
|
||||
|
@ -296,115 +298,69 @@ def readybuild():
|
|||
|
||||
|
||||
|
||||
class Decsions:
|
||||
class Decisions:
|
||||
"""
|
||||
Aguments used to tell the application what to build
|
||||
Arguments used to tell the application what to build
|
||||
"""
|
||||
def __init__(self):
|
||||
# Set up the terminal arguments
|
||||
def __init__(self, logger):
|
||||
""" Initialize the building """
|
||||
self.argument_parser = argparse.ArgumentParser()
|
||||
self.argument_parser.add_argument("set",
|
||||
help="set what build to start",
|
||||
type=str
|
||||
)
|
||||
self.argument_parser.add_argument("e",
|
||||
help="identify the desktop"
|
||||
" environment for example"
|
||||
" e-xfce",
|
||||
type=str
|
||||
)
|
||||
self.argument_parser.add_argument("b",
|
||||
help="identify the ISO to"
|
||||
"build for example"
|
||||
" b-deb64",
|
||||
type=str
|
||||
)
|
||||
self.argument_parser.add_argument("set",
|
||||
help="set what build to start", type=str
|
||||
)
|
||||
self.argument_parser.add_argument("e",
|
||||
help="identify the desktop environment, e.g., e-xfce", type=str
|
||||
)
|
||||
self.argument_parser.add_argument("b",
|
||||
help="identify the ISO to build, e.g., b-deb64", type=str
|
||||
)
|
||||
self.arguments = self.argument_parser.parse_args()
|
||||
# Then determine what desktop build to look for
|
||||
if self.arguments.e == 'e-gnomefb':
|
||||
self.dgnomefb()
|
||||
elif self.arguments.e == 'e-xfce':
|
||||
self.dxfce()
|
||||
elif self.arguments.e == 'e-openbox':
|
||||
self.dopenbox()
|
||||
self.logger = logger
|
||||
self.make_build_decision()
|
||||
|
||||
def make_build_decision(self):
|
||||
""" Make a decision on what to build """
|
||||
desktop_methods = {
|
||||
'e-gnomefb': self.dgnomefb,
|
||||
'e-xfce': self.dxfce,
|
||||
'e-openbox': self.dopenbox,
|
||||
}
|
||||
desktop_method = desktop_methods.get(self.arguments.e)
|
||||
if desktop_method:
|
||||
desktop_method()
|
||||
else:
|
||||
self.logger.critical("Unsupported desktop environment!")
|
||||
|
||||
def build_iso(self, builder_class):
|
||||
""" Common method for building ISOs """
|
||||
iso_builders = {
|
||||
'b-deb64': builder_class("deb", "_64"),
|
||||
'b-deb32': builder_class("deb", "_32"),
|
||||
'b-dev64': builder_class("dev", "_64"),
|
||||
'b-dev32': builder_class("dev", "_32"),
|
||||
'b-debarm': builder_class("deb", "_arm"),
|
||||
'b-devarm': builder_class("dev", "_arm"),
|
||||
}
|
||||
iso_builder = iso_builders.get(self.arguments.b)
|
||||
if iso_builder:
|
||||
readybuild()
|
||||
iso_builder.initialize()
|
||||
iso_builder.run_build()
|
||||
else:
|
||||
self.logger.critical("Unsupported ISO build!")
|
||||
|
||||
def dxfce(self):
|
||||
""" Arguments for the XFCE """
|
||||
if self.arguments.e == 'e-xfce':
|
||||
if self.arguments.b == 'b-deb64':
|
||||
readybuild()
|
||||
BuildXfce("deb", "_64")
|
||||
elif self.arguments.b == 'b-deb32':
|
||||
readybuild()
|
||||
BuildXfce("deb", "_32")
|
||||
elif self.arguments.b == 'b-dev64':
|
||||
readybuild()
|
||||
BuildXfce("dev", "_64")
|
||||
elif self.arguments.b == 'b-dev32':
|
||||
readybuild()
|
||||
BuildXfce("dev", "_32")
|
||||
elif self.arguments.b == 'b-debarm':
|
||||
readybuild()
|
||||
BuildXfce("deb", "_arm")
|
||||
elif self.arguments.b == 'b-devarm':
|
||||
readybuild()
|
||||
BuildXfce("dev", "_arm")
|
||||
else:
|
||||
logger.critical("You have not specified a build to process!")
|
||||
|
||||
self.build_iso(BuildXfce)
|
||||
|
||||
def dgnomefb(self):
|
||||
""" Arguments for the gnomefb """
|
||||
if self.arguments.e == 'e-gnomefb':
|
||||
if self.arguments.b == 'b-deb64':
|
||||
readybuild()
|
||||
BuildGflashback("deb", "_64")
|
||||
elif self.arguments.b == 'b-deb32':
|
||||
readybuild()
|
||||
BuildGflashback("deb", "_32")
|
||||
elif self.arguments.b == 'b-debarm':
|
||||
readybuild()
|
||||
BuildGflashback("deb", "_arm")
|
||||
elif self.arguments.b == 'b-dev32':
|
||||
readybuild()
|
||||
BuildGflashback("dev", "_32")
|
||||
elif self.arguments.b == 'b-dev64':
|
||||
readybuild()
|
||||
BuildGflashback("dev", "_64")
|
||||
elif self.arguments.b == 'b-devarm':
|
||||
readybuild()
|
||||
BuildGflashback("dev", "_arm")
|
||||
else:
|
||||
logger.critical("You have not specified a build to process!")
|
||||
|
||||
self.build_iso(BuildGflashback)
|
||||
|
||||
def dopenbox(self):
|
||||
""" Arguments for the openbox """
|
||||
if self.arguments.e == 'e-openbox':
|
||||
if self.arguments.b == 'b-deb64':
|
||||
readybuild()
|
||||
print('run openbox builds deb64')
|
||||
elif self.arguments.b == 'b-deb32':
|
||||
readybuild()
|
||||
print('run openbox builds deb32')
|
||||
elif self.arguments.b == 'b-dev64':
|
||||
readybuild()
|
||||
print('run openbox builds dev64')
|
||||
elif self.arguments.b == 'b-dev32':
|
||||
readybuild()
|
||||
print('run openbox builds dev32')
|
||||
elif self.arguments.b == 'b-debarm':
|
||||
readybuild()
|
||||
print('run openbox builds debarm')
|
||||
elif self.arguments.b == 'b-devarm':
|
||||
readybuild()
|
||||
print('run openbox builds devarm')
|
||||
else:
|
||||
print('You have not specified a valid '
|
||||
'build architecture!!')
|
||||
else:
|
||||
logger.critical("You have not specified a valid "
|
||||
"desktop environment!!")
|
||||
""" Arguments for Openbox """
|
||||
# Add logic for Openbox
|
||||
|
||||
|
||||
|
||||
Decsions()
|
||||
|
|
Loading…
Reference in New Issue