[asterisk-commits] branch russell/menuselect_buildoptions r34024 - in /team/russell/menuselect_b...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jun 13 20:33:00 MST 2006


Author: russell
Date: Tue Jun 13 22:32:59 2006
New Revision: 34024

URL: http://svn.digium.com/view/asterisk?rev=34024&view=rev
Log:
- add a MODULEINFO block to app_voicemail with some build options
- modify menuselect to pull these out of the xml input and store the info in
  appropriate structures

Modified:
    team/russell/menuselect_buildoptions/apps/app_voicemail.c
    team/russell/menuselect_buildoptions/build_tools/menuselect.c
    team/russell/menuselect_buildoptions/build_tools/menuselect.h

Modified: team/russell/menuselect_buildoptions/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/apps/app_voicemail.c?rev=34024&r1=34023&r2=34024&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/apps/app_voicemail.c (original)
+++ team/russell/menuselect_buildoptions/apps/app_voicemail.c Tue Jun 13 22:32:59 2006
@@ -40,6 +40,12 @@
  * 12-04-2006 : Support for Polish added by DIR (www.dir.pl)
  *				 Bartosz Supczinski <Bartosz.Supczinski at dir.pl>
  */
+
+/*** MODULEINFO
+	<buildopt>ODBC_STORAGE</buildopt>
+	<buildopt>EXTENDED_ODBC_STORAGE</buildopt>
+	<buildopt>IMAP_STORAGE</buildopt>
+ ***/
 
 #include "asterisk.h"
 

Modified: team/russell/menuselect_buildoptions/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect.c?rev=34024&r1=34023&r2=34024&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect.c (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect.c Tue Jun 13 22:32:59 2006
@@ -36,7 +36,7 @@
 
 #include "asterisk/linkedlists.h"
 
-#undef MENUSELECT_DEBUG
+#define MENUSELECT_DEBUG
 
 /*! The list of categories */
 struct categories categories = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
@@ -73,18 +73,6 @@
 /*! Force a clean of the source tree */
 static int force_clean = 0;
 
-static int add_category(struct category *cat);
-static int add_member(struct member *mem, struct category *cat);
-static int parse_makeopts_xml(const char *makeopts_xml);
-static int process_deps(void);
-static int build_member_list(void);
-static void mark_as_present(const char *member, const char *category);
-static void process_prev_failed_deps(char *buf);
-static int parse_existing_config(const char *infile);
-static int generate_makeopts_file(void);
-static void free_member_list(void);
-static void free_trees(void);
-
 /*! \brief return a pointer to the first non-whitespace character */
 static inline char *skip_blanks(char *str)
 {
@@ -129,6 +117,46 @@
 	return 0;
 }
 
+/*! \brief Free a member structure and all of its members */
+static void free_member(struct member *mem)
+{
+	struct depend *dep;
+	struct conflict *cnf;
+	struct buildopt *bop;
+
+	while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list)))
+		free(dep);
+	while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list)))
+		free(cnf);
+	while ((bop = AST_LIST_REMOVE_HEAD(&mem->buildopts, list)))
+		free(bop);
+	free(mem);
+}
+
+/*! \brief Free all categories and their members */
+static void free_member_list(void)
+{
+	struct category *cat;
+	struct member *mem;
+
+	while ((cat = AST_LIST_REMOVE_HEAD(&categories, list))) {
+		while ((mem = AST_LIST_REMOVE_HEAD(&cat->members, list)))
+			free_member(mem);
+		free(cat);
+	}
+}
+
+/*! \brief Free all of the XML trees */
+static void free_trees(void)
+{
+	struct tree *tree;
+
+	while ((tree = AST_LIST_REMOVE_HEAD(&trees, list))) {
+		mxmlDelete(tree->root);
+		free(tree);
+	}
+}
+
 /*! \brief Parse an input makeopts file */
 static int parse_makeopts_xml(const char *makeopts_xml)
 {
@@ -136,8 +164,6 @@
 	struct category *cat;
 	struct tree *tree;
 	struct member *mem;
-	struct depend *dep;
-	struct conflict *cnf;
 	mxml_node_t *cur;
 	mxml_node_t *cur2;
 	mxml_node_t *cur3;
@@ -203,8 +229,11 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "depend", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(dep = calloc(1, sizeof(*dep))))
+				struct depend *dep;
+				if (!(dep = calloc(1, sizeof(*dep)))) {
+					free_member(mem);
 					return -1;
+				}
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					dep->name = cur3->child->value.opaque;
 					AST_LIST_INSERT_HEAD(&mem->deps, dep, list);
@@ -216,8 +245,11 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "conflict", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(cnf = calloc(1, sizeof(*cnf))))
+				struct conflict *cnf;
+				if (!(cnf = calloc(1, sizeof(*cnf)))) {
+					free_member(mem);
 					return -1;
+				}
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					cnf->name = cur3->child->value.opaque;
 					AST_LIST_INSERT_HEAD(&mem->conflicts, cnf, list);
@@ -225,8 +257,24 @@
 					free(cnf);
 			}
 
+			for (cur3 = mxmlFindElement(cur2, cur2, "buildopt", NULL, NULL, MXML_DESCEND);
+			     cur3 && cur3->child;
+			     cur3 = mxmlFindElement(cur3, cur2, "buildopt", NULL, NULL, MXML_DESCEND))
+			{
+				struct buildopt *bop;
+				if (!(bop = calloc(1, sizeof(*bop)))) {
+					free_member(mem);
+					return -1;
+				}
+				if (!strlen_zero(cur3->child->value.opaque)) {
+					bop->name = cur3->child->value.opaque;
+					AST_LIST_INSERT_HEAD(&mem->buildopts, bop, list);
+				} else
+					free(bop);
+			}
+
 			if (add_member(mem, cat))
-				free(mem);
+				free_member(mem);
 		}
 	}
 
@@ -513,6 +561,7 @@
 	struct member *mem;
 	struct depend *dep;
 	struct conflict *cnf;
+	struct buildopt *bop;
 
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		fprintf(stderr, "Category: '%s'\n", cat->name);
@@ -526,41 +575,12 @@
 				fprintf(stderr, "      --> Conflicts with: '%s'\n", cnf->name);
 			if (!AST_LIST_EMPTY(&mem->conflicts))
 				fprintf(stderr, "      --> Conflicts Found: %s\n", mem->conflictsfailed ? "Yes" : "No");
+			AST_LIST_TRAVERSE(&mem->buildopts, bop, list)
+				fprintf(stderr, "      --> Build Option: %s\n", bop->name);
 		}
 	}
 }
 #endif
-
-/*! \brief Free all categories and their members */
-static void free_member_list(void)
-{
-	struct category *cat;
-	struct member *mem;
-	struct depend *dep;
-	struct conflict *cnf;
-
-	while ((cat = AST_LIST_REMOVE_HEAD(&categories, list))) {
-		while ((mem = AST_LIST_REMOVE_HEAD(&cat->members, list))) {
-			while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list)))
-				free(dep);
-			while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list)))
-				free(cnf);
-			free(mem);
-		}
-		free(cat);
-	}
-}
-
-/*! \brief Free all of the XML trees */
-static void free_trees(void)
-{
-	struct tree *tree;
-
-	while ((tree = AST_LIST_REMOVE_HEAD(&trees, list))) {
-		mxmlDelete(tree->root);
-		free(tree);
-	}
-}
 
 /*! \brief Enable/Disable all members of a category as long as dependencies have been met and no conflicts are found */
 void set_all(struct category *cat, int val)

Modified: team/russell/menuselect_buildoptions/build_tools/menuselect.h
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect.h?rev=34024&r1=34023&r2=34024&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect.h (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect.h Tue Jun 13 22:32:59 2006
@@ -45,6 +45,15 @@
 	AST_LIST_ENTRY(conflict) list;
 };
 
+struct buildopt {
+	/*! the name of the build option */
+	const char *name;
+	/*! whether this build option is currently enabled */
+	int enabled:1;
+	/*! for linking */
+	AST_LIST_ENTRY(buildopt) list;
+};
+
 struct member {
 	/*! What will be sent to the makeopts file */
 	const char *name;
@@ -62,6 +71,8 @@
 	AST_LIST_HEAD_NOLOCK(, depend) deps;
 	/*! conflicts of this module */
 	AST_LIST_HEAD_NOLOCK(, conflict) conflicts;
+	/*! a list of build options for this member */
+	AST_LIST_HEAD_NOLOCK(, buildopt) buildopts;
 	/*! for making a list of modules */
 	AST_LIST_ENTRY(member) list;
 };



More information about the asterisk-commits mailing list