Exemple #1
0
def apply_patches(patch_files, working_dir):
    apply_files = expand_patches(patch_files)
    if not len(apply_files):
        return
    if not sh.isdir(working_dir):
        LOG.warn("Can only apply %s patches 'inside' a directory and not '%s'", len(apply_files), working_dir)
        return
    with utils.chdir(working_dir):
        for p in apply_files:
            LOG.debug("Applying patch %s in directory %s", p, working_dir)
            patch_contents = sh.load_file(p)
            if len(patch_contents):
                sh.execute(*PATCH_CMD, process_input=patch_contents)
Exemple #2
0
def apply_patches(patch_files, working_dir):
    apply_files = expand_patches(patch_files)
    if not len(apply_files):
        return
    if not sh.isdir(working_dir):
        LOG.warn("Can only apply %s patches 'inside' a directory and not '%s'",
                 len(apply_files), working_dir)
        return
    with utils.chdir(working_dir):
        for p in apply_files:
            LOG.debug("Applying patch %s in directory %s", p, working_dir)
            patch_contents = sh.load_file(p)
            if len(patch_contents):
                sh.execute(PATCH_CMD, process_input=patch_contents)
Exemple #3
0
def apply_patches(patch_files, working_dir):
    if not sh.isdir(working_dir):
        LOG.warn("Can only apply patches 'inside' a directory and not '%s'",
                 working_dir)
        return
    already_applied = set()
    for patch_ext, patch_cmd in [('.patch', PATCH_CMD), ('.git_patch', GIT_PATCH_CMD)]:
        apply_files = expand_patches(patch_files, patch_ext=patch_ext)
        apply_files = [p for p in apply_files if p not in already_applied]
        if not apply_files:
            continue
        with utils.chdir(working_dir):
            for p in apply_files:
                LOG.debug("Applying patch %s using command %s in directory %s",
                          p, patch_cmd, working_dir)
                patch_contents = sh.load_file(p)
                if len(patch_contents):
                    sh.execute(patch_cmd, process_input=patch_contents)
                already_applied.add(p)
Exemple #4
0
def apply_patches(patch_files, working_dir):
    if not sh.isdir(working_dir):
        LOG.warn("Can only apply patches 'inside' a directory and not '%s'",
                 working_dir)
        return
    already_applied = set()
    for patch_ext, patch_cmd in [('.patch', PATCH_CMD),
                                 ('.git_patch', GIT_PATCH_CMD)]:
        apply_files = expand_patches(patch_files, patch_ext=patch_ext)
        apply_files = [p for p in apply_files if p not in already_applied]
        if not apply_files:
            continue
        with utils.chdir(working_dir):
            for p in apply_files:
                LOG.debug("Applying patch %s using command %s in directory %s",
                          p, patch_cmd, working_dir)
                patch_contents = sh.load_file(p)
                if len(patch_contents):
                    sh.execute(patch_cmd, process_input=patch_contents)
                already_applied.add(p)
Exemple #5
0
def apply_patches(patch_files, working_dir):
    if not patch_files:
        return
    apply_files = []
    for p in patch_files:
        p = sh.abspth(p)
        if not sh.isfile(p):
            LOG.warn("Can not apply non-file patch %s", p)
        apply_files.append(p)
    if not apply_files:
        return
    if not sh.isdir(working_dir):
        LOG.warn("Can only apply %s patches 'inside' a directory and not '%s'",
                 len(apply_files), working_dir)
        return
    with utils.chdir(working_dir):
        for p in apply_files:
            LOG.debug("Applying patch %s in directory %s", p, working_dir)
            patch_contents = sh.load_file(p)
            if patch_contents:
                sh.execute(*PATCH_CMD, process_input=patch_contents)