From patchwork Sun Aug 20 19:04:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1823403 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=HvT5g7sm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RTQ5c4CFDz1yfj for ; Mon, 21 Aug 2023 05:04:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CA20486E8E; Sun, 20 Aug 2023 21:04:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HvT5g7sm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 809A386E8E; Sun, 20 Aug 2023 21:04:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C7FCF869E9 for ; Sun, 20 Aug 2023 21:04:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe1e1142caso26362385e9.0 for ; Sun, 20 Aug 2023 12:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692558264; x=1693163064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cLt/k2jfppd558tZuRkQGTwbhBX5TEWbxVq56iIr2Oo=; b=HvT5g7sm0Pr3ZtmifY6eTFd4gWf+qur8wt867tCIGK6FazQrpVmPFcKyyZFAMFZu+6 U+CXq93iS75XfRbCpM9APbLxkZT+7tluNjkPnMRJsc1Uh2AiupFEHdXxjCkXouQQJI65 dC10PaUPkdNA23D/TgNnyF//XeXoflzdJKa35DoRZ86iZYcnk6IEt6AsKZxDn/Xgv8ox Xw3XgzXm/Xzj4lqdzzTvRcAOv+ReZBve9wAp1njceUPkPt/oH9oElMEop3BHi60nrOuT 4B4FL2J+cR72nVgvZAnZ+RXsHtJowWxUKQLdZDlGBsdTX5HusCEQwU1Dvpaf9u6X4e7E YOvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692558264; x=1693163064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cLt/k2jfppd558tZuRkQGTwbhBX5TEWbxVq56iIr2Oo=; b=O23/IfOxxpLGEtL4bDU7+3xD91aAHggptQjmluaZ28wpcR2xz7sl4WnJSWSnS/aNZp PuxBy+avQZEq3Mm5tSV0JfjETymveAYSFuB+4/qX5c6244T9SCV1a/pqxMZIn0f4C5Ey tVGGCCsd1p136cixyyUzokEtUvrl4PvG9S3WkrZ84rfcqqZxWEfY6u6eBO1382EyzSUf 1uGOOWFVsSsG6g9kRipo+h4b6YbASCARNJTZva2rB3qzycYQbk+/+lSmm99EkEoAYyJb 3gzCa4D4DPLA6J4CbRn3Mfqp2nOMaV1SVk1WN5lo0ZbfdKpOUwgwUWOQeDLCFCR3UEtg +xEA== X-Gm-Message-State: AOJu0YyIyWAPCY9yNk75xjS7dSIE4PCR1M//C66ky/htH2sKp8Xmg6x4 XESrx3PRA85WjH53fwyjhDIYHeR4RYP0ryW4 X-Google-Smtp-Source: AGHT+IFHt4jstFGb7x+Akqg/HR/DiOe6OKdTzWCyJqx+2mke5dDq8qqIwb7sQ/BvkUB8WaPzQvrzbg== X-Received: by 2002:a7b:c38e:0:b0:3fe:10d8:e7fa with SMTP id s14-20020a7bc38e000000b003fe10d8e7famr3492789wmj.41.1692558263750; Sun, 20 Aug 2023 12:04:23 -0700 (PDT) Received: from fedora.. (cust-west-pareq2-46-193-56-152.wb.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id o10-20020a1c750a000000b003fed78b03b4sm8253797wmc.20.2023.08.20.12.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 12:04:23 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Joao Marcos Costa Subject: [PATCH v1 1/4] scripts: Port Linux's gen_compile_commands.py to U-Boot Date: Sun, 20 Aug 2023 21:04:09 +0200 Message-ID: <20230820190412.21266-2-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230820190412.21266-1-jmcosta944@gmail.com> References: <20230820190412.21266-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This script generates a database of compiler flags, namely compile_commands.json. It is quite useful for text editors that use clangd LSP (e.g. Vim, Neovim). It was ported from Linux's sources: - tag: v6.4 - revision 6995e2de6891c724bfeb2db33d7b87775f913ad1 Modifications for U-Boot compatibility will be added in a follow-up commit. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 228 ++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100755 scripts/gen_compile_commands.py diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py new file mode 100755 index 0000000000..15ba56527a --- /dev/null +++ b/scripts/gen_compile_commands.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) Google LLC, 2018 +# +# Author: Tom Roeder +# +"""A tool for generating compile_commands.json in the Linux kernel.""" + +import argparse +import json +import logging +import os +import re +import subprocess +import sys + +_DEFAULT_OUTPUT = 'compile_commands.json' +_DEFAULT_LOG_LEVEL = 'WARNING' + +_FILENAME_PATTERN = r'^\..*\.cmd$' +_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' +_VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] +# The tools/ directory adopts a different build system, and produces .cmd +# files in a different format. Do not support it. +_EXCLUDE_DIRS = ['.git', 'Documentation', 'include', 'tools'] + +def parse_arguments(): + """Sets up and parses command-line arguments. + + Returns: + log_level: A logging level to filter log output. + directory: The work directory where the objects were built. + ar: Command used for parsing .a archives. + output: Where to write the compile-commands JSON file. + paths: The list of files/directories to handle to find .cmd files. + """ + usage = 'Creates a compile_commands.json database from kernel .cmd files' + parser = argparse.ArgumentParser(description=usage) + + directory_help = ('specify the output directory used for the kernel build ' + '(defaults to the working directory)') + parser.add_argument('-d', '--directory', type=str, default='.', + help=directory_help) + + output_help = ('path to the output command database (defaults to ' + + _DEFAULT_OUTPUT + ')') + parser.add_argument('-o', '--output', type=str, default=_DEFAULT_OUTPUT, + help=output_help) + + log_level_help = ('the level of log messages to produce (defaults to ' + + _DEFAULT_LOG_LEVEL + ')') + parser.add_argument('--log_level', choices=_VALID_LOG_LEVELS, + default=_DEFAULT_LOG_LEVEL, help=log_level_help) + + ar_help = 'command used for parsing .a archives' + parser.add_argument('-a', '--ar', type=str, default='llvm-ar', help=ar_help) + + paths_help = ('directories to search or files to parse ' + '(files should be *.o, *.a, or modules.order). ' + 'If nothing is specified, the current directory is searched') + parser.add_argument('paths', type=str, nargs='*', help=paths_help) + + args = parser.parse_args() + + return (args.log_level, + os.path.abspath(args.directory), + args.output, + args.ar, + args.paths if len(args.paths) > 0 else [args.directory]) + + +def cmdfiles_in_dir(directory): + """Generate the iterator of .cmd files found under the directory. + + Walk under the given directory, and yield every .cmd file found. + + Args: + directory: The directory to search for .cmd files. + + Yields: + The path to a .cmd file. + """ + + filename_matcher = re.compile(_FILENAME_PATTERN) + exclude_dirs = [ os.path.join(directory, d) for d in _EXCLUDE_DIRS ] + + for dirpath, dirnames, filenames in os.walk(directory, topdown=True): + # Prune unwanted directories. + if dirpath in exclude_dirs: + dirnames[:] = [] + continue + + for filename in filenames: + if filename_matcher.match(filename): + yield os.path.join(dirpath, filename) + + +def to_cmdfile(path): + """Return the path of .cmd file used for the given build artifact + + Args: + Path: file path + + Returns: + The path to .cmd file + """ + dir, base = os.path.split(path) + return os.path.join(dir, '.' + base + '.cmd') + + +def cmdfiles_for_a(archive, ar): + """Generate the iterator of .cmd files associated with the archive. + + Parse the given archive, and yield every .cmd file used to build it. + + Args: + archive: The archive to parse + + Yields: + The path to every .cmd file found + """ + for obj in subprocess.check_output([ar, '-t', archive]).decode().split(): + yield to_cmdfile(obj) + + +def cmdfiles_for_modorder(modorder): + """Generate the iterator of .cmd files associated with the modules.order. + + Parse the given modules.order, and yield every .cmd file used to build the + contained modules. + + Args: + modorder: The modules.order file to parse + + Yields: + The path to every .cmd file found + """ + with open(modorder) as f: + for line in f: + obj = line.rstrip() + base, ext = os.path.splitext(obj) + if ext != '.o': + sys.exit('{}: module path must end with .o'.format(obj)) + mod = base + '.mod' + # Read from *.mod, to get a list of objects that compose the module. + with open(mod) as m: + for mod_line in m: + yield to_cmdfile(mod_line.rstrip()) + + +def process_line(root_directory, command_prefix, file_path): + """Extracts information from a .cmd line and creates an entry from it. + + Args: + root_directory: The directory that was searched for .cmd files. Usually + used directly in the "directory" entry in compile_commands.json. + command_prefix: The extracted command line, up to the last element. + file_path: The .c file from the end of the extracted command. + Usually relative to root_directory, but sometimes absolute. + + Returns: + An entry to append to compile_commands. + + Raises: + ValueError: Could not find the extracted file based on file_path and + root_directory or file_directory. + """ + # The .cmd files are intended to be included directly by Make, so they + # escape the pound sign '#', either as '\#' or '$(pound)' (depending on the + # kernel version). The compile_commands.json file is not interepreted + # by Make, so this code replaces the escaped version with '#'. + prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#') + + # Use os.path.abspath() to normalize the path resolving '.' and '..' . + abs_path = os.path.abspath(os.path.join(root_directory, file_path)) + if not os.path.exists(abs_path): + raise ValueError('File %s not found' % abs_path) + return { + 'directory': root_directory, + 'file': abs_path, + 'command': prefix + file_path, + } + + +def main(): + """Walks through the directory and finds and parses .cmd files.""" + log_level, directory, output, ar, paths = parse_arguments() + + level = getattr(logging, log_level) + logging.basicConfig(format='%(levelname)s: %(message)s', level=level) + + line_matcher = re.compile(_LINE_PATTERN) + + compile_commands = [] + + for path in paths: + # If 'path' is a directory, handle all .cmd files under it. + # Otherwise, handle .cmd files associated with the file. + # built-in objects are linked via vmlinux.a + # Modules are listed in modules.order. + if os.path.isdir(path): + cmdfiles = cmdfiles_in_dir(path) + elif path.endswith('.a'): + cmdfiles = cmdfiles_for_a(path, ar) + elif path.endswith('modules.order'): + cmdfiles = cmdfiles_for_modorder(path) + else: + sys.exit('{}: unknown file type'.format(path)) + + for cmdfile in cmdfiles: + with open(cmdfile, 'rt') as f: + result = line_matcher.match(f.readline()) + if result: + try: + entry = process_line(directory, result.group(1), + result.group(2)) + compile_commands.append(entry) + except ValueError as err: + logging.info('Could not add line from %s: %s', + cmdfile, err) + + with open(output, 'wt') as f: + json.dump(compile_commands, f, indent=2, sort_keys=True) + + +if __name__ == '__main__': + main() From patchwork Sun Aug 20 19:04:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1823405 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=DqN8XGiU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RTQ5p4pHMz1yZd for ; Mon, 21 Aug 2023 05:04:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 17D9686F61; Sun, 20 Aug 2023 21:04:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="DqN8XGiU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF66A86E8E; Sun, 20 Aug 2023 21:04:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6081A86A42 for ; Sun, 20 Aug 2023 21:04:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fe2fb9b4d7so24897645e9.1 for ; Sun, 20 Aug 2023 12:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692558264; x=1693163064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e7hb2jrvivQxON1XeovwgMxiW+RYRxZdLPP3zp29do4=; b=DqN8XGiU2JEsK4+pOljt5Uk94ytaLZPEDpJaoCYy72gfiE/uAAKXM3ekAvtTLNyu1v 47J027LgxpDlSrQLJYN5kPoLuUmgeAGA16ydArqdjRSpFlP4Uy0jWx1WhGQxH+UFxCW1 4bsqU1uOF8TwE8/GZy9SRmZmlNmjZXiMmGKTior/yAPwQaz/2piJJhzcLWgeyZxyYIga JUyNf3Th/A3ACtr1yBAw09fv/7k6jIn/Ocdvc8eD/19U+CN8cXvFI27fJNH+6dW4tPzj 5Xgm6X2zT8ihcpmA56JX/aPJDVcaIhzQjICH2saashcvCYgWZLNuJyCk5STyCIe1ckEw hg1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692558264; x=1693163064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e7hb2jrvivQxON1XeovwgMxiW+RYRxZdLPP3zp29do4=; b=TNsCUh1+MWIO/BvS54ssqEk7x0LGATXRsQOcZT9ivYjXWIYx6Bxr9DJnnvtZHVgYKG YBDngcTS3pxucvxvMYEM380o/v1+3R2PauNWONaeVkzGT+9a8guecclXBds9EE+kzX69 NmPEv/1uRThJhxozqpJiQ+Q2g1AdFZwKXv8PEWXoBWrDg2IBkRm9giSgD7Rp2Pj3di57 cfXwRcmms/+4/YLdtetGXsD+Zzv6x2LTkX5QMgWqzGRtDjSSkAzS+kOoUhwCJaahngWs SgUQXGMugncYThE59dtr654vZWGwb0sox/JEmt9656BUOCVLbuN2VFNgCEc1oVIqwRLB g7ug== X-Gm-Message-State: AOJu0Yxj1EavGKwylF2wA7bY2Yss53O0QgQcMF6OQuWFHyUQG15UaWoe Ngb03gRY03dC0uu1+OvCrmlSl7pw+HaFasSk X-Google-Smtp-Source: AGHT+IEgkgz5ft1HZ0QXwHXw0oHCCenwb0FB+qK0qRYM1y4sri+uw88uMtR2VrQFY4uCoLY2RNpdGA== X-Received: by 2002:a7b:cd14:0:b0:3fb:4055:1ddd with SMTP id f20-20020a7bcd14000000b003fb40551dddmr3579024wmj.28.1692558264242; Sun, 20 Aug 2023 12:04:24 -0700 (PDT) Received: from fedora.. (cust-west-pareq2-46-193-56-152.wb.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id o10-20020a1c750a000000b003fed78b03b4sm8253797wmc.20.2023.08.20.12.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 12:04:24 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Joao Marcos Costa Subject: [PATCH v1 2/4] scripts/gen_compile_commands.py: adapt _LINE_PATTERN Date: Sun, 20 Aug 2023 21:04:10 +0200 Message-ID: <20230820190412.21266-3-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230820190412.21266-1-jmcosta944@gmail.com> References: <20230820190412.21266-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean For U-Boot's context, the regular expression defined by _LINE_PATTERN should be adapted. Replace 'savedcmd' by 'cmd'. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 15ba56527a..0227522959 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -19,7 +19,7 @@ _DEFAULT_OUTPUT = 'compile_commands.json' _DEFAULT_LOG_LEVEL = 'WARNING' _FILENAME_PATTERN = r'^\..*\.cmd$' -_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' +_LINE_PATTERN = r'^cmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' _VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] # The tools/ directory adopts a different build system, and produces .cmd # files in a different format. Do not support it. From patchwork Sun Aug 20 19:04:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1823406 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=Jr/4zMHn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RTQ5y5NHhz1yZd for ; Mon, 21 Aug 2023 05:04:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D49C869E9; Sun, 20 Aug 2023 21:04:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Jr/4zMHn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 058C386F9B; Sun, 20 Aug 2023 21:04:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9C1B586AF4 for ; Sun, 20 Aug 2023 21:04:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fee51329feso7063985e9.0 for ; Sun, 20 Aug 2023 12:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692558265; x=1693163065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Msrb6/nmtExFC8B0sHWpf3s96bn/pi+WsRWwEFGprnc=; b=Jr/4zMHnYYGEetV0NEX5UGXaz3vANADDc+pmkdgraAtqDiZ1SA4mZRr8RrAsxHm6MT 5KNGF8xv6Yj4sCe4TWAnhjnnilfd6XEO3QAFphuyGW2KFD0uU/x/YQB5oYqUWJdezDCy CxbDJGaQcLOMcSDOEQdsXtY55EpnKUXxNMusUq4593V8Mw7ma3XIuwdwYsrLFK3kkoSV DxnsPWIb1IqeotIp2Yea2P1ulHc4TnXipcfZEN2hHkZuBGDacAj7pedZ417vXF1swx6F t76zYzFmi9FGAwvU8OzdQwsJq+PRyZfZ7H9BfO5Dzj54gd3duCXzGuyWCHPBY/i9tQLJ OENw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692558265; x=1693163065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Msrb6/nmtExFC8B0sHWpf3s96bn/pi+WsRWwEFGprnc=; b=irA4W0Nj9vwuaLqypU1Jcheu+rb1Z248S1tKovQxJ3SRb4FMxVfXFr0qcTJaxyHxR3 GQpik/t5j4TS5a0daE7zuygWDeuuyEdtShlZJrnDqC4Ywb1VgBDyhwC0D7j1EBhPrLb9 btRRju+c3leLcbSABLLzliC0ngN1IzsnDgnTqJDOIMWOFen1S+r40e9YG66HHEtneUyk N+2QXbzRnoLI1O1q9wLVW6+ERckTeVtkf2W5mi5KJPuC498Q5lDuIYbBhukHZ41DjCOR DoLJ0G/UwBwTuypNxpqI2Vzwn4rz6s0FqRQeIZEQ0mt8DUYkpfIzqCXOvMwxM99m6CDV SmrQ== X-Gm-Message-State: AOJu0YwB4bvz9IMCOM6AvRAyR8/egKpaNakWoWBO6qbCA2+VK1bxMJTe x9z5IYxt2AmuFHXrawfzyRkYDBGYJJ2brBds X-Google-Smtp-Source: AGHT+IGwyZ5r4bCt7e1nNOn/3pSca+QC16g2pvaFtapd+w+oXIOIGoOa+nRCW2EB6dfnO+lVFpuJEw== X-Received: by 2002:a7b:c38a:0:b0:3fe:215e:44a0 with SMTP id s10-20020a7bc38a000000b003fe215e44a0mr3644036wmj.18.1692558264793; Sun, 20 Aug 2023 12:04:24 -0700 (PDT) Received: from fedora.. (cust-west-pareq2-46-193-56-152.wb.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id o10-20020a1c750a000000b003fed78b03b4sm8253797wmc.20.2023.08.20.12.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 12:04:24 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Joao Marcos Costa Subject: [PATCH v1 3/4] scripts/gen_compile_commands.py: fix docstring Date: Sun, 20 Aug 2023 21:04:11 +0200 Message-ID: <20230820190412.21266-4-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230820190412.21266-1-jmcosta944@gmail.com> References: <20230820190412.21266-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The referred tool is now in U-Boot. Replace "the Linux kernel" by "U-Boot" to make the docstring coherent. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 0227522959..63d036a773 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -5,7 +5,7 @@ # # Author: Tom Roeder # -"""A tool for generating compile_commands.json in the Linux kernel.""" +"""A tool for generating compile_commands.json in U-Boot.""" import argparse import json From patchwork Sun Aug 20 19:04:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Marcos_Costa?= X-Patchwork-Id: 1823408 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=IYFAHr0e; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RTQ676Jn5z1yZd for ; Mon, 21 Aug 2023 05:05:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A2D4C86B86; Sun, 20 Aug 2023 21:04:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IYFAHr0e"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CD4A86AF4; Sun, 20 Aug 2023 21:04:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 592618684C for ; Sun, 20 Aug 2023 21:04:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmcosta944@gmail.com Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fee769fd53so9872575e9.1 for ; Sun, 20 Aug 2023 12:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692558265; x=1693163065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nquaMTUkKEj9f0VDmD18sTp9HY+/Vhfo0qP8M2hbUps=; b=IYFAHr0e8IPQCesrq938DlPi5+LNeGjXPYGJhZylq8awRIxbz3Vn3M8qVv14XhXIGt nNQmllqFL7Z9O/wA0uw80Etm2j0QRyQWFFTzigyJs9tJX0B6ZGKJxLG8o1xPPfgcjlrt CFmpR9xwSDWjoku1cj/WmnjBezWfTRhV1ktCtcnsRwwV2yqx9rQflkKmie6OefHfQuLo PCNZGUn5wh5c6H2AzPzJRdQ+QFLC54EGPPGCkxORaoHw13n1kW3wWRn8Gn4CEI0Z1GBE ogmjeAvuv+5NmPpO8XcgJXgBqmAX47Sfe/Shv96Tdu177mNakAfCGjYfM4aq8pbda3/E 4VAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692558265; x=1693163065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nquaMTUkKEj9f0VDmD18sTp9HY+/Vhfo0qP8M2hbUps=; b=kILTY7e7AckTbky2FoCkB/dbaxGnQTWbcZg9C9bBV6Ex/fwNUvAIpJexYezfT0x1+a r8d9cZ0VZi0R+pfGbLRV1NJNNpXfUHXvrkkF1JEl7DDZrXxmVBdwpFPZjb9EtQl3N+tv W3sY5g4DdgwlnB13Y9BtS2LeKh7XcQYjVaI4GpJipntRdp86n7QnhodaAZM9qI2cNkLY 7Mb5ajPUg8MNnzEoK7DboBnfl44EcHoCjPwYA3nj24IvJN10gOeh5OcX32APi5zpRP2Q pQAOdJdqUTMKDv9cVi+Ec5wuMPuvYt/XrfdtWvYSIywC0m5OAgdJU8FT9temgOjjw7Mq jiNA== X-Gm-Message-State: AOJu0YyKtNaUC1qFtOzrKGTJCUxpNo4ksZ4v9RJACjKH8juoChqJhOTZ nIEXGkHTPOT7CV1+lLLDCPQb2Ji2Ulm1vm8+ X-Google-Smtp-Source: AGHT+IEpIAaBFTk3mUYhl+TX/aiq/JviVja3wcGntsEoVUU2xpI1H/jvuhgKtFdq27BHhbc9mqeI5A== X-Received: by 2002:a7b:cb99:0:b0:3fe:e7b2:c97f with SMTP id m25-20020a7bcb99000000b003fee7b2c97fmr2593681wmi.36.1692558265583; Sun, 20 Aug 2023 12:04:25 -0700 (PDT) Received: from fedora.. (cust-west-pareq2-46-193-56-152.wb.wifirst.net. [46.193.56.152]) by smtp.gmail.com with ESMTPSA id o10-20020a1c750a000000b003fed78b03b4sm8253797wmc.20.2023.08.20.12.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 12:04:25 -0700 (PDT) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, antoningodard@pm.me, Joao Marcos Costa Subject: [PATCH v1 4/4] scripts/gen_compile_commands.py: add acknowledgments Date: Sun, 20 Aug 2023 21:04:12 +0200 Message-ID: <20230820190412.21266-5-jmcosta944@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230820190412.21266-1-jmcosta944@gmail.com> References: <20230820190412.21266-1-jmcosta944@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add acknowledgments for porting and modifying the script. Of course, the license, author, and copyright notice remain the same as in the original script. Signed-off-by: Joao Marcos Costa --- scripts/gen_compile_commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 63d036a773..1a9c49b34a 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py @@ -4,6 +4,7 @@ # Copyright (C) Google LLC, 2018 # # Author: Tom Roeder +# Ported and modified for U-Boot by Joao Marcos Costa # """A tool for generating compile_commands.json in U-Boot."""