2023-07-11 06:48:53 +00:00
|
|
|
"""
|
|
|
|
* 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
|
2023-08-05 11:01:58 +00:00
|
|
|
import collections
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
# 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():
|
2023-08-05 12:04:10 +00:00
|
|
|
"""" Debian 64 copy jobs
|
|
|
|
First we copy all the folder trees
|
|
|
|
Then we copy specific files.
|
|
|
|
The inputs are stored in the conf.py file
|
|
|
|
"""
|
2023-08-07 12:54:46 +00:00
|
|
|
# Get the CHROOT Folders
|
|
|
|
source_q = collections.deque(conf.src_paths_chroot_deb64)
|
|
|
|
destination_q = collections.deque(conf.des_paths_chroot_deb64)
|
2023-08-05 12:04:10 +00:00
|
|
|
src_size_q = len(source_q)
|
|
|
|
for p in range(src_size_q):
|
2023-08-05 11:01:58 +00:00
|
|
|
x = source_q.popleft()
|
|
|
|
y = destination_q.popleft()
|
2023-08-05 08:56:22 +00:00
|
|
|
shutil.copytree(cur_dir + x,
|
|
|
|
WP_CHROOT + y,
|
2023-08-05 08:44:26 +00:00
|
|
|
dirs_exist_ok=True
|
|
|
|
)
|
2023-08-07 12:54:46 +00:00
|
|
|
# Get the NONChroot Folders
|
|
|
|
source_n = collections.deque(conf.src_paths_non_chroot_deb64)
|
|
|
|
destination_n = collections.deque(conf.des_paths_non_chroot_deb64)
|
|
|
|
src_size_n = len(source_n)
|
|
|
|
for p in range(src_size_n):
|
|
|
|
x = source_n.popleft()
|
|
|
|
y = destination_n.popleft()
|
|
|
|
shutil.copytree(cur_dir + x,
|
|
|
|
cur_dir + y,
|
|
|
|
dirs_exist_ok=True
|
|
|
|
)
|
|
|
|
# Get Specific files for Chroot
|
2023-08-05 12:04:10 +00:00
|
|
|
source_f = collections.deque(conf.src_files_deb64)
|
|
|
|
destination_f = collections.deque(conf.des_files_deb64)
|
|
|
|
src_size_f = len(source_f)
|
|
|
|
for j in range(src_size_f):
|
|
|
|
w = source_f.popleft()
|
|
|
|
e = destination_f.popleft()
|
|
|
|
shutil.copy(cur_dir + w,
|
|
|
|
WP_CHROOT + e
|
|
|
|
)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
def run_build():
|
|
|
|
""" Run and start the build"""
|
|
|
|
run_cmd = 'sudo lb build'
|
|
|
|
os.chdir(home_folder)
|
|
|
|
os.chdir('fusato')
|
|
|
|
os.system(run_cmd)
|
|
|
|
|
2023-08-05 12:25:37 +00:00
|
|
|
|
2023-08-06 11:25:09 +00:00
|
|
|
def execute_build_cmds():
|
|
|
|
""" Loop through the commands for the
|
|
|
|
Build Process
|
|
|
|
"""
|
|
|
|
cmd_list = collections.deque(conf.deb_64_cmds)
|
|
|
|
cmd_size = len(cmd_list)
|
|
|
|
for h in range(cmd_size):
|
|
|
|
x = cmd_list.popleft()
|
|
|
|
execute = x + '()'
|
2023-08-06 11:34:32 +00:00
|
|
|
exec(execute)
|
|
|
|
|
|
|
|
|
2023-07-11 06:48:53 +00:00
|
|
|
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')
|
2023-08-06 11:25:09 +00:00
|
|
|
execute_build_cmds()
|
2023-07-11 06:48:53 +00:00
|
|
|
else:
|
|
|
|
os.makedirs('fusato')
|
2023-08-06 11:25:09 +00:00
|
|
|
execute_build_cmds()
|
2023-07-11 06:48:53 +00:00
|
|
|
|
2023-07-14 13:54:13 +00:00
|
|
|
|
2023-07-11 06:48:53 +00:00
|
|
|
readybuild()
|