def ApplyCheck()

in daisy_workflows/kernel_commit_query/kcq.py [0:0]


    def ApplyCheck(self):
        logging.info('Applying patches from: %s' % patches_dir)

        found = []
        not_found = []
        filter_args = []

        self.__prepareDistroKernel()
        self.__fetchUpstreamKernel()

        catalog = self.__readCatalog()
        chain = self.__exportPatches()

        for cid in chain:
            patch_path = os.path.join(patches_dir, cid)
            apply_cmd = ['git', 'apply', patch_path] + filter_args

            res = run(apply_cmd + ['--check'], check=False,
                      cwd=distro_kernel_dir, **devnull)

            if res.returncode == 0:
                run(apply_cmd, cwd=distro_kernel_dir, **devnull)
                status = run(['git', 'status'], cwd=distro_kernel_dir,
                             **capture)

                logging.info('Commit %s is not present' % cid)

                if 'nothing to commit' not in status.stdout.decode('utf-8'):
                    git_cmds = ['add *', 'commit -m %s' % cid]

                    for curr in git_cmds:
                        run(['git'] + curr.split(' '), cwd=distro_kernel_dir,
                            **devnull)

                if cid in catalog:
                    not_found.append(cid)
            else:
                logging.info('Commit %s is present' % cid)

                if cid in catalog:
                    found.append(cid)

        self.__writeResult({'found': found, 'not_found': not_found})