bubbles/python_modules/deb_64.py

91 lines
2.2 KiB
Python
Raw Permalink Normal View History

2024-09-21 21:27:04 +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
import collections
# 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
First we copy all the folder trees
Then we copy specific files.
The inputs are stored in the conf.py file
"""
source_q = collections.deque(conf.src_paths_deb64)
destination_q = collections.deque(conf.des_paths_deb64)
src_size_q = len(source_q)
for p in range(src_size_q):
x = source_q.popleft()
y = destination_q.popleft()
shutil.copytree(cur_dir + x,
WP_CHROOT + y,
dirs_exist_ok=True
)
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
)
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')
cmd_q = collections.deque(conf.cmd_deb64_q)
cmd_q.popleft()
else:
os.makedirs('fusato')
cmd_q.popleft()
readybuild()