Esempio n. 1
0
def apply_patch_text(text, indir=None, patch_args=''):
    from pyquilt_pkg import customization
    patch_opts = customization.get_default_opts('patch')
    if indir:
        cmd = 'patch -d %s' % indir
    else:
        cmd = 'patch'
    cmd += ' %s %s' % (patch_opts, patch_args)
    return shell.run_cmd(cmd, input_text=text)
Esempio n. 2
0
def apply_patch_text(text, indir=None, patch_args=""):
    from pyquilt_pkg import customization

    patch_opts = customization.get_default_opts("patch")
    if indir:
        cmd = "patch -d %s" % indir
    else:
        cmd = "patch"
    cmd += " %s %s" % (patch_opts, patch_args)
    return shell.run_cmd(cmd, input_text=text)
Esempio n. 3
0
def get_diffstat(text, strip_level, quiet=True):
    if not PARSER:
        make_parser()
    diffstat_options = customization.get_default_opts('diffstat')
    args, leftovers = PARSER.parse_known_args(diffstat_options.split())
    if leftovers and not quiet:
        output.error('diffstat default options: %; ignored\n' % ' '.join(leftovers))
    obj = patchlib.Patch.parse_text(text)
    stats_list = obj.get_diffstat_stats(int(strip_level))
    return stats_list.list_format_string(quiet=args.opt_quiet, comment=args.opt_comment, max_width=int(args.opt_max_width))
Esempio n. 4
0
def _get_diff_opts(args):
    diff_opts = customization.get_default_opts('diff')
    if args.opt_format is not None:
        return diff_opts + args.opt_format
    return diff_opts + ' -u'