[svn-commits] branch russell/menuselect_buildoptions r34130 - /team/russell/menuselect_buil...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Jun 14 08:54:29 MST 2006


Author: russell
Date: Wed Jun 14 10:54:28 2006
New Revision: 34130

URL: http://svn.digium.com/view/asterisk?rev=34130&view=rev
Log:
add support for saving build options to the makeopts output file and reading
them back from existing files

Modified:
    team/russell/menuselect_buildoptions/build_tools/menuselect.c

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=34130&r1=34129&r2=34130&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect.c (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect.c Wed Jun 14 10:54:28 2006
@@ -471,6 +471,39 @@
 		fprintf(stderr, "Unable to find '%s' in category '%s'\n", mem_name, cat_name);
 }
 
+static void process_buildopt(char *buf)
+{
+	const char *bop_name, *mem_name;
+	struct category *cat;
+	struct member *mem;
+	struct buildopt *bop;
+
+	mem_name = strsep(&buf, "=");
+	bop_name = strsep(&buf, "\n");
+
+	if (!bop_name || !mem_name)
+		return;
+
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if (strcasecmp(mem->name, mem_name))
+				continue;
+			AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
+				if (strcasecmp(bop->name, bop_name))
+					continue;
+				bop->enabled = 1;
+				break;
+			}
+			break;
+		}
+		if (bop)
+			break;
+	}
+
+	if (!bop || !mem)
+		fprintf(stderr, "Unable to find '%s' for member '%s'\n", bop_name, mem_name);
+}
+
 /*! \brief Parse an existing output makeopts file and enable members previously selected */
 static int parse_existing_config(const char *infile)
 {
@@ -515,7 +548,12 @@
 			process_prev_failed_deps(parse);
 			continue;
 		}
-	
+
+		if (!strcasecmp(category, "MENUSELECT_BUILDOPT")) {
+			process_buildopt(parse);
+			continue;
+		}
+
 		while ((member = strsep(&parse, " \n"))) {
 			member = skip_blanks(member);
 			if (strlen_zero(member))
@@ -535,6 +573,7 @@
 	FILE *f;
 	struct category *cat;
 	struct member *mem;
+	struct buildopt *bop;
 
 	if (!(f = fopen(output_makeopts, "w"))) {
 		fprintf(stderr, "Unable to open build configuration file (%s) for writing!\n", output_makeopts);
@@ -557,6 +596,10 @@
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
 			if (mem->depsfailed || mem->conflictsfailed)
 				fprintf(f, "MENUSELECT_DEPSFAILED=%s=%s\n", cat->name, mem->name);
+			AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
+				if (bop->enabled)
+					fprintf(f, "MENUSELECT_BUILDOPT=%s=%s\n", mem->name, bop->name);
+			}
 		}
 	}
 
@@ -588,7 +631,7 @@
 			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);
+				fprintf(stderr, "      --> Build Option: %s  (%s)\n", bop->name, bop->enabled ? "Enabled" : "Disabled");
 		}
 	}
 }



More information about the svn-commits mailing list