From patchwork Tue May 9 01:26:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ahmed S. Darwish" X-Patchwork-Id: 13235275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56467C77B75 for ; Tue, 9 May 2023 01:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233770AbjEIB0r (ORCPT ); Mon, 8 May 2023 21:26:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233265AbjEIB0n (ORCPT ); Mon, 8 May 2023 21:26:43 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACAE0903C; Mon, 8 May 2023 18:26:39 -0700 (PDT) From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683595598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uStzLe1tmofW57614nQAyaAY3eSlDqWR3vQxVmQVS1Y=; b=xWNjFDl1s1ucegfBKQoncawd3d6If9tExr6i3v7IB0erVNUwt3jWQ6xpT9t2axmBV47Egz Qzzf/6eG0TQWoOSYHLyK98dgGPoWq8ZPdbKnLBF+bFMDkBIgUD80KfV3P4fHDLcVFEmJ1Q HKAZoci+2bpbtZ1iv9kQZ1koL34GE6y4AbhhEK5SRuKp1S60+KjRB4v/8MHrfVlyzt/aOm ewEZc6123SiU/pGCMhBFSqfDRsFxyVECyL0IWFbGbVRWNXoAghfj67OM2jzDVwAQAmoiQ0 hUyDmEWmdirizxsc1O1FFxo+AItwBn1ssPhe+phW2iue7vCxNDt/PUrrF1BIfg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683595598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uStzLe1tmofW57614nQAyaAY3eSlDqWR3vQxVmQVS1Y=; b=WJiot4UYEtS47knJadY85GFMDZjw4ZAVKGi64k8JHj3oZMySdSuYS/Vb8RZso5Gw1ThPCM 4eHRjiXqk7nTejDw== To: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Cc: Thomas Gleixner , linux-kbuild@vger.kernel.org, LKML , "Ahmed S. Darwish" Subject: [PATCH v2 1/2] scripts/tags.sh: Resolve gtags empty index generation Date: Tue, 9 May 2023 03:26:15 +0200 Message-Id: <20230509012616.81579-2-darwi@linutronix.de> In-Reply-To: <20230509012616.81579-1-darwi@linutronix.de> References: <20230504201833.202494-1-darwi@linutronix.de> <20230509012616.81579-1-darwi@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org gtags considers any file outside of its current working directory "outside the source tree" and refuses to index it. For O= kernel builds, or when "make" is invoked from a directory other then the kernel source tree, gtags ignores the entire kernel source and generates an empty index. Force-set gtags current working directory to the kernel source tree. Due to commit 9da0763bdd82 ("kbuild: Use relative path when building in a subdir of the source tree"), if the kernel build is done in a sub-directory of the kernel source tree, the kernel Makefile will set the kernel's $srctree to ".." for shorter compile-time and run-time warnings. Consequently, the list of files to be indexed will be in the "../*" form, rendering all such paths invalid once gtags switches to the kernel source tree as its current working directory. If gtags indexing is requested and the build directory is not the kernel source tree, index all files in absolute-path form. Note, indexing in absolute-path form will not affect the generated index, as paths in gtags indices are always relative to the gtags "root directory" (as evidenced by "gtags --dump"). Signed-off-by: Ahmed S. Darwish Cc: --- scripts/tags.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index ea31640b2671..3de4b4ebd891 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -32,6 +32,14 @@ else tree=${srctree}/ fi + +# gtags(1) refuses to index any file outside of its current working dir. +# If gtags indexing is requested and the build output directory is not +# the kernel source tree, index all files in absolute-path form. +if [ "$1" = "gtags" -a -n "${tree}" ]; then + tree=$(realpath $tree)/ +fi + # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH if [ "${ALLSOURCE_ARCHS}" = "" ]; then ALLSOURCE_ARCHS=${SRCARCH} @@ -131,7 +139,11 @@ docscope() dogtags() { - all_target_sources | gtags -i -f - + local gtagsoutdir="${PWD}" + local gtagsroot="${tree}" + + [ -z "${gtagsroot}" ] && gtagsroot="." + all_target_sources | gtags -i -C $gtagsroot -f - $gtagsoutdir } # Basic regular expressions with an optional /kind-spec/ for ctags and From patchwork Tue May 9 01:26:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ahmed S. Darwish" X-Patchwork-Id: 13235276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86613C7EE25 for ; Tue, 9 May 2023 01:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232894AbjEIB0u (ORCPT ); Mon, 8 May 2023 21:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbjEIB0r (ORCPT ); Mon, 8 May 2023 21:26:47 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 157D39EF7; Mon, 8 May 2023 18:26:42 -0700 (PDT) From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683595601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2FpVaM1b9/dK9ZgZzXFPsww04+6hb6vHVJbMLmOixEs=; b=ELAtSl2IMtdlg7PbfAf2eQ/WCKprqNTcowRfQlQ7OWL3S8e+MqkVf6CzNhYDuHus1MQmdj FLEMJm3W5RzWhgjXVvmC46uQ3fgHjzfQSswQrRRInUPVPcW/pvc7rI4o8sUHDJrSxIbBTQ D8se8nyPbTwAP312nkqooBzp0EJiPsgDSwW7MFolsWYf8rkRuPmmGB3mvg/3fskQRB/1Dr SICdgDP5jYSLYoOAHr8ow+V39j86alQKjsVaDq9aQ9Mbx37B6bf9EObIp8rkQr7c/4dD4Y rdhLKrfos1kg9O9VGxAapKRSqrJRSJqsmQsC7SetWR18jSMmtA5Zts0FHPxW4g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683595601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2FpVaM1b9/dK9ZgZzXFPsww04+6hb6vHVJbMLmOixEs=; b=TZOqOHsOZHAdVNxm/WWL24EBFkQQ7fhfUJI6BI1Hald7rlOG6X1kk6zqjP0kGymOje/BxE canixfzlL96ppyCg== To: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Cc: Thomas Gleixner , linux-kbuild@vger.kernel.org, LKML , "Ahmed S. Darwish" Subject: [PATCH v2 2/2] docs: Set minimal gtags / GNU GLOBAL version to 6.6.5 Date: Tue, 9 May 2023 03:26:16 +0200 Message-Id: <20230509012616.81579-3-darwi@linutronix.de> In-Reply-To: <20230509012616.81579-1-darwi@linutronix.de> References: <20230504201833.202494-1-darwi@linutronix.de> <20230509012616.81579-1-darwi@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Kernel build now uses the gtags "-C (--directory)" option, available since GNU GLOBAL v6.6.5. Update the documentation accordingly. Signed-off-by: Ahmed S. Darwish Cc: Link: https://lists.gnu.org/archive/html/info-global/2020-09/msg00000.html --- Documentation/process/changes.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst index ef540865ad22..a9ef00509c9b 100644 --- a/Documentation/process/changes.rst +++ b/Documentation/process/changes.rst @@ -60,6 +60,7 @@ openssl & libcrypto 1.0.0 openssl version bc 1.06.95 bc --version Sphinx\ [#f1]_ 1.7 sphinx-build --version cpio any cpio --version +gtags (optional) 6.6.5 gtags --version ====================== =============== ======================================== .. [#f1] Sphinx is needed only to build the Kernel documentation @@ -174,6 +175,12 @@ You will need openssl to build kernels 3.7 and higher if module signing is enabled. You will also need openssl development packages to build kernels 4.3 and higher. +gtags / GNU GLOBAL (optional) +----------------------------- + +The kernel build requires GNU GLOBAL version 6.6.5 or later to generate +tag files through ``make gtags``. This is due to its use of the gtags +``-C (--directory)`` flag. System utilities ****************