bubbles/python_modules/deb_64.py

171 lines
5.3 KiB
Python

"""
* Author: "PeppermintOS Team(peppermintosteam@proton.me)
*
* License: SPDX-License-Identifier: GPL-3.0-or-later
*
* Move and copy files as needed
"""
import os
import shutil
from pathlib import Path
import conf
import paths
import inflate_bubble
import finish_cleanup
import copy_folders
import copy_files_specified
import queue
# Set the home path used regardless the user logged in
BSTRING = paths.bstring_iso_configs
home_folder = Path(BSTRING).expanduser()
# Move to iso_configs
os.chdir(home_folder)
# Set the working path
WP_CHROOT = paths.WPCHROOT
# Set the current working folder
cur_dir = os.getcwd().replace('/', '/')
def lbinit():
""" runs the lb config command for the iso build"""
current_dir = os.getcwd().replace('/', '/')
os.chdir(current_dir + '/fusato')
lbsetup = (conf.lbset_deb64)
os.system(lbsetup)
def copy_deb64_specific():
"""" Debian 64 copy jobs"""
source_q = queue.Queue()
destination_q = queue.Queue()
source_q.put("src_deb64_osrelease")
source_q.put("src_deb64_osrelease")
source_q.put("src_deb64_slpash")
source_q.put("src_deb64_isolinux")
source_q.put("src_deb64_multi")
source_q.put("src_deb_grub_theme")
source_q.put("src_deb64_modules")
source_q.put("src_deb_splash_image")
source_q.put("src_deb_splash_image")
source_q.put("src_deb_live_theme")
destination_q.put("des_osrelease")
destination_q.put("des_osrelease_opt")
destination_q.put("des_splash")
destination_q.put("des_isolinux")
destination_q.put("des_archives")
destination_q.put("des_grub_theme")
destination_q.put("des_modules")
destination_q.put("des_splash_image_isolinux")
destination_q.put("des_splash_image_grub")
destination_q.put("des_live_theme")
src_size = source_q.qsize()
for p in range(src_size):
x = source_q.get()
y = destination_q.get()
shutil.copytree(cur_dir + paths.x,
WP_CHROOT + paths.y,
dirs_exist_ok=True
)
shutil.copy(cur_dir + paths.src_deb64_grub_etc,
WP_CHROOT + paths.des_grub_etc
)
shutil.copy(cur_dir + paths.src_deb64_settings,
WP_CHROOT + paths.des_setttings
)
shutil.copy(cur_dir + paths.src_deb64_installer,
WP_CHROOT + paths.des_installer
)
shutil.copy(cur_dir + paths.src_deb64_sourcesfinal,
WP_CHROOT + paths.des_sourcesfinal
)
shutil.copy(cur_dir + paths.src_deb64_bootloader,
WP_CHROOT + paths.des_bootloader
)
shutil.copy(cur_dir + paths.src_deb64_netinstall,
WP_CHROOT + paths.des_netinstall
)
shutil.copy(cur_dir + paths.src_deb64_sourcelist,
WP_CHROOT + paths.des_sourcelist
)
shutil.copy(cur_dir + paths.src_main_line_pep_id,
WP_CHROOT + paths.des_main_line_pep_id
)
def run_build():
""" Run and start the build"""
run_cmd = 'sudo lb build'
os.chdir(home_folder)
os.chdir('fusato')
os.system(run_cmd)
def readybuild():
"""" Ready the bld structure"""
if os.path.exists('fusato'):
rm_cmd = "sudo rm -r -f fusato"
os.system(rm_cmd)
os.makedirs('fusato')
# Run lb config to begin the setup
lbinit()
# Prep the folders
inflate_bubble.set_fusato_structure()
# Packages
inflate_bubble.set_desktop_environment()
inflate_bubble.set_extra_packages()
inflate_bubble.set_general_packages()
inflate_bubble.set_system_packages()
inflate_bubble.set_system_packages_64()
inflate_bubble.set_artwork_packages()
inflate_bubble.set_python_packages()
inflate_bubble.set_calamares_packages()
inflate_bubble.set_firmware_packages()
inflate_bubble.set_binary_packages_64()
copy_folders.copy_folders_files()
copy_files_specified.copy_specific_files()
copy_files_specified.set_symlinks()
copy_deb64_specific()
run_build()
finish_cleanup.make_check_sum()
finish_cleanup.copy_iso_file_nightly_deb64()
finish_cleanup.copy_iso_file_prod_deb64()
finish_cleanup.kill_old_iso()
else:
os.makedirs('fusato')
# Run lb config to begin the setup
lbinit()
# Prep the folders
inflate_bubble.set_fusato_structure()
# Packages
inflate_bubble.set_desktop_environment()
inflate_bubble.set_extra_packages()
inflate_bubble.set_general_packages()
inflate_bubble.set_system_packages()
inflate_bubble.set_system_packages_64()
inflate_bubble.set_artwork_packages()
inflate_bubble.set_python_packages()
inflate_bubble.set_calamares_packages()
inflate_bubble.set_firmware_packages()
inflate_bubble.set_binary_packages_64()
copy_folders.copy_folders_files()
copy_files_specified.copy_specific_files()
copy_files_specified.set_symlinks()
copy_deb64_specific()
run_build()
finish_cleanup.make_check_sum()
finish_cleanup.copy_iso_file_nightly_deb64()
finish_cleanup.copy_iso_file_prod_deb64()
finish_cleanup.kill_old_iso()
readybuild()