def tag_ready(self, error_message='') -> None: """ Tag the archive as ready by creating the corresponding indication file. NOTE: It is expected that the archive was never tagged as ready before and that there are no subsequent tags of the same archive. If it is violated, an assert will fail. """ assert not self.is_ready() # Try the best to make sure everything is synced to the file system, # to avoid any possibility of stamp appearing on a network share prior to # an actual file. if util.get_current_platform() != util.Platform.WINDOWS: os.sync() archive_size = -1 if self.archive_filepath.exists(): archive_size = self.archive_filepath.stat().st_size archive_info = ArchiveState(file_size=archive_size, error_message=error_message) self.ready_indicator_filepath.write_text( archive_info.serialize_to_string())
def __init__(self, config): self.config = config absolute_shared_storage_dir = config.SHARED_STORAGE_DIR.resolve() # Unsigned (signing server input) configuration. self.unsigned_storage_dir = absolute_shared_storage_dir / 'unsigned' # Signed (signing server output) configuration. self.signed_storage_dir = absolute_shared_storage_dir / 'signed' self.platform = util.get_current_platform()
def __init__(self): platform = util.get_current_platform() if platform == util.Platform.LINUX: from codesign.linux_code_signer import LinuxCodeSigner self.code_signer = LinuxCodeSigner(codesign.config_builder) elif platform == util.Platform.MACOS: from codesign.macos_code_signer import MacOSCodeSigner self.code_signer = MacOSCodeSigner(codesign.config_builder) elif platform == util.Platform.WINDOWS: from codesign.windows_code_signer import WindowsCodeSigner self.code_signer = WindowsCodeSigner(codesign.config_builder) else: self.code_signer = None
def tag_ready(self) -> None: """ Tag the archive as ready by creating the corresponding indication file. NOTE: It is expected that the archive was never tagged as ready before and that there are no subsequent tags of the same archive. If it is violated, an assert will fail. """ assert not self.is_ready() # Try the best to make sure everything is synced to the file system, # to avoid any possibility of stamp appearing on a network share prior to # an actual file. if util.get_current_platform() != util.Platform.WINDOWS: os.sync() self.ready_indicator_filepath.touch()
def __init__(self, config): self.config = config absolute_shared_storage_dir = config.SHARED_STORAGE_DIR.resolve() # Unsigned (signing server input) configuration. self.unsigned_storage_dir = absolute_shared_storage_dir / 'unsigned' self.unsigned_archive_info = ArchiveWithIndicator( self.unsigned_storage_dir, 'unsigned_files.tar', 'ready.stamp') # Signed (signing server output) configuration. self.signed_storage_dir = absolute_shared_storage_dir / 'signed' self.signed_archive_info = ArchiveWithIndicator( self.signed_storage_dir, 'signed_files.tar', 'ready.stamp') self.platform = util.get_current_platform()
# NOTE: If signtool.exe is not in the PATH use codesign_server_windows.bat import logging.config import shutil from pathlib import Path from typing import List import codesign.util as util from codesign.windows_code_signer import WindowsCodeSigner import codesign.config_server if __name__ == "__main__": logging.config.dictConfig(codesign.config_server.LOGGING) logger = logging.getLogger(__name__) logger_server = logger.getChild('server') # TODO(sergey): Consider moving such sanity checks into # CodeSigner.check_environment_or_die(). if not shutil.which('signtool.exe'): if util.get_current_platform() == util.Platform.WINDOWS: raise SystemExit("signtool.exe is not found in %PATH%") logger_server.info( 'signtool.exe not found, ' 'but will not be used on this foreign platform') code_signer = WindowsCodeSigner(codesign.config_server) code_signer.run_signing_server()
# ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> # Configuration of a code signer which is specific to the code running from # buildbot's worker. import sys from pathlib import Path import codesign.util as util from codesign.config_common import * platform = util.get_current_platform() if platform == util.Platform.LINUX: SHARED_STORAGE_DIR = Path('/data/codesign') elif platform == util.Platform.WINDOWS: SHARED_STORAGE_DIR = Path('Z:\\codesign') elif platform == util.Platform.MACOS: SHARED_STORAGE_DIR = Path('/Volumes/codesign_macos/codesign') # https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema LOGGING = { 'version': 1, 'formatters': { 'default': {'format': '%(asctime)-15s %(levelname)8s %(name)s %(message)s'} }, 'handlers': { 'console': {