[asterisk-commits] kpfleming: trunk r352626 - in /trunk: ./ build_tools/ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 25 15:31:31 CST 2012


Author: kpfleming
Date: Wed Jan 25 15:31:28 2012
New Revision: 352626

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=352626
Log:
Remove "asterisk/version.h" in favor of "asterisk/ast_version.h".

A long time ago, in a land far far away, we added "asterisk/ast_version.h",
which provides the ast_get_version() and ast_get_version_num() functions. These
were added so that modules that needed the version information for the Asterisk
instance they were loaded in could actually get it (as opposed the version that
they were compiled against). We changed everything in the tree to use the
new mechanism (although later main/test.c was added using the old method).
However, the old mechanism was never removed, and as a result, new code is
still trying to use it.

This commit removes asterisk/version.h and replaces it with a header that
will generate a compile-time error if you try to use it (the error message
tells you which header you should use instead). It also removes the Makefile
and build_tools bits that generated the file, and it updates main/test.c to
use the 'proper' method of getting the Asterisk version information.

This is an API change and thus is being committed for trunk only, but it's
a fairly minor one and definitely improves the situation for out-of-tree
modules.

Added:
    trunk/include/asterisk/version.h   (with props)
Removed:
    trunk/build_tools/make_version_h
Modified:
    trunk/Makefile
    trunk/include/asterisk/   (props changed)
    trunk/main/test.c

Modified: trunk/Makefile
URL: http://svnview.digium.com/svn/asterisk/trunk/Makefile?view=diff&rev=352626&r1=352625&r2=352626
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Wed Jan 25 15:31:28 2012
@@ -386,7 +386,7 @@
 	+@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDFLAGS)
 	+@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LIBS)
 
-$(SUBDIRS): main/version.c include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
+$(SUBDIRS): main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
 
 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
     # Non-windows:
@@ -422,11 +422,6 @@
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
-include/asterisk/version.h: FORCE
-	@build_tools/make_version_h > $@.tmp
-	@cmp -s $@.tmp $@ || mv $@.tmp $@
-	@rm -f $@.tmp
-
 include/asterisk/buildopts.h: menuselect.makeopts
 	@build_tools/make_buildopts_h > $@.tmp
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
@@ -449,7 +444,6 @@
 	rm -f defaults.h
 	rm -f include/asterisk/build.h
 	rm -f main/version.c
-	rm -f include/asterisk/version.h
 	@$(MAKE) -C menuselect clean
 	cp -f .cleancount .lastclean
 

Propchange: trunk/include/asterisk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jan 25 15:31:28 2012
@@ -1,4 +1,3 @@
 build.h
 buildopts.h
 autoconfig.h
-version.h

Added: trunk/include/asterisk/version.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/version.h?view=auto&rev=352626
==============================================================================
--- trunk/include/asterisk/version.h (added)
+++ trunk/include/asterisk/version.h Wed Jan 25 15:31:28 2012
@@ -1,0 +1,1 @@
+#error "Do not include 'asterisk/version.h'; use 'asterisk/ast_version.h' instead."

Propchange: trunk/include/asterisk/version.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/include/asterisk/version.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: trunk/include/asterisk/version.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/main/test.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/test.c?view=diff&rev=352626&r1=352625&r2=352626
==============================================================================
--- trunk/main/test.c (original)
+++ trunk/main/test.c Wed Jan 25 15:31:28 2012
@@ -38,7 +38,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/cli.h"
 #include "asterisk/term.h"
-#include "asterisk/version.h"
+#include "asterisk/ast_version.h"
 #include "asterisk/paths.h"
 #include "asterisk/time.h"
 #include "asterisk/manager.h"
@@ -386,14 +386,14 @@
 				last_results.total_time / 1000, last_results.total_time % 1000,
 				last_results.total_tests);
 		fprintf(f_xml, "\t<properties>\n");
-		fprintf(f_xml, "\t\t<property name=\"version\" value=\"%s\"/>\n", ASTERISK_VERSION);
+		fprintf(f_xml, "\t\t<property name=\"version\" value=\"%s\"/>\n", ast_get_version());
 		fprintf(f_xml, "\t</properties>\n");
 	}
 
 	/* txt header information */
 	if (f_txt) {
-		fprintf(f_txt, "Asterisk Version:         %s\n", ASTERISK_VERSION);
-		fprintf(f_txt, "Asterisk Version Number:  %d\n", ASTERISK_VERSION_NUM);
+		fprintf(f_txt, "Asterisk Version:         %s\n", ast_get_version());
+		fprintf(f_txt, "Asterisk Version Number:  %s\n", ast_get_version_num());
 		fprintf(f_txt, "Number of Tests:          %d\n", last_results.total_tests);
 		fprintf(f_txt, "Number of Tests Executed: %d\n", (last_results.total_passed + last_results.total_failed));
 		fprintf(f_txt, "Passed Tests:             %d\n", last_results.total_passed);




More information about the asterisk-commits mailing list