deb-mock/mock/py/mockbuild/plugins/compress_logs.py
robojerk 4c0dcb2522
Some checks failed
Build Deb-Mock Package / build (push) Successful in 54s
Lint Code / Lint All Code (push) Failing after 1s
Test Deb-Mock Build / test (push) Failing after 36s
enhance: Add comprehensive .gitignore for deb-mock project
- Add mock-specific build artifacts (chroot/, mock-*, mockroot/)
- Include package build files (*.deb, *.changes, *.buildinfo)
- Add development tools (.coverage, .pytest_cache, .tox)
- Include system files (.DS_Store, Thumbs.db, ._*)
- Add temporary and backup files (*.tmp, *.bak, *.backup)
- Include local configuration overrides (config.local.yaml, .env.local)
- Add test artifacts and documentation builds
- Comprehensive coverage for Python build system project

This ensures build artifacts, chroot environments, and development
tools are properly ignored in version control.
2025-08-18 23:37:49 -07:00

40 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
import os.path
from mockbuild import util
from mockbuild.trace_decorator import getLog, traceLog
requires_api_version = "1.1"
class CompressLogsPlugin(object):
"""Compress logs in resultdir."""
# pylint: disable=too-few-public-methods
@traceLog()
def __init__(self, plugins, conf, buildroot):
self.buildroot = buildroot
self.config = buildroot.config
self.state = buildroot.state
self.conf = conf
self.command = self.conf['command']
plugins.add_hook("process_logs", self._compress_logs)
getLog().info("compress_logs: initialized")
@traceLog()
def _compress_logs(self):
logger = getLog()
for f_name in ('root.log', 'build.log', 'state.log', 'available_pkgs.log',
'installed_pkgs.log', 'hw_info.log', 'procenv.log',
'showrc.log'):
f_path = os.path.join(self.buildroot.resultdir, f_name)
if os.path.exists(f_path):
command = "{0} {1}".format(self.command, f_path)
logger.debug("Running %s", command)
util.do(command, shell=True)
def init(plugins, compress_conf, buildroot):
CompressLogsPlugin(plugins, compress_conf, buildroot)