This is an automated email from the ASF dual-hosted git repository.

mgorecki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
     new 84bec49  cmd/os_mgmt: Fix dependency issues
84bec49 is described below

commit 84bec49e4ecccd910fcad4e8a619cfe5b6ed5feb
Author: Michal Gorecki <[email protected]>
AuthorDate: Tue Apr 14 11:04:05 2026 +0200

    cmd/os_mgmt: Fix dependency issues
    
    Feature was not properly guarded with #ifdefs,
    causing build failures when it was disabled.
    
    There was also missing dependency with this feature enabled.
---
 cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h | 2 +-
 cmd/os_mgmt/pkg.yml                          | 3 +++
 cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c | 2 ++
 cmd/os_mgmt/src/os_mgmt.c                    | 4 +++-
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h 
b/cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h
index 2195f41..b07baaa 100644
--- a/cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h
+++ b/cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h
@@ -27,7 +27,7 @@
 #define OS_MGMT_RESET_MS    MYNEWT_VAL(OS_MGMT_RESET_MS)
 #define OS_MGMT_TASKSTAT    MYNEWT_VAL(OS_MGMT_TASKSTAT)
 #define OS_MGMT_ECHO        MYNEWT_VAL(OS_MGMT_ECHO)
-#define OS_MGMT_DATETIME     MYNEWT_VAL(OS_MGMT_DATETIME)
+#define OS_MGMT_DATETIME    MYNEWT_VAL(OS_MGMT_DATETIME)
 
 #elif defined __ZEPHYR__
 
diff --git a/cmd/os_mgmt/pkg.yml b/cmd/os_mgmt/pkg.yml
index 9c2d16a..269544d 100644
--- a/cmd/os_mgmt/pkg.yml
+++ b/cmd/os_mgmt/pkg.yml
@@ -29,6 +29,9 @@ pkg.deps:
     - '@apache-mynewt-mcumgr/mgmt'
     - '@apache-mynewt-mcumgr/cborattr'
 
+pkg.deps.OS_MGMT_DATETIME:
+    - "@apache-mynewt-core/time/datetime"
+
 pkg.ign_files:
     - "stubs.c"
 
diff --git a/cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c 
b/cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c
index 9e8b188..d1b06f8 100644
--- a/cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c
+++ b/cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c
@@ -98,6 +98,7 @@ os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info 
*out_info)
     return 0;
 }
 
+#if MYNEWT_VAL(OS_MGMT_DATETIME)
 int
 os_mgmt_impl_datetime_info(char *datetime, size_t size)
 {
@@ -136,6 +137,7 @@ os_mgmt_impl_datetime_set(char *datetime)
 
     return os_settimeofday(&tv, &tz);
 }
+#endif
 
 int
 os_mgmt_impl_reset(unsigned int delay_ms)
diff --git a/cmd/os_mgmt/src/os_mgmt.c b/cmd/os_mgmt/src/os_mgmt.c
index 53e6332..0710ee4 100644
--- a/cmd/os_mgmt/src/os_mgmt.c
+++ b/cmd/os_mgmt/src/os_mgmt.c
@@ -25,7 +25,7 @@
 #include "os_mgmt/os_mgmt.h"
 #include "os_mgmt/os_mgmt_impl.h"
 #include "os_mgmt/os_mgmt_config.h"
-#if MYNEWT_VAL(OS_MGMT_DATETIME)
+#if OS_MGMT_DATETIME
 #include "datetime/datetime.h"
 #endif
 
@@ -202,6 +202,7 @@ os_mgmt_taskstat_read(struct mgmt_ctxt *ctxt)
 }
 #endif
 
+#if OS_MGMT_DATETIME
 /**
  * Command handler: os datetime
  */
@@ -261,6 +262,7 @@ os_mgmt_datetime_write(struct mgmt_ctxt *ctxt)
 
     return MGMT_ERR_EOK;
 }
+#endif
 
 /**
  * Command handler: os reset

Reply via email to