[asterisk-commits] trunk r34577 - in /trunk: apps/ build_tools/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Jun 18 05:52:08 MST 2006


Author: kpfleming
Date: Sun Jun 18 07:52:08 2006
New Revision: 34577

URL: http://svn.digium.com/view/asterisk?rev=34577&view=rev
Log:
commit russell's menuselect/buildoptions work with some changes:
  reverted per-directory .cleancount support
  added ability for 'remove_on_change' to support multiple filenames
  add 'remove_on_change' support to members, not just categories
  only do 'remove_on_change' removals if the config is actually saved
  add a 'remove_on_change' entry for each module found by prep_moduledeps so that if it gets turned off any existing .o/.so files will disappear

Modified:
    trunk/apps/app_voicemail.c
    trunk/build_tools/cflags.xml
    trunk/build_tools/get_moduleinfo   (props changed)
    trunk/build_tools/menuselect.c
    trunk/build_tools/menuselect.h
    trunk/build_tools/prep_moduledeps

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=34577&r1=34576&r2=34577&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sun Jun 18 07:52:08 2006
@@ -42,7 +42,7 @@
  */
 
 /*** MAKEOPTS
-<category name="MENUSELECT_app_voicemail" displayname="Voicemail Build Options" positive_output="yes" force_clean_on_change="yes">
+<category name="MENUSELECT_app_voicemail" displayname="Voicemail Build Options" positive_output="yes" remove_on_change="apps/app_voicemail.o">
 	<member name="ODBC_STORAGE" displayname="Storage of Voicemail using ODBC">
 		<depend>unixodbc</depend>
 		<defaultenabled>no</defaultenabled>

Modified: trunk/build_tools/cflags.xml
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/cflags.xml?rev=34577&r1=34576&r2=34577&view=diff
==============================================================================
--- trunk/build_tools/cflags.xml (original)
+++ trunk/build_tools/cflags.xml Sun Jun 18 07:52:08 2006
@@ -1,4 +1,4 @@
-	<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" force_clean_on_change="yes">
+	<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
 		<member name="DEBUG_CHANNEL_LOCKS" displayname="Debug Channel Locking">
 		</member>
 		<member name="DEBUG_SCHEDULER" displayname="Enable Scheduler Debugging Output">

Propchange: trunk/build_tools/get_moduleinfo
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Jun 18 07:52:08 2006
@@ -1,1 +1,1 @@
-Author Date Id Revision
+Author ID Date Revision

Modified: trunk/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/menuselect.c?rev=34577&r1=34576&r2=34577&view=diff
==============================================================================
--- trunk/build_tools/menuselect.c (original)
+++ trunk/build_tools/menuselect.c Sun Jun 18 07:52:08 2006
@@ -70,9 +70,6 @@
 /*! This is set when the --check-deps argument is provided. */
 static int check_deps = 0;
 
-/*! Force a clean of the source tree */
-static int force_clean = 0;
-
 /*! \brief return a pointer to the first non-whitespace character */
 static inline char *skip_blanks(char *str)
 {
@@ -175,8 +172,7 @@
 		cat->displayname = mxmlElementGetAttr(cur, "displayname");
 		if ((tmp = mxmlElementGetAttr(cur, "positive_output")))
 			cat->positive_output = !strcasecmp(tmp, "yes");
-		if ((tmp = mxmlElementGetAttr(cur, "force_clean_on_change")))
-			cat->force_clean_on_change = !strcasecmp(tmp, "yes");
+		cat->remove_on_change = mxmlElementGetAttr(cur, "remove_on_change");
 
 		if (add_category(cat)) {
 			free(cat);
@@ -193,8 +189,10 @@
 			mem->name = mxmlElementGetAttr(cur2, "name");
 			mem->displayname = mxmlElementGetAttr(cur2, "displayname");
 		
+			mem->remove_on_change = mxmlElementGetAttr(cur2, "remove_on_change");
+
 			if (!cat->positive_output)
-				mem->enabled = 1;
+				mem->was_enabled = mem->enabled = 1;
 	
 			cur3 = mxmlFindElement(cur2, cur2, "defaultenabled", NULL, NULL, MXML_DESCEND);
 			if (cur3 && cur3->child)
@@ -348,7 +346,7 @@
 			continue;
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
 			if (!strcmp(member, mem->name)) {
-				mem->enabled = cat->positive_output;
+				mem->was_enabled = mem->enabled = cat->positive_output;
 				break;
 			}
 		}
@@ -374,8 +372,6 @@
 
 	if (mem && !(mem->depsfailed || mem->conflictsfailed)) {
 		mem->enabled = !mem->enabled;
-		if (cat->force_clean_on_change)
-			force_clean = 1;
 	}
 }
 
@@ -507,6 +503,34 @@
 
 	fclose(f);
 
+	/* Traverse all categories and members and remove any files that are supposed
+	   to be removed when an item has been changed */
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		unsigned int had_changes = 0;
+		char *file, *buf;
+
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if (mem->enabled == mem->was_enabled)
+				continue;
+
+			had_changes = 1;
+
+			if (mem->remove_on_change) {
+				for (buf = strdupa(mem->remove_on_change), file = strsep(&buf, " ");
+				     file;
+				     file = strsep(&buf, " "))
+					unlink(file);
+			}
+		}
+
+		if (cat->remove_on_change && had_changes) {
+			for (buf = strdupa(cat->remove_on_change), file = strsep(&buf, " ");
+			     file;
+			     file = strsep(&buf, " "))
+				unlink(file);
+		}
+	}
+
 	return 0;
 }
 
@@ -522,7 +546,8 @@
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		fprintf(stderr, "Category: '%s'\n", cat->name);
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
-			fprintf(stderr, "   ==>> Member: '%s'  (%s)\n", mem->name, mem->enabled ? "Enabled" : "Disabled");
+			fprintf(stderr, "   ==>> Member: '%s'  (%s)", mem->name, mem->enabled ? "Enabled" : "Disabled");
+			fprintf(stderr, "        Was %s\n", mem->was_enabled ? "Enabled" : "Disabled");
 			AST_LIST_TRAVERSE(&mem->deps, dep, list)
 				fprintf(stderr, "      --> Depends on: '%s'\n", dep->name);
 			if (!AST_LIST_EMPTY(&mem->deps))
@@ -701,11 +726,5 @@
 	free_trees();
 	free_member_list();
 
-	/* In some cases, such as modifying the CFLAGS for the build,
-	 * a "make clean" needs to be forced.  Removing the .lastclean 
-	 * file does this. */
-	if (force_clean)
-		unlink(".lastclean");
-
 	exit(res);
 }

Modified: trunk/build_tools/menuselect.h
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/menuselect.h?rev=34577&r1=34576&r2=34577&view=diff
==============================================================================
--- trunk/build_tools/menuselect.h (original)
+++ trunk/build_tools/menuselect.h Sun Jun 18 07:52:08 2006
@@ -52,8 +52,12 @@
 	const char *displayname;
 	/*! Default setting */
 	const char *defaultenabled;
+	/*! Delete these file(s) if this member changes */
+	const char *remove_on_change;
 	/*! This module is currently selected */
 	unsigned int enabled:1;
+	/*! This module was enabled when the config was loaded */
+	unsigned int was_enabled:1;
 	/*! This module has failed dependencies */
 	unsigned int depsfailed:1;
 	/*! This module has failed conflicts */
@@ -71,10 +75,10 @@
 	const char *name;
 	/*! the name displayed in the menu */
 	const char *displayname;
-	/*! Display what is selected, as opposed to not selected */
+	/*! Delete these file(s) if anything in this category changes */
+	const char *remove_on_change;
+	/*! Output what is selected, as opposed to not selected */
 	unsigned int positive_output:1;
-	/*! Force a clean of the source tree if anything in this category changes */
-	unsigned int force_clean_on_change:1;
 	/*! the list of possible values to be set in this variable */
 	AST_LIST_HEAD_NOLOCK(, member) members;
 	/*! for linking */

Modified: trunk/build_tools/prep_moduledeps
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/prep_moduledeps?rev=34577&r1=34576&r2=34577&view=diff
==============================================================================
--- trunk/build_tools/prep_moduledeps (original)
+++ trunk/build_tools/prep_moduledeps Sun Jun 18 07:52:08 2006
@@ -38,7 +38,7 @@
 		fname=${file##${dir}/}
 		get_description ${file}
 		desc=${TDESC}
-		echo -e "\t\t<member name=\"${fname%%.c}\" displayname=\"${desc}\">"
+		echo -e "\t\t<member name=\"${fname%%.c}\" displayname=\"${desc}\" remove_on_change=\"${dir}/${fname%%.c}.o ${dir}/${fname%%.c}.so\">"
 		awk -f build_tools/get_moduleinfo ${file}
 		echo -e "\t\t</member>"
 	done



More information about the asterisk-commits mailing list