Merge branch 'development' v5.5
authorpk910 <philipp@zoelle1.de>
Thu, 6 Sep 2012 12:17:49 +0000 (14:17 +0200)
committerpk910 <philipp@zoelle1.de>
Thu, 6 Sep 2012 12:17:49 +0000 (14:17 +0200)
Makefile.am
autogen.sh [changed mode: 0644->0755]
src/modules.c
src/modules/global.mod/cmd_global_netinfo.c
src/modules/global.mod/cmd_global_version.c
src/modules/module.h
src/version.h
src/version.sh [changed mode: 0644->0755]

index 6f9dce454235dd971892a2c505f3480d1b8b0522..02a219c4c6a8f20b2ba248377436fb18ad7a7b61 100644 (file)
@@ -4,7 +4,7 @@ AM_CFLAGS = $(MYSQL_CFLAGS)
 BUILT_SOURCES = version.c
 version.c: checkversion
 checkversion:
-       cd src && chmod +x version.sh && ./version.sh && cd ..
+       cd src && ./version.sh && cd ..
 
 noinst_PROGRAMS = neonserv
 noinst_LTLIBRARIES = libDummyServ.la libfuncmds.la libglobalcmd.la libNeonHelp.la libNeonBackup.la libNeonServ.la libNeonSpam.la libstats.la libNeonFun.la libNeonKick.la
old mode 100644 (file)
new mode 100755 (executable)
index b451c0d25614683f4293d7c13704747cf93a3f34..5e0c8262f561d3432e1d148d5ab97e096a9082ca 100644 (file)
@@ -48,6 +48,7 @@
 /* 190     */ /* UserNode.h */
 /* 191-193 */ #include "ModuleFunctions.h"
 /* 194     */ /* bots.h */
+/* 195-196 */ /* version.h */
 
 #define Function void *
 
@@ -257,7 +258,9 @@ void *global_functions[] = {
 /* 191 */ (Function) module_global_cmd_register_neonbackup,
 /* 192 */ (Function) module_global_cmd_unregister_neonbackup,
 /* 193 */ (Function) module_neonbackup_recover_chan,
-/* 194 */ (Function) requestInvite
+/* 194 */ (Function) requestInvite,
+/* 195 */ (Function) is_stable_revision,
+/* 196 */ (Function) get_dev_revision
 };
 
 static int module_id_counter = 1;
index 9deeafa9d1e6db9879d6710058dc2d132eb0a629..02a04261e8fd297b5d4df36228c99e3bb4312bd7 100644 (file)
@@ -152,7 +152,7 @@ CMD_BIND(global_cmd_netinfo) {
     #endif
     
     if(strcmp(get_revision(), ""))
-        sprintf(tmp, "%s.%d  (%s)", NEONSERV_VERSION, get_patchlevel(), get_revision());
+        sprintf(tmp, "%s.%d (%s: %s)", NEONSERV_VERSION, get_patchlevel(), (is_stable_revision() ? "stable" : "dev"), (is_stable_revision() ? get_revision() : get_dev_revision()));
     else 
         sprintf(tmp, "%s.%d", NEONSERV_VERSION, get_patchlevel());
     content[0] = get_language_string(user, "NS_NETINFO_VERSION");
index faa03ac9f55f6543e049821ae0b6b14e471d5b5d..77ccb748f620c91236fc06b7a8386092a03d56cd 100644 (file)
@@ -22,7 +22,7 @@
 */
 
 CMD_BIND(global_cmd_version) {
-    reply(textclient, user, "\002NeonServ %s.%d\002 (%s), written by pk910", NEONSERV_VERSION, get_patchlevel(), (strcmp(get_revision(), "") ? get_revision() : "-"));
+    reply(textclient, user, "\002NeonServ %s.%d %s\002 (%s), written by pk910", NEONSERV_VERSION, get_patchlevel(), (is_stable_revision() ? "(stable)" : "(dev)"), (is_stable_revision() ? (strcmp(get_revision(), "") ? get_revision() : "-") : get_dev_revision()));
     reply(textclient, user, "Build (#%s) %s (%s lines, " COMPILER ")", get_compilation(), get_creation(), get_codelines());
     reply(textclient, user, "NeonServ can be found on: http://dev.pk910.de/NeonServ");
     //helpers :D
index 1a8426c06c1894fac726fb3d665823187535df91..d5b1d7a1dbb94b7776b962139e0353f124ac088b 100644 (file)
@@ -224,6 +224,8 @@ extern int module_id;
 /* 192 */ #define module_global_cmd_unregister_neonbackup ((void (*)(char *))global[192])
 /* 193 */ #define module_neonbackup_recover_chan ((void (*)(struct ChanNode *))global[193])
 /* 194 */ #define requestInvite ((void (*)(struct UserNode *, struct ChanNode *))global[194])
+/* 195 */ #define is_stable_revision ((const int (*)(void))global[195])
+/* 196 */ #define get_dev_revision ((const char * (*)(void))global[196])
 
 #define MODULE_HEADER(initfunc,startfunc,stopfunc) \
     void **global = NULL; \
index 2b653c2b12e70ee1357b4834c2746d311f91e821..dec5d86af2a6a2deffbc6b0563894c6b5cd93ea3 100644 (file)
@@ -26,11 +26,15 @@ extern const char *compilation;
 extern const char *creation;
 extern const char *revision;
 extern const char *codelines;
+extern const int revision_master;
+extern const char *dev_revision;
 extern const int patchlevel;
 
 const char *get_compilation();
 const char *get_creation();
 const char *get_revision();
+const int is_stable_revision();
+const char *get_dev_revision();
 const char *get_codelines();
 const int get_patchlevel();
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index a7c712f..68a8e4f
@@ -20,13 +20,24 @@ else \
 codelines=`find . -type f -regex '\./.*\.h' -or -regex '\./.*\.c' |xargs cat|wc -l`
 
 
-git_revision=`git rev-list -n 1 --pretty="format:%h" --header master | grep '^[0-9a-f]*$'`
-if test "x$git_revision" = "x" ; then
+git_revision_id=`git rev-list -n 1 --pretty="format:%h" --header refs/heads/master | grep '^[0-9a-f]*$'`
+if test "x$git_revision_id" = "x" ; then
   git_revision="0"
   git_commitcount="0"
+  git_is_stable="1"
+  git_dev_rev=""
 else
-  git_commitcount=`git rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"`
-  git_revision="git-$git_commitcount-$git_revision"
+  git_commitcount=`git rev-list --oneline --first-parent refs/heads/master | wc -l | sed "s/[ \t]//g"`
+  git_revision="git-$git_revision_id"
+  
+  git_real_revision_id=`git rev-list -n 1 --pretty="format:%h" --header HEAD | grep '^[0-9a-f]*$'`
+  if test "$git_revision_id" = "$git_real_revision_id" ; then
+    git_is_stable="1"
+    git_dev_rev=""
+  else
+    git_is_stable="0"
+    git_dev_rev="git-$git_real_revision_id"
+  fi
 fi
 
 
@@ -55,6 +66,8 @@ const char *compilation = "$compilation";
 const char *creation = "$creation";
 const char *revision = "$git_revision";
 const char *codelines = "$codelines";
+const int revision_master = $git_is_stable;
+const char *dev_revision = "$git_dev_rev";
 
 const int patchlevel = ($git_commitcount ? ($git_commitcount - VERSION_PATCHLEVEL) : 0);
 
@@ -74,6 +87,14 @@ const char *get_codelines() {
     return codelines;
 }
 
+const int is_stable_revision() {
+    return revision_master;
+}
+
+const char *get_dev_revision() {
+    return dev_revision;
+}
+
 const int get_patchlevel() {
     return patchlevel;
 }