-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sys/shell: Fix missing dependency #19485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There is no need for shell commands if there is no shell.
The shell_cmds module depends on the shell module. This was correctly added to KConfig, but the Makefile dependencies missed this one. This commit adds the missing dep.
This could go even further by removing all USEMODULE += shell
USEMODULE += shell_cmds_default And there's a lot of these :) |
There's something weird with the way shell dependencies are managed. I think
should go in The following code in Lines 337 to 340 in 812c216
with something like: ifneq (,$(filter shell_commands,$(USEMODULE)))
# shell_commands has been renamed to shell_cmds_default, but let's keep this
# for backward compatibility
USEMODULE += shell_cmds_default
endif
ifneq (,$(filter shell_cmd_%,$(USEMODULE)))
# each and every command is a submodule of shell_cmds
USEMODULE += shell_cmds
endif
ifneq (,$(filter shell_cmds,$(USEMODULE)))
USEMODULE += shell
endif And let the shell module manage its own dependencies (so in USEMODULE += stdin
ifneq (,$(filter shell_cmds_default,$(USEMODULE)))
USEMODULE += shell_cmd_sys
... |
Also isn't the benefit of this PR to allow to just include |
One last thing: should Kconfig be also updated ? |
No, in KConfig the dependency is there already. It was just missing in the Makefile bases dependency modeling. |
But why?
I can do that, one sec. |
When depending on one or more shell commands, the shell is pulled in as dependency anyway.
Because it's more correct ?
Except that My proposal above does exactly the same for |
Actually to get the same behavior as for driver modules, there's something missing in the top level # pull Makefile.dep of each sys modules if they exist
-include $(sort $(USEMODULE:%=$(RIOTBASE)/sys/%/Makefile.dep)) And that should do the trick (and we could have a |
Using the following patch works for me and I find it cleaner than the current master version: git format-patch -1 --stdout
From 4221a118d48c4c3d4930d03df1e2bb5a5ba8162c Mon Sep 17 00:00:00 2001
From: Alexandre Abadie <alexandre.abadie@inria.fr>
Date: Fri, 21 Apr 2023 09:23:52 +0200
Subject: [PATCH] sys/shell: cleanup shell dependency resolution
---
Makefile.dep | 3 +++
sys/Makefile.dep | 16 +++++++++++++---
sys/shell/Makefile.dep | 11 +----------
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/Makefile.dep b/Makefile.dep
index db56c9c1f0..d8a1074c6d 100644
--- a/Makefile.dep
+++ b/Makefile.dep
@@ -19,6 +19,9 @@ include $(RIOTBASE)/drivers/Makefile.dep
# pull Makefile.dep of each driver modules if they exist
-include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep))
+# pull Makefile.dep of each sys modules if they exist
+-include $(sort $(USEMODULE:%=$(RIOTBASE)/sys/%/Makefile.dep))
+
# pull dependencies from packages
-include $(PKG_PATHS:%=%Makefile.dep)
diff --git a/sys/Makefile.dep b/sys/Makefile.dep
index 5cb8f39945..2849fc029f 100644
--- a/sys/Makefile.dep
+++ b/sys/Makefile.dep
@@ -334,9 +334,19 @@ ifneq (,$(filter random_cmd,$(USEMODULE)))
USEMODULE += shell_cmd_random
endif
-ifneq (,$(filter shell%,$(USEMODULE)))
- USEMODULE += stdin
- include $(RIOTBASE)/sys/shell/Makefile.dep
+ifneq (,$(filter shell_commands,$(USEMODULE)))
+ # shell_commands has been renamed to shell_cmds_default, but let's keep this
+ # for backward compatibility
+ USEMODULE += shell_cmds_default
+endif
+
+ifneq (,$(filter shell_cmd%,$(USEMODULE)))
+ # each and every command is a submodule of shell_cmds
+ USEMODULE += shell_cmds
+endif
+
+ifneq (,$(filter shell_cmds,$(USEMODULE)))
+ USEMODULE += shell
endif
# Include all stdio_% dependencies after all USEMODULE += stdio_%
diff --git a/sys/shell/Makefile.dep b/sys/shell/Makefile.dep
index eb2360479c..da3616e0e5 100644
--- a/sys/shell/Makefile.dep
+++ b/sys/shell/Makefile.dep
@@ -1,13 +1,4 @@
-ifneq (,$(filter shell_cmd_%,$(USEMODULE)))
- # each and every command is a submodule of shell_cmds
- USEMODULE += shell_cmds
-endif
-
-ifneq (,$(filter shell_commands,$(USEMODULE)))
- # shell_commands has been renamed to shell_cmds_default, but let's keep this
- # for backward compatibility
- USEMODULE += shell_cmds_default
-endif
+USEMODULE += stdin
ifneq (,$(filter shell_cmds_default,$(USEMODULE)))
USEMODULE += shell_cmd_sys
--
2.37.2
|
Move deps on sys/shell to sys/Makefile.dep and only keep deps of sys/shell in sys/shell/Makefile.dep
Since you insist, I move the dependencies on sys/shell to sys/Makefile.dep
Let's not get overboard with this PR. This PR is intended to just fix a simple bug. |
I agree. If unsure we can still do in a follow up PR. I tried to apply that change (the |
Thanks! I don't see the diff from #19485 (comment) in the PR changes. But let's keep it like this as I think it can have a high impact and requires special care. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
bors merge |
Build succeeded: |
Contribution description
The shell commands depend on the shell module being use. This was already the case in KConfig, but was overlooked in the shell's
Makefile.dep
.In addition, this uncovered that
tests/memarray
had a bogus dependency on shell commands without every using the shell.Testing procedure
Ideally binaries should not differ (except for debug section).
Issues/PRs references
Split out of #19483