Exemplo n.º 1
0
Arquivo: iso.py Projeto: rd2b/metalk8s
def task_populate_iso() -> types.TaskDict:
    """Populate the ISO_ROOT with required files."""
    return {
        'basename': 'populate_iso',
        'actions': None,
        'doc': 'Populate {} with required files.'.format(
            utils.build_relpath(constants.ISO_ROOT)
        ),
        # Aggregate here the tasks that put files into ISO_ROOT.
        'task_dep': [
            '_iso_mkdir_root',
            '_iso_add_tree:*',
            'images',
            'salt_tree',
            'packaging',
            'documentation',
        ],
    }
Exemplo n.º 2
0
Arquivo: iso.py Projeto: rd2b/metalk8s
def task__iso_build() -> types.TaskDict:
    """Create the ISO from the files in ISO_ROOT."""
    def mkisofs() -> None:
        """Create an ISO file (delete on error)."""
        cmd = [
            config.ExtCommand.MKISOFS.value, '-output',  ISO_FILE,
            '-quiet',
            '-rock',
            '-joliet',
            '-joliet-long',
            '-full-iso9660-filenames',
            '-volid', '{} {}'.format(config.PROJECT_NAME, versions.VERSION),
            '--iso-level', '3',
            '-gid', '0',
            '-uid', '0',
            '-input-charset', 'utf-8',
            '-output-charset', 'utf-8',
            constants.ISO_ROOT
        ]
        try:
            subprocess.run(cmd, check=True)
        except:
            utils.unlink_if_exist(ISO_FILE)
            raise

    doc = 'Create the ISO from the files in {}.'.format(
        utils.build_relpath(constants.ISO_ROOT)
    )
    # Every file used for the ISO is a dependency.
    depends = list(coreutils.ls_files_rec(constants.ISO_ROOT))
    depends.append(versions.VERSION_FILE)
    return {
        'title': utils.title_with_target1('MKISOFS'),
        'doc': doc,
        'actions': [mkisofs],
        'targets': [ISO_FILE],
        'file_dep': depends,
        'task_dep': ['check_for:mkisofs', '_build_root', '_iso_mkdir_root'],
        'clean': True,
    }
Exemplo n.º 3
0
def task__iso_build() -> types.TaskDict:
    """Create the ISO from the files in ISO_ROOT."""
    mkisofs = [
        config.MKISOFS, '-output', ISO_FILE, '-quiet', '-rock', '-joliet',
        '-joliet-long', '-full-iso9660-filenames', '-volid',
        '{} {}'.format(config.PROJECT_NAME, constants.VERSION), '--iso-level',
        '3', '-gid', '0', '-uid', '0', '-input-charset', 'utf-8',
        '-output-charset', 'utf-8', constants.ISO_ROOT
    ]
    doc = 'Create the ISO from the files in {}.'.format(
        utils.build_relpath(constants.ISO_ROOT))
    # Every file used for the ISO is a dependency.
    depends = list(coreutils.ls_files_rec(constants.ISO_ROOT))
    depends.append(constants.VERSION_FILE)
    return {
        'title': lambda task: utils.title_with_target1('MKISOFS', task),
        'doc': doc,
        'actions': [mkisofs],
        'targets': [ISO_FILE],
        'file_dep': depends,
        'task_dep': ['_build_root', '_iso_mkdir_root'],
        'clean': True,
    }
Exemplo n.º 4
0
 def show() -> str:
     return '{cmd: <{width}} {path}'.format(cmd='HARDLINK',
                                            width=constants.CMD_WIDTH,
                                            path=utils.build_relpath(
                                                constants.ISO_IMAGE_ROOT))