Updated for slpkg.log file

This commit is contained in:
Dimitris Zlatanidis 2024-03-19 22:35:24 +02:00
parent dd4cd0822d
commit 0e4c2d8865
4 changed files with 20 additions and 6 deletions

View file

@ -141,8 +141,13 @@ class Packages(Configs):
self.check_md5.md5sum(self.tmp_slpkg, package, pkg_checksum)
def install_packages(self) -> None:
# Remove old slpkg.log file.
if self.slpkg_log_file.is_file():
self.slpkg_log_file.unlink()
if self.binary_packages:
print(f'Started the processing of ({self.cyan}{len(self.binary_packages)}{self.endc}) packages:\n')
for package in self.binary_packages:
command: str = f'{self.slackware_command} {self.tmp_slpkg}/{package}'
self.multi_proc.run(command, package, self.progress_message)

View file

@ -62,8 +62,8 @@ class MultiProcess(Configs):
Build the package and write a log file.
Args:
command: The command of process
stdout:
stderr:
stdout: Captured stdout from the child process.
stderr: Captured stderr from the child process.
Returns:
None.
"""
@ -75,9 +75,9 @@ class MultiProcess(Configs):
# Write the timestamp at the head of the log file.
with open(self.slpkg_log_file, 'a') as log:
log.write(len(head_message) * '=' + '\n')
log.write(f"{len(head_message) * '='}\n")
log.write(f'{head_message}\n')
log.write(len(head_message) * '=' + '\n\n')
log.write(f"{len(head_message) * '='}\n")
# Write the process to the log file and to the terminal.
with process.stdout as output:
@ -89,9 +89,9 @@ class MultiProcess(Configs):
# Write the bottom of the log file.
with open(self.slpkg_log_file, 'a') as log:
log.write('\n' + len(bottom_message) * '=' + '\n')
log.write(f"\n{len(bottom_message) * '='}\n")
log.write(f'{bottom_message}\n')
log.write(len(bottom_message) * '=')
log.write(f"{len(bottom_message) * '='}\n\n")
process.wait() # Wait for the process to finish

View file

@ -88,6 +88,10 @@ class RemovePackages(Configs):
self.packages_for_remove.append(installed)
def remove_packages(self) -> None:
# Remove old slpkg.log file.
if self.slpkg_log_file.is_file():
self.slpkg_log_file.unlink()
print(f'Started of removing total ({self.cyan}{len(self.packages_for_remove)}{self.endc}) packages:\n')
for package in self.packages_for_remove:
command: str = f'{self.removepkg} {package}'

View file

@ -176,8 +176,13 @@ class Slackbuilds(Configs):
self.check_md5.md5sum(path, source, checksum)
def build_and_install_the_slackbuilds(self) -> None:
# Remove old slpkg.log file.
if self.slpkg_log_file.is_file():
self.slpkg_log_file.unlink()
if self.install_order:
print(f'Started the processing of ({self.cyan}{len(self.install_order)}{self.endc}) packages:\n')
for sbo in self.install_order:
if self.continue_build_or_install(sbo):
self.patch_slackbuild_tag(sbo)