All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jessica Yu <jeyu@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Matthias Maennich <maennich@google.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Jessica Yu <jeyu@kernel.org>
Subject: [PATCH 2/4] scripts/nsdeps: don't prepend $srctree if *.mod already contains full paths
Date: Mon, 28 Oct 2019 16:14:25 +0100	[thread overview]
Message-ID: <20191028151427.31612-2-jeyu@kernel.org> (raw)
In-Reply-To: <20191028151427.31612-1-jeyu@kernel.org>

When building in-tree modules, the *.mod file contains relative paths.
When building external modules, the resulting *.mod file contains absolute
paths. Allow for the nsdeps script to account for both types of paths and
only prepend $srctree in the case of relative paths.  Otherwise, the script
will append $srctree to the path regardless and it will error out with file
not found errors if the path was already absolute to begin with.

Signed-off-by: Jessica Yu <jeyu@kernel.org>
---

The sed regex is getting more ugly. It's not my strong point :/ If anyone
has a better regex to prepend $srctree for every relative path encountered
while ignoring absolute paths, I'm all ears.

 scripts/nsdeps | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/nsdeps b/scripts/nsdeps
index 54d2ab8f9e5c..9ddcd5cb96b1 100644
--- a/scripts/nsdeps
+++ b/scripts/nsdeps
@@ -33,7 +33,7 @@ generate_deps() {
 	if [ ! -f "$ns_deps_file" ]; then return; fi
 	local mod_source_files=`cat $mod_file | sed -n 1p                      \
 					      | sed -e 's/\.o/\.c/g'           \
-					      | sed "s|[^ ]* *|${srctree}/&|g"`
+					      | sed -E "s%(^|\s)([^/][^ ]*)%\1$srctree/\2%g"`
 	for ns in `cat $ns_deps_file`; do
 		echo "Adding namespace $ns to module $mod_name (if needed)."
 		generate_deps_for_ns $ns $mod_source_files
-- 
2.16.4


  reply	other threads:[~2019-10-28 15:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 15:14 [PATCH 1/4] scripts/nsdeps: use $MODORDER to obtain correct modules.order path Jessica Yu
2019-10-28 15:14 ` Jessica Yu [this message]
2019-10-29  8:59   ` [PATCH 2/4] scripts/nsdeps: don't prepend $srctree if *.mod already contains full paths Masahiro Yamada
2019-10-28 15:14 ` [PATCH 3/4] nsdeps: remove stale .ns_deps files before generating new ones Jessica Yu
2019-10-29 10:45   ` Masahiro Yamada
2019-10-28 15:14 ` [PATCH 4/4] scripts/nsdeps: make sure to pass all module source files to spatch Jessica Yu
2019-10-29 12:57   ` Masahiro Yamada
2019-10-30 16:17     ` Jessica Yu
2019-10-31 12:27       ` Masahiro Yamada
2019-10-31 13:41         ` Jessica Yu
2019-11-01  5:56           ` Masahiro Yamada
2019-11-05 12:52             ` Jessica Yu
2019-11-05 12:57               ` Masahiro Yamada
2019-10-29 12:48 ` [PATCH 1/4] scripts/nsdeps: use $MODORDER to obtain correct modules.order path Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191028151427.31612-2-jeyu@kernel.org \
    --to=jeyu@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maennich@google.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.