Update: Refractored xfce builder

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2023-12-12 12:47:58 +09:00
parent 42ceebf094
commit e851a2fb16
2 changed files with 48 additions and 62 deletions

View File

@ -211,17 +211,17 @@ cmbomenu = ttk.Combobox(pwin)
cmbomenu.place(x=10, y=135) cmbomenu.place(x=10, y=135)
cmbomenu['values'] = list(categories.values()) cmbomenu['values'] = list(categories.values())
icon_default_text = 'Set the icon with the "Icon" button' icon_default_text = 'Set the icon with the "Icon" button'
icon_value = tk.Text(pwin, height=1, width=36) icon_value = tk.Text(pwin, height=1, width=32)
icon_value.insert(tk.END, icon_default_text) icon_value.insert(tk.END, icon_default_text)
icon_value.place(x=10, y=280) icon_value.place(x=10, y=280)
icon_button = ttk.Button(pwin, text="Icon", width=7, cursor="hand2", icon_button = ttk.Button(pwin, text="Icon", width=7, cursor="hand2",
bootstyle="light-outline", command=select_icon bootstyle="light-outline", command=select_icon
) )
icon_button.place(x=232, y=324) icon_button.place(x=90, y=324)
url_default_text = "example: https://www.example.com" url_default_text = "example: https://www.example.com"
urladdr_label = ttk.Label(pwin, text="Enter the Url:") urladdr_label = ttk.Label(pwin, text="Enter the Url:")
urladdr_label.place(x=10, y=172) urladdr_label.place(x=10, y=172)
urladdr_value = tk.Text(pwin, height=3, width=36) urladdr_value = tk.Text(pwin, height=3, width=32)
urladdr_value.insert(tk.END, url_default_text) urladdr_value.insert(tk.END, url_default_text)
urladdr_value.place(x=10, y=200) urladdr_value.place(x=10, y=200)
@ -250,7 +250,7 @@ cmbo.place(x=330, y=80)
cmbo['values'] = fill_dropdown() cmbo['values'] = fill_dropdown()
runaddr_label = ttk.Label(pwin, text="Url Address:") runaddr_label = ttk.Label(pwin, text="Url Address:")
runaddr_label.place(x=330, y=125) runaddr_label.place(x=330, y=125)
runaddr_value = tk.Text(pwin, height=4, width=36) runaddr_value = tk.Text(pwin, height=4, width=32)
runaddr_value.place(x=330, y=150) runaddr_value.place(x=330, y=150)
btnrun = ttk.Button( btnrun = ttk.Button(
pwin, pwin,

View File

@ -6,10 +6,11 @@
* Build the ISOs for the system to be deployed * Build the ISOs for the system to be deployed
""" """
import os import os
import logging
from pathlib import Path from pathlib import Path
import argparse import argparse
import collections import collections
import logging
import conf import conf
import infra import infra
import inflate_bubble import inflate_bubble
@ -57,31 +58,19 @@ class BuildXfce:
""" """
Helper for the lb setup this is shared for all builds Helper for the lb setup this is shared for all builds
""" """
if self.sbase == "deb": lbset_dict = {
if self.sarch[1:] == "64": "deb": {"64": conf.LBSET_DEB64, "32": conf.LBSET_DEB32,
lbsetup = conf.LBSET_DEB64 "arm": conf.LBSET_DEBARM},
os.system(lbsetup) "dev": {"64": conf.LBSET_DEV64, "32": conf.LBSET_DEV32,
elif self.sarch[1:] == "32": "arm": conf.LBSET_DEVARM},
lbsetup = conf.LBSET_DEB32 }
os.system(lbsetup) lbsetup = lbset_dict.get(self.sbase, {}).get(self.sarch[1:])
elif self.sarch[1:] == "arm": if lbsetup:
lbsetup = conf.LBSET_DEBARM os.system(lbsetup)
os.system(lbsetup) else:
else: raise ValueError(f"Unsupported combination: {self.sbase},
lbsetup = None {self.sarch}"
elif self.sbase == "dev": )
if self.sarch[1:] == "64":
lbsetup = conf.LBSET_DEV64
os.system(lbsetup)
elif self.sarch[1:] == "32":
lbsetup = conf.LBSET_DEV32
os.system(lbsetup)
elif self.sarch[1:] == "arm":
lbsetup = conf.LBSET_DEVARM
os.system(lbsetup)
else:
lbsetup = None
def infra_helper(self): def infra_helper(self):
""" """
@ -97,29 +86,15 @@ class BuildXfce:
""" """
Helper for the xfce desktop shared for all builds Helper for the xfce desktop shared for all builds
""" """
if self.sarch[1:] == "64": cmd_list = {
cmd_list = collections.deque(conf.build64_xfce_build) "64": conf.build64_xfce_build,
list_size = len(cmd_list) "32": conf.build32_xfce_build,
for _ in range(list_size): "arm": conf.buildarm_xfce_build,
i = cmd_list.popleft() }
execute = i + '()' arch_cmds = cmd_list.get(self.sarch[1:])
exec(execute) if arch_cmds:
elif self.sarch[1:] == "32": for command in arch_cmds:
cmd_list = collections.deque(conf.build32_xfce_build) getattr(conf, command)()
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):
@ -130,34 +105,45 @@ class BuildXfce:
def build_system(self): def build_system(self):
""" Builds the ISO XFCE Depedning on the Arch """ """Builds the ISO XFCE Depending 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("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()
os.chdir(HOME_FOLDER + FUSATO_ROOT) # Set the build indicator
# 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)
self.cleanup_helper()
logger.info(BUILD_COMPLETED)
# Perform cleanup
self.cleanup_helper()
logger.info(BUILD_COMPLETED)
class BuildGflashback: class BuildGflashback: