Update: refractores the cleanup module, to be a bit more dynamic

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2023-10-19 13:52:08 +09:00
parent 5a4dff1bd8
commit e64b4c39ad
2 changed files with 111 additions and 61 deletions

View File

@ -126,7 +126,7 @@ class BuildXfce:
""" Clean up Helper to move the ISOs to the nightly location """
if self.sbase == "deb":
finish_cleanup.make_check_sum()
finish_cleanup.copy_debian_xfce_based()
finish_cleanup.check_build_type()
finish_cleanup.kill_old_iso()
else:
finish_cleanup.make_check_sum()

View File

@ -16,6 +16,15 @@ import time
BSTRING_ISO_CONFIGS = '~/bubbles/iso_configs'
HOME_FOLDER = str(Path(BSTRING_ISO_CONFIGS).expanduser())
FUSATO_ROOT = '/fusato'
# Set the base destination location for the final ISO
# Default base is /var/www/html/nightly/
BASE_DESTINATION = '/var/www/html/nightly/'
# Set the base ISO Name
BASE_NAME = 'PeppermintOS'
def make_check_sum():
@ -30,69 +39,110 @@ def make_check_sum():
gen_sum = sha + fiso + ' >' + fiso + ext
os.system(gen_sum)
def copy_debian_xfce_based():
""" Copy the new ISO debian baseto its Nightly folder
XFCE
"""
def check_build_type():
""" Simply used to change Directory to the root of fusato """
os.chdir(HOME_FOLDER + FUSATO_ROOT)
look_for_file = ['deb.64xfc', 'deb.32xfc', 'deb.armxfc']
def check_debian_xfce():
""" Check is a debian build is needed """
for build_version in look_for_file:
if build_version == 'deb.64xfc':
check_path = Path(build_version)
if check_path.is_file():
process_deb_64_xfce()
elif build_version == Path('deb.32xfc'):
check_path = Path(build_version)
if check_path.is_file():
process_deb_32_xfce()
elif build_version == Path('deb.armxfc'):
check_path = Path(build_version)
if check_path.is_file():
process_deb_arm_xfce()
else:
#check_devuan_xfce()
print("Nothing to do")
check_debian_xfce()
def process_deb_64_xfce():
"""
Copy the NEW 64 bit Debian base to its Nightly folder XFCE
"""
check_build_type()
current_working_directory = os.listdir(".")
today = str(date.today())
look_for_file_64 = Path('deb.64xfc')
look_for_file_32 = Path('deb.32xfc')
look_for_file_arm = Path('deb.armxfc')
for files in current_working_directory:
if files.endswith('.iso'):
src_iso = files
rdes = (BASE_NAME + '-Debian_64_xfce'
+ today +
'.iso'
)
des_iso = BASE_DESTINATION + 'deb64/xfce'
os.rename(src_iso, rdes)
shutil.copy(rdes, des_iso)
if files.endswith('.checksum'):
src_sum = files
rdes_sum = BASE_NAME + 'Debian_64_xfce-sha512.checksum'
des_sum = BASE_DESTINATION + 'deb64/xfce'
os.rename(src_sum, rdes_sum)
shutil.copy(rdes_sum, des_sum)
def process_deb_32_xfce():
"""
Copy the NEW 32 bit Debian base to its Nightly folder XFCE
"""
check_build_type()
current_working_directory = os.listdir(".")
today = str(date.today())
for files in current_working_directory:
if files.endswith('.iso'):
src_iso = files
rdes = (BASE_NAME + '-Debian_32_xfce'
+ today +
'.iso'
)
des_iso = BASE_DESTINATION + 'deb32/xfce'
os.rename(src_iso, rdes)
shutil.copy(rdes, des_iso)
if files.endswith('.checksum'):
src_sum = files
rdes_sum = BASE_NAME + 'Debian_32_xfce-sha512.checksum'
des_sum = BASE_DESTINATION + 'deb32/xfce'
os.rename(src_sum, rdes_sum)
shutil.copy(rdes_sum, des_sum)
def process_deb_arm_xfce():
"""
Copy the NEW arm bit Debian base to its Nightly folder XFCE
"""
check_build_type()
current_working_directory = os.listdir(".")
today = str(date.today())
for files in current_working_directory:
if files.endswith('.iso'):
src_iso = files
rdes = (BASE_NAME + '-Debian_arm_xfce'
+ today +
'.iso'
)
des_iso = BASE_DESTINATION + 'debarm/xfce'
os.rename(src_iso, rdes)
shutil.copy(rdes, des_iso)
if files.endswith('.checksum'):
src_sum = files
rdes_sum = BASE_NAME + 'Debian_arm_xfce-sha512.checksum'
des_sum = BASE_DESTINATION + 'debarm/xfce'
os.rename(src_sum, rdes_sum)
shutil.copy(rdes_sum, des_sum)
if look_for_file_64.is_file():
for f_v in current_working_directory:
if f_v.endswith('.iso'):
src_iso = f_v
rdes = ('PeppermintOS-Debian_64_xfce'
+ today +
'.iso'
)
des_iso = '/var/www/html/nightly/deb64/xfce'
os.rename(src_iso, rdes)
shutil.copy(rdes, des_iso)
if f_v.endswith('.checksum'):
src_sum = f_v
rdes_sum = 'PeppermintOS-Debian_64_xfce-sha512.checksum'
des_sum = '/var/www/html/nightly/deb64/xfce'
os.rename(src_sum, rdes_sum)
shutil.copy(rdes_sum, des_sum)
elif look_for_file_32.is_file():
for f_v in current_working_directory:
if f_v.endswith('.iso'):
src_iso = f_v
rdes = ('PeppermintOS-Debian_32_xfce'
+ today +
'.iso'
)
des_iso = '/var/www/html/nightly/deb32/xfce'
os.rename(src_iso, rdes)
shutil.copy(rdes, des_iso)
if f_v.endswith('.checksum'):
src_sum = f_v
rdes_sum = 'PeppermintOS-Debian_32_xfce-sha512.checksum'
des_sum = '/var/www/html/nightly/deb32/xfce'
os.rename(src_sum, rdes_sum)
shutil.copy(rdes_sum, des_sum)
elif look_for_file_arm.is_file():
for f_v in current_working_directory:
if f_v.endswith('.iso'):
src_iso = f_v
rdes = ('PeppermintOS-Debian_arm_xfce'
+ today +
'.iso'
)
des_iso = '/var/www/html/nightly/debarm/xfce'
os.rename(src_iso, rdes)
shutil.copy(rdes, des_iso)
if f_v.endswith('.checksum'):
src_sum = f_v
rdes_sum = 'PeppermintOS-Debian_arma_xfce-sha512.checksum'
des_sum = '/var/www/html/nightly/debarm/xfce'
os.rename(src_sum, rdes_sum)
shutil.copy(rdes_sum, des_sum)
def copy_debian_gfb_based():
@ -415,7 +465,7 @@ def copy_devuan_opb_based():
def kill_old_iso():
""" Delete older ISOs"""
base_path = '/var/www/html/nightly/'
base_path = BASE_DESTINATION
arch_list = ['deb32/', 'deb64/', 'debarm/', 'dev32/', 'dev64/', 'devarm/']
de_list = ['gnome-flashback', 'openbox', 'xfce']
for archs in arch_list: