<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15614">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">menuselect: Add ability to set deprecated and removed versions.<br><br>The "deprecated_in" and "removed_in" information can now be<br>set in MODULEINFO for a module and is then displayed in<br>menuselect so users can be aware of when a module is slated<br>to be deprecated and then removed.<br><br>ASTERISK-29337<br><br>Change-Id: I6952889cf08e0e9e99cf8b43f99b3cef4688087a<br>---<br>M menuselect/menuselect.c<br>M menuselect/menuselect.h<br>M menuselect/menuselect_curses.c<br>M menuselect/menuselect_newt.c<br>4 files changed, 50 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/14/15614/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/menuselect/menuselect.c b/menuselect/menuselect.c</span><br><span>index 2eea3f0..2ef075f 100644</span><br><span>--- a/menuselect/menuselect.c</span><br><span>+++ b/menuselect/menuselect.c</span><br><span>@@ -210,6 +210,8 @@</span><br><span> xmlFree((void *) mem->defaultenabled);</span><br><span> xmlFree((void *) mem->support_level);</span><br><span> xmlFree((void *) mem->replacement);</span><br><span style="color: hsl(120, 100%, 40%);">+ xmlFree((void *) mem->deprecated_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ xmlFree((void *) mem->removed_in);</span><br><span> }</span><br><span> </span><br><span> free(mem);</span><br><span>@@ -341,6 +343,32 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int process_xml_deprecatedin_node(xmlNode *node, struct member *mem)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *tmp = (const char *) xmlNodeGetContent(node);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tmp && !strlen_zero(tmp)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ xmlFree((void *) mem->deprecated_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ mem->deprecated_in = tmp;</span><br><span style="color: hsl(120, 100%, 40%);">+ print_debug("Set deprecated_in for %s to %s\n", mem->name, mem->deprecated_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int process_xml_removedin_node(xmlNode *node, struct member *mem)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *tmp = (const char *) xmlNodeGetContent(node);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tmp && !strlen_zero(tmp)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ xmlFree((void *) mem->removed_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ mem->removed_in = tmp;</span><br><span style="color: hsl(120, 100%, 40%);">+ print_debug("Set removed_in for %s to %s\n", mem->name, mem->removed_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static int process_xml_ref_node(xmlNode *node, struct member *mem, struct reference_list *refs)</span><br><span> {</span><br><span> struct reference *ref;</span><br><span>@@ -416,6 +444,8 @@</span><br><span> { "conflict", process_xml_conflict_node },</span><br><span> { "use", process_xml_use_node },</span><br><span> { "member_data", process_xml_member_data_node },</span><br><span style="color: hsl(120, 100%, 40%);">+ { "deprecated_in", process_xml_deprecatedin_node },</span><br><span style="color: hsl(120, 100%, 40%);">+ { "removed_in", process_xml_removedin_node },</span><br><span> };</span><br><span> </span><br><span> static node_handler lookup_node_handler(xmlNode *node)</span><br><span>diff --git a/menuselect/menuselect.h b/menuselect/menuselect.h</span><br><span>index d41859e..9c71de2 100644</span><br><span>--- a/menuselect/menuselect.h</span><br><span>+++ b/menuselect/menuselect.h</span><br><span>@@ -70,6 +70,8 @@</span><br><span> const char *touch_on_change;</span><br><span> const char *support_level;</span><br><span> const char *replacement;</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *deprecated_in;</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *removed_in;</span><br><span> /*! member_data is just an opaque, member-specific string */</span><br><span> const char *member_data;</span><br><span> /*! This module is currently selected */</span><br><span>diff --git a/menuselect/menuselect_curses.c b/menuselect/menuselect_curses.c</span><br><span>index fe42119..7698061 100644</span><br><span>--- a/menuselect/menuselect_curses.c</span><br><span>+++ b/menuselect/menuselect_curses.c</span><br><span>@@ -279,13 +279,21 @@</span><br><span> </span><br><span> if (!mem->is_separator) { /* Separators lack support levels */</span><br><span> { /* support level */</span><br><span style="color: hsl(120, 100%, 40%);">+ char buf2[64];</span><br><span> wmove(menu, end - start_y + 7, start_x);</span><br><span> snprintf(buf, sizeof(buf), "Support Level: %s", mem->support_level);</span><br><span> if (mem->replacement && *mem->replacement) {</span><br><span style="color: hsl(0, 100%, 40%);">- char buf2[64];</span><br><span> snprintf(buf2, sizeof(buf2), ", Replaced by: %s", mem->replacement);</span><br><span> strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (mem->deprecated_in && *mem->deprecated_in) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf2, sizeof(buf2), ", Deprecated in: %s", mem->deprecated_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (mem->removed_in && *mem->removed_in) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf2, sizeof(buf2), ", Removed in: %s", mem->removed_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> waddstr(menu, buf);</span><br><span> }</span><br><span> }</span><br><span>diff --git a/menuselect/menuselect_newt.c b/menuselect/menuselect_newt.c</span><br><span>index bc03f9b..b0f7574 100644</span><br><span>--- a/menuselect/menuselect_newt.c</span><br><span>+++ b/menuselect/menuselect_newt.c</span><br><span>@@ -110,6 +110,7 @@</span><br><span> static void display_member_info(struct member *mem)</span><br><span> {</span><br><span> char buffer[128] = { 0 };</span><br><span style="color: hsl(120, 100%, 40%);">+ char buf2[64];</span><br><span> </span><br><span> struct reference *dep;</span><br><span> struct reference *con;</span><br><span>@@ -175,10 +176,17 @@</span><br><span> { /* Support Level */</span><br><span> snprintf(buffer, sizeof(buffer), "%s", mem->support_level);</span><br><span> if (mem->replacement && *mem->replacement) {</span><br><span style="color: hsl(0, 100%, 40%);">- char buf2[64];</span><br><span> snprintf(buf2, sizeof(buf2), ", Replaced by: %s", mem->replacement);</span><br><span> strncat(buffer, buf2, sizeof(buffer) - strlen(buffer) - 1);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (mem->deprecated_in && *mem->deprecated_in) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf2, sizeof(buf2), ", Deprecated in: %s", mem->deprecated_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ strncat(buffer, buf2, sizeof(buffer) - strlen(buffer) - 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (mem->removed_in && *mem->removed_in) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf2, sizeof(buf2), ", Removed in: %s", mem->removed_in);</span><br><span style="color: hsl(120, 100%, 40%);">+ strncat(buffer, buf2, sizeof(buffer) - strlen(buffer) - 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> if (mem->is_separator) {</span><br><span> newtTextboxSetText(supportLevelDataTextbox, "");</span><br><span> } else {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15614">change 15614</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15614"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I6952889cf08e0e9e99cf8b43f99b3cef4688087a </div>
<div style="display:none"> Gerrit-Change-Number: 15614 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>