コード例 #1
0
ファイル: checkpatch.py プロジェクト: spi3ex/u-boot
def find_check_patch():
    top_level = gitutil.get_top_level()
    try_list = [
        os.getcwd(),
        os.path.join(os.getcwd(), '..', '..'),
        os.path.join(top_level, 'tools'),
        os.path.join(top_level, 'scripts'),
        '%s/bin' % os.getenv('HOME'),
        ]
    # Look in current dir
    for path in try_list:
        fname = os.path.join(path, 'checkpatch.pl')
        if os.path.isfile(fname):
            return fname

    # Look upwwards for a Chrome OS tree
    while not os.path.ismount(path):
        fname = os.path.join(path, 'src', 'third_party', 'kernel', 'files',
                'scripts', 'checkpatch.pl')
        if os.path.isfile(fname):
            return fname
        path = os.path.dirname(path)

    sys.exit('Cannot find checkpatch.pl - please put it in your ' +
             '~/bin directory or use --no-check')
コード例 #2
0
    def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
                   add_maintainers, limit):
        """Make a cc file for us to use for per-commit Cc automation

        Also stores in self._generated_cc to make ShowActions() faster.

        Args:
            process_tags: Process tags as if they were aliases
            cover_fname: If non-None the name of the cover letter.
            warn_on_error: True to print a warning when an alias fails to match,
                False to ignore it.
            add_maintainers: Either:
                True/False to call the get_maintainers to CC maintainers
                List of maintainers to include (for testing)
            limit: Limit the length of the Cc list (None if no limit)
        Return:
            Filename of temp file created
        """
        col = terminal.Color()
        # Look for commit tags (of the form 'xxx:' at the start of the subject)
        fname = '/tmp/patman.%d' % os.getpid()
        fd = open(fname, 'w', encoding='utf-8')
        all_ccs = []
        for commit in self.commits:
            cc = []
            if process_tags:
                cc += gitutil.build_email_list(commit.tags,
                                               warn_on_error=warn_on_error)
            cc += gitutil.build_email_list(commit.cc_list,
                                           warn_on_error=warn_on_error)
            if type(add_maintainers) == type(cc):
                cc += add_maintainers
            elif add_maintainers:
                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
            for x in set(cc) & set(settings.bounces):
                print(col.build(col.YELLOW, 'Skipping "%s"' % x))
            cc = list(set(cc) - set(settings.bounces))
            if limit is not None:
                cc = cc[:limit]
            all_ccs += cc
            print(commit.patch, '\0'.join(sorted(set(cc))), file=fd)
            self._generated_cc[commit.patch] = cc

        if cover_fname:
            cover_cc = gitutil.build_email_list(self.get('cover_cc', ''))
            cover_cc = list(set(cover_cc + all_ccs))
            if limit is not None:
                cover_cc = cover_cc[:limit]
            cc_list = '\0'.join([x for x in sorted(cover_cc)])
            print(cover_fname, cc_list, file=fd)

        fd.close()
        return fname
コード例 #3
0
ファイル: project.py プロジェクト: tmn505/u-boot
def detect_project():
    """Autodetect the name of the current project.

    This looks for signature files/directories that are unlikely to exist except
    in the given project.

    Returns:
        The name of the project, like "linux" or "u-boot".  Returns "unknown"
        if we can't detect the project.
    """
    top_level = gitutil.get_top_level()

    if os.path.exists(os.path.join(top_level, "include", "u-boot")):
        return "u-boot"
    elif os.path.exists(os.path.join(top_level, "kernel")):
        return "linux"

    return "unknown"