allow menuselect to display dependencies and conflicts for modules
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@31443 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
d56b15dc62
commit
6d7de07024
3 changed files with 39 additions and 20 deletions
|
@ -40,20 +40,6 @@
|
||||||
|
|
||||||
#undef MENUSELECT_DEBUG
|
#undef MENUSELECT_DEBUG
|
||||||
|
|
||||||
struct depend {
|
|
||||||
/*! the name of the dependency */
|
|
||||||
const char *name;
|
|
||||||
/*! for linking */
|
|
||||||
AST_LIST_ENTRY(depend) list;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct conflict {
|
|
||||||
/*! the name of the conflict */
|
|
||||||
const char *name;
|
|
||||||
/*! for linking */
|
|
||||||
AST_LIST_ENTRY(conflict) list;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! The list of categories */
|
/*! The list of categories */
|
||||||
struct categories categories = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
|
struct categories categories = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,19 @@
|
||||||
#define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts"
|
#define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts"
|
||||||
#define MENUSELECT_DEPS "build_tools/menuselect-deps"
|
#define MENUSELECT_DEPS "build_tools/menuselect-deps"
|
||||||
|
|
||||||
struct depend;
|
struct depend {
|
||||||
struct conflict;
|
/*! the name of the dependency */
|
||||||
|
const char *name;
|
||||||
|
/*! for linking */
|
||||||
|
AST_LIST_ENTRY(depend) list;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct conflict {
|
||||||
|
/*! the name of the conflict */
|
||||||
|
const char *name;
|
||||||
|
/*! for linking */
|
||||||
|
AST_LIST_ENTRY(conflict) list;
|
||||||
|
};
|
||||||
|
|
||||||
struct member {
|
struct member {
|
||||||
/*! What will be sent to the makeopts file */
|
/*! What will be sent to the makeopts file */
|
||||||
|
|
|
@ -126,7 +126,9 @@ void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end,
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
struct member *mem;
|
struct member *mem, *curmem = NULL;
|
||||||
|
struct depend *dep;
|
||||||
|
struct conflict *con;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
const char *desc = NULL;
|
const char *desc = NULL;
|
||||||
|
|
||||||
|
@ -146,15 +148,35 @@ void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end,
|
||||||
waddstr(menu, buf);
|
waddstr(menu, buf);
|
||||||
|
|
||||||
if (curopt + 1 == i)
|
if (curopt + 1 == i)
|
||||||
desc = mem->displayname;
|
curmem = mem;
|
||||||
|
|
||||||
if (i == end)
|
if (i == end)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc) {
|
if (curmem->displayname) {
|
||||||
wmove(menu, end - start + 2, max_x / 2 - 16);
|
wmove(menu, end - start + 2, max_x / 2 - 16);
|
||||||
waddstr(menu, desc);
|
waddstr(menu, curmem->displayname);
|
||||||
|
}
|
||||||
|
if (!AST_LIST_EMPTY(&curmem->deps)) {
|
||||||
|
wmove(menu, end - start + 3, max_x / 2 - 16);
|
||||||
|
snprintf(buf, sizeof(buf), "Depends on: ");
|
||||||
|
AST_LIST_TRAVERSE(&curmem->deps, dep, list) {
|
||||||
|
strncat(buf, dep->name, sizeof(buf) - strlen(buf) - 1);
|
||||||
|
if (AST_LIST_NEXT(dep, list))
|
||||||
|
strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
|
||||||
|
}
|
||||||
|
waddstr(menu, buf);
|
||||||
|
}
|
||||||
|
if (!AST_LIST_EMPTY(&curmem->conflicts)) {
|
||||||
|
wmove(menu, end - start + 4, max_x / 2 - 16);
|
||||||
|
snprintf(buf, sizeof(buf), "Conflicts with: ");
|
||||||
|
AST_LIST_TRAVERSE(&curmem->conflicts, con, list) {
|
||||||
|
strncat(buf, con->name, sizeof(buf) - strlen(buf) - 1);
|
||||||
|
if (AST_LIST_NEXT(con, list))
|
||||||
|
strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
|
||||||
|
}
|
||||||
|
waddstr(menu, buf);
|
||||||
}
|
}
|
||||||
wmove(menu, curopt - start, max_x / 2 - 9);
|
wmove(menu, curopt - start, max_x / 2 - 9);
|
||||||
|
|
||||||
|
|
Reference in a new issue