Exemplo n.º 1
0
args = parser.parse_args()

args.mdir = os.path.abspath(args.mdir)
args.tree = os.path.abspath(args.tree)

core.log_open_sec("Loading patches")
try:
    files = [os.path.join(args.mdir, f) for f in sorted(os.listdir(args.mdir))]
    series = Series()

    for f in files:
        with open(f, 'r') as fp:
            data = fp.read()
            if re.search(r"\[.* 0+/\d.*\]", data) and \
               not re.search(r"\n@@ -\d", data):
                series.set_cover_letter(data)
            else:
                series.add_patch(Patch(data))
finally:
    core.log_end_sec()

tree = Tree(args.tree_name, args.tree_name, args.tree, branch=args.tree_branch)
tester = Tester(args.result_dir)

if not tree.check_applies(series):
    print("Patch series does not apply cleanly to the tree")
    os.sys.exit(1)

series_ret, patch_ret = tester.test_series(tree, series)
good_patch = 0
for one_patch in patch_ret: