Explorar o código

* Use the buildts and git commit in versioning / upgrading

Now using buildts again for determining if a bot should be upgraded.
Buildts is the UTC timestamp of the last change committed to a branch.
Now also appending the branch to all versions displayed in the bot.
Also showing the short commit in place of the old svn revision.
Updates offer svn rev 9999 for older bots.
Bryan Drewery %!s(int64=17) %!d(string=hai) anos
pai
achega
428466cf90
Modificáronse 18 ficheiros con 75 adicións e 121 borrados
  1. 12 5
      Makefile.in
  2. 2 2
      build.sh
  3. 0 1
      private/.gitignore
  4. 0 19
      private/getdate.sh
  5. 0 27
      private/getrev.sh
  6. 0 9
      private/getts.sh
  7. 1 1
      src/Makefile.in
  8. 7 9
      src/botcmd.c
  9. 5 5
      src/botmsg.c
  10. 13 13
      src/botnet.c
  11. 2 2
      src/botnet.h
  12. 2 2
      src/cmds.c
  13. 5 6
      src/dcc.c
  14. 8 5
      src/main.c
  15. 2 3
      src/main.h
  16. 12 8
      src/mod/update.mod/update.c
  17. 2 2
      src/tandem.h
  18. 2 2
      src/users.c

+ 12 - 5
Makefile.in

@@ -20,8 +20,10 @@ CONFIGFILES = config.cache config.log config.status config.h src/buildinfo.h
 DISTROFILES = README LICENSE config.h.in autotools/ doc/ scripts/ lib/ Makefile.in build.sh configure pack/ src/
 EXCLUDES = pack/pack.cfg $(CONFIGFILES) $(STATICMAKEFILES)
 
-REVISION 	:= $(shell private/getrev.sh)
-BUILDTS 	:= $(shell private/getts.sh)
+COMMIT_FULL 	:= $(shell git log -1 --pretty=format:%H HEAD)
+COMMIT_SHORT 	:= $(shell git log -1 --pretty=format:%h HEAD)
+BRANCH 		:= $(shell git branch --no-color | grep "^*" | sed -e 's/^\* //')
+BUILDTS 	:= $(shell git log -1 --pretty=format:%ct HEAD)
 
 HELPFILE = doc/help.txt
 SETTINGSFILE = doc/settings.txt
@@ -55,12 +57,12 @@ _CFLGS = -fno-strict-aliasing -W -Wformat \
 MAKEFLAGS = -s -j4
 
 MAKE_BIN = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD)' \
-'CCDEPMODE=$(CCDEPMODE)' 'REVISION=$(REVISION)' 'BUILDTS=$(BUILDTS)' \
+'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' \
 'STRIP=$(STRIP)' 'CFLGS=$(CFLGS)' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
 
 MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CCDEBUG)' 'LD=$(LDDEBUG) -g' \
-'CCDEPMODE=$(CCDEPMODE)' 'REVISION=$(REVISION)' 'BUILDTS=$(BUILDTS)' \
+'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' \
 'STRIP=touch' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(debug)' 
 
@@ -105,7 +107,12 @@ distrib: clean
 	@for s in $(EXCLUDES); do \
 	 rm -rf $(DISTRIB)/$$s; \
 	done;
-	@sed -e 's/^REVISION .*/REVISION = $(REVISION)/' -e 's/^BUILDTS .*/BUILDTS = $(BUILDTS)/' $(DISTRIB)/Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp $(DISTRIB)/Makefile.in
+	@sed \
+	  -e 's/^COMMIT_FULL .*/COMMIT_FULL = $(COMMIT_FULL)/' \
+	  -e 's/^COMMIT_SHORT .*/COMMIT_SHORT = $(COMMIT_SHORT)/' \
+	  -e 's/^BRANCH .*/BRANCH = $(BRANCH)/' \
+	  -e 's/^BUILDTS .*/BUILDTS = $(BUILDTS)/' \
+	  $(DISTRIB)/Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp $(DISTRIB)/Makefile.in
 #	@for s in `find $(DISTRIB)/src/ -name '*.h' -or -name '*.c'`; do mangle -rnw $$s > /dev/null 2>&1; done
 
 tar: distrib

+ 2 - 2
build.sh

@@ -25,8 +25,8 @@ else
 fi
 rm -f ts ts.exe
 gcc -o ts src/timestamp.c > /dev/null 2>&1
-if [ -f private/getdate.sh ]; then
-  BUILDTS=`./ts \`private/getdate.sh\``
+if [ -d .git ]; then
+  BUILDTS=$(git log -1 --pretty=format:%ct HEAD)
 else
   BUILDTS=`grep -m 1 "BUILDTS = " Makefile.in | ${AWK} '{print $3}'` 
 fi

+ 0 - 1
private/.gitignore

@@ -1,3 +1,2 @@
 /help.bak
 /cp.sh
-/.revision.cache

+ 0 - 19
private/getdate.sh

@@ -1,19 +0,0 @@
-#! /usr/bin/env bash
-
-export TZ=GMT
-
-parse_date() {
-  echo "$1" | grep "Last Changed Date" | sed "s/Last Changed Date: \(.* \)[-+].*$/\1/"
-}
-
-info=$(svn info 2> /dev/null)
-if [ 0 -eq $? ]; then
-  date=$(parse_date "$info")
-else
-  url=$(svk info|grep "Mirrored From"|sed -e 's/Mirrored From: \(.*\),.*/\1/')
-
-  info=$(svn info $url)
-  date=$(parse_date "$info")
-fi
-echo $date
-

+ 0 - 27
private/getrev.sh

@@ -1,27 +0,0 @@
-#! /usr/bin/env bash
-parse_info() {
-  echo "$info" | grep "Last Changed Rev" | sed -e 's/.*Last Changed Rev: \(.*\).*/\1/'
-}
-
-info=$(svn info 2> /dev/null)
-if [ 0 -eq $? ]; then
-  rev=$(parse_info "$info")
-else
-# All of this queries the local svk cache
-#  DEPOTPATH=$(svk info |grep "Depot Path:"|sed -e 's/Depot Path: \/\/\(.*\)$/\1/')
-#  url="file://$HOME/.svk/local/$DEPOTPATH"
-# Or from the mirrored repo
-#  url=$(svk info|grep "Mirrored From"|sed -e 's/Mirrored From: \(.*\),.*/\1/')
-#  info=$(svn info $url)
-#  rev=$(parse_info "$info")
-  rev=$(svk info|grep "Mirrored From"|sed -e 's/Mirrored From: .*, Rev. \([0-9]*\)/\1/')
-fi
-echo $rev
-
-### Touch src/main.c if the revision has changed since the last run
-touch private/.revision.cache
-old_rev=$(< private/.revision.cache)
-if ! [ "$old_rev" = "$rev" ]; then
-  touch src/main.c
-  echo $rev > private/.revision.cache
-fi

+ 0 - 9
private/getts.sh

@@ -1,9 +0,0 @@
-#! /bin/sh
-
-export TZ=GMT
-
-rm -f ts ts.exe
-gcc -o ts src/timestamp.c > /dev/null 2>&1
-date=`private/getdate.sh`
-./ts $date
-rm -f ts ts.exe

+ 1 - 1
src/Makefile.in

@@ -8,7 +8,7 @@ depcomp = /bin/sh $(top_srcdir)/autotools/depcomp
 
 @SET_MAKE@
 
-CXXFLAGS = @CXXFLAGS@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/pack @DEFS@ $(CFLGS) '-DREVISION=$(REVISION)' -DBUILDTS=$(BUILDTS)
+CXXFLAGS = @CXXFLAGS@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/pack @DEFS@ $(CFLGS) '-DCOMMIT="$(COMMIT)"' '-DBRANCH="$(BRANCH)"' -DBUILDTS=$(BUILDTS)
 CPPFLAGS = @CPPFLAGS@
 
 OBJCOPY = @OBJCOPY@

+ 7 - 9
src/botcmd.c

@@ -610,10 +610,9 @@ static void bot_unlink(int idx, char *par)
  */
 static void bot_update(int idx, char *par)
 {
-  char *bot = NULL, x, *vversion = NULL;
+  char *bot = NULL, x, *vversion = NULL, *vcommit = NULL;
   int vlocalhub = 0;
   time_t vbuildts = 0L;
-  int vrevision = 0;
 
   bot = newsplit(&par);
   x = par[0];
@@ -627,22 +626,21 @@ static void bot_update(int idx, char *par)
   if (par[0])
     vbuildts = atol(newsplit(&par));
   if (par[0])
-    vrevision = atol(newsplit(&par));
+    vcommit = newsplit(&par);
   if (par[0])
     vversion = newsplit(&par);
 
   if (in_chain(bot))
-    updatebot(idx, bot, x, vlocalhub, vbuildts, vrevision, vversion);
+    updatebot(idx, bot, x, vlocalhub, vbuildts, vcommit, vversion);
 }
 
 /* Newbot next share?
  */
 static void bot_nlinked(int idx, char *par)
 {
-  char *newbot = NULL, *next = NULL, *p = NULL, s[1024] = "", x = 0, *vversion = NULL;
+  char *newbot = NULL, *next = NULL, *p = NULL, s[1024] = "", x = 0, *vversion = NULL, *vcommit = NULL;
   int i, vlocalhub = 0;
   time_t vbuildts = 0L;
-  int vrevision = 0;
   bool bogus = 0;
 
   newbot = newsplit(&par);
@@ -694,10 +692,10 @@ static void bot_nlinked(int idx, char *par)
   if (par[0])
     vbuildts = atol(newsplit(&par));
   if (par[0])
-    vrevision = atol(newsplit(&par));
+    vcommit = newsplit(&par);
   if (par[0])
     vversion = newsplit(&par);
-  botnet_send_nlinked(idx, newbot, next, x, vlocalhub, vbuildts, vrevision, vversion);
+  botnet_send_nlinked(idx, newbot, next, x, vlocalhub, vbuildts, vcommit, vversion);
   
   if (x == '!') {
     if (conf.bot->hub)
@@ -706,7 +704,7 @@ static void bot_nlinked(int idx, char *par)
       chatout("*** %s linked to botnet.\n", newbot);
     x = '-';
   }
-  addbot(newbot, dcc[idx].nick, next, x, vlocalhub, vbuildts, vrevision, vversion ? vversion : (char *) "");
+  addbot(newbot, dcc[idx].nick, next, x, vlocalhub, vbuildts, vcommit, vversion ? vversion : (char *) "");
 }
 
 static void bot_unlinked(int idx, char *par)

+ 5 - 5
src/botmsg.c

@@ -240,11 +240,11 @@ void botnet_send_unlinked(int idx, char *bot, char *args)
   }
 }
 
-void botnet_send_nlinked(int idx, char *bot, char *next, char flag, int vlocalhub, time_t vbuildts, int vrevision, char *vversion)
+void botnet_send_nlinked(int idx, char *bot, char *next, char flag, int vlocalhub, time_t vbuildts, char *vcommit, char *vversion)
 {
   if (tands > 0) {
-    const size_t len = simple_snprintf(OBUF, sizeof(OBUF), "n %s %s %cD0gc %d %d %d %s\n", bot, next, flag, 
-                                       vlocalhub, (int) vbuildts, vrevision, vversion ? vversion : "");
+    const size_t len = simple_snprintf(OBUF, sizeof(OBUF), "n %s %s %cD0gc %d %d %s %s\n", bot, next, flag,
+                                       vlocalhub, (int) vbuildts, vcommit, vversion ? vversion : "");
     send_tand_but(idx, OBUF, len);
   }
 }
@@ -267,8 +267,8 @@ void botnet_send_update(int idx, tand_t * ptr)
 {
   if (tands > 0) {
     /* the D0gc is a lingering hack which probably will never be able to come out. */
-    const size_t len = simple_snprintf(OBUF, sizeof(OBUF), "u %s %cD0gc %d %d %d %s\n", ptr->bot, ptr->share, ptr->localhub, 
-                                                          (int) ptr->buildts, ptr->revision, ptr->version ? ptr->version : "");
+    const size_t len = simple_snprintf(OBUF, sizeof(OBUF), "u %s %cD0gc %d %d %s %s\n", ptr->bot, ptr->share, ptr->localhub,
+                                                          (int) ptr->buildts, ptr->commit, ptr->version ? ptr->version : "");
     send_tand_but(idx, OBUF, len);
   }
 }

+ 13 - 13
src/botnet.c

@@ -74,7 +74,7 @@ tand_t *findbot(const char *who)
 
 /* Add a tandem bot to our chain list
  */
-void addbot(char *who, char *from, char *next, char flag, int vlocalhub, time_t vbuildts, int vrevision, char *vversion)
+void addbot(char *who, char *from, char *next, char flag, int vlocalhub, time_t vbuildts, char *vcommit, char *vversion)
 {
   tand_t **ptr = &tandbot, *ptr2 = NULL;
 
@@ -89,7 +89,7 @@ void addbot(char *who, char *from, char *next, char flag, int vlocalhub, time_t
   ptr2->share = flag;
   ptr2->localhub = vlocalhub;
   ptr2->buildts = vbuildts;
-  ptr2->revision = vrevision;
+  strlcpy(ptr2->commit, vcommit, sizeof(ptr2->commit));
   if (vversion && vversion[0])
     strlcpy(ptr2->version, vversion, 121);
   ptr2->next = *ptr;
@@ -121,7 +121,7 @@ void check_should_backup()
 }
 #endif /* G_BACKUP */
 
-void updatebot(int idx, char *who, char share, int vlocalhub, time_t vbuildts, int vrevision, char *vversion)
+void updatebot(int idx, char *who, char share, int vlocalhub, time_t vbuildts, char *vcommit, char *vversion)
 {
   tand_t *ptr = findbot(who);
 
@@ -132,8 +132,8 @@ void updatebot(int idx, char *who, char share, int vlocalhub, time_t vbuildts, i
       ptr->localhub = vlocalhub;
     if (vbuildts)
       ptr->buildts = vbuildts;
-    if (vrevision)
-      ptr->revision = vrevision;
+    if (vcommit)
+      strlcpy(ptr->commit, vcommit, sizeof(ptr->commit));
     if (vversion && vversion[0])
       strlcpy(ptr->version, vversion, 121);
     botnet_send_update(idx, ptr);
@@ -638,10 +638,10 @@ void tell_bottree(int idx)
 
   if (s[0])
     dprintf(idx, "(%s %s)\n", "No trace info for:", s);
-  dprintf(idx, "%s%s%s (%s %d)\n", color_str ? color_str : "", 
+  dprintf(idx, "%s%s%s (%s %s)\n", color_str ? color_str : "",
                                     conf.bot->nick,
                                     color_str ? COLOR_END(idx) : "",
-                                    egg_version, revision);
+                                    egg_version, commit);
 
   thisbot = (tand_t *) 1;
   work[0] = 0;
@@ -685,10 +685,10 @@ void tell_bottree(int idx)
             i = simple_snprintf(s, sizeof(s), "%c", bot->share);
           else
             i = simple_snprintf(s, sizeof(s), "-");
-          i = simple_snprintf(s + 1, sizeof(s) - 1, "%s%s%s (%s %d)", color_str ? color_str : "",
+          i = simple_snprintf(s + 1, sizeof(s) - 1, "%s%s%s (%s %s)", color_str ? color_str : "",
                                                 bot->bot,
                                                 color_str ? COLOR_END(idx) : "",
-                                                bot->version, bot->revision);
+                                                bot->version, bot->commit);
 	} else
 	  bot = bot->next;
       }
@@ -731,10 +731,10 @@ void tell_bottree(int idx)
                   i = simple_snprintf(s, sizeof(s), "%c", bot->share);
                 else
                   i = simple_snprintf(s, sizeof(s), "-");
-                i = simple_snprintf(s + 1, sizeof(s) - 1, "%s%s%s (%s %d)", color_str ? color_str : "",
+                i = simple_snprintf(s + 1, sizeof(s) - 1, "%s%s%s (%s %s)", color_str ? color_str : "",
                                                       bot->bot,
                                                       color_str ? COLOR_END(idx) : "",
-                                                      bot->version, bot->revision);
+                                                      bot->version, bot->commit);
 	      }
 	    }
 	  }
@@ -795,8 +795,8 @@ void dump_links(int z)
       else
         p = bot->uplink->bot;
 
-      l = simple_snprintf(x, sizeof(x), "n %s %s %cD0gc %d %d %d %s\n", bot->bot, p, bot->share, bot->localhub, 
-                                                        (int) bot->buildts, bot->revision, bot->version ? bot->version : "");
+      l = simple_snprintf(x, sizeof(x), "n %s %s %cD0gc %d %d %s %s\n", bot->bot, p, bot->share, bot->localhub,
+                                                        (int) bot->buildts, bot->commit, bot->version ? bot->version : "");
       tputs(dcc[z].sock, x, l);
     }
   }

+ 2 - 2
src/botnet.h

@@ -21,8 +21,8 @@ void tell_bottree(int);
 void dump_links(int);
 int botlink(char *, int, char *);
 int botunlink(int, const char *, const char *);
-void addbot(char *, char *, char *, char, int, time_t, int, char *);
-void updatebot(int, char *, char, int, time_t, int, char *);
+void addbot(char *, char *, char *, char, int, time_t, char *, char *);
+void updatebot(int, char *, char, int, time_t, char *, char *);
 void rembot(const char *);
 tand_t *findbot(const char *);
 void unvia(int, struct tand_t_struct *);

+ 2 - 2
src/cmds.c

@@ -386,9 +386,9 @@ static void cmd_about(int idx, char *par)
   dprintf(idx, STR("Wraith botpack by bryan\n"));
   dprintf(idx, STR("http://wraith.botpack.net\n"));
   egg_strftime(c, sizeof c, "%c %Z", gmtime(&buildts));
-  dprintf(idx, "Version: %s\n", egg_version);
+  dprintf(idx, "Version: %s\n", git_version);
   dprintf(idx, "Build: %s (%li)\n", c, (long)buildts);
-  dprintf(idx, "Revision: %d\n", revision);
+  dprintf(idx, "Commit: %s\n", commit);
   dprintf(idx, STR("(written from a base of Eggdrop 1.6.12)\n"));
   dprintf(idx, "..with credits and thanks to the following:\n");
   dprintf(idx, " \n");

+ 5 - 6
src/dcc.c

@@ -224,7 +224,7 @@ greet_new_bot(int idx)
     dcc[idx].status |= STAT_LEAF;
   dcc[idx].status |= STAT_LINKING;
 
-  dprintf(idx, "v 1001500 %d Wraith %s <%s> %d %li %d %s\n", HANDLEN, egg_version, "-", conf.bot->localhub, (long)buildts, revision, egg_version);
+  dprintf(idx, "v 1001500 %d Wraith %s <%s> %d %li %s %s\n", HANDLEN, egg_version, "-", conf.bot->localhub, (long)buildts, commit, git_version);
 
   for (int i = 0; i < dcc_total; i++) {
     if (dcc[i].type && dcc[i].type == &DCC_FORK_BOT) {
@@ -268,10 +268,9 @@ bot_version(int idx, char *par)
     return;
   }
 
-  char x[1024] = "", *vversion = NULL;
+  char x[1024] = "", *vversion = NULL, *vcommit = NULL;
   int vlocalhub = 0;
   time_t vbuildts = 0;
-  int vrevision = 0;
 
   strlcpy(dcc[idx].u.bot->version, par, 120);
   newsplit(&par);               /* 'ver' */
@@ -282,7 +281,7 @@ bot_version(int idx, char *par)
   if (par[0])
     vbuildts = atol(newsplit(&par));
   if (par[0])
-    vrevision = atol(newsplit(&par));
+    vcommit = newsplit(&par);
   if (par[0])
     vversion = newsplit(&par);
 
@@ -296,7 +295,7 @@ bot_version(int idx, char *par)
       dcc[idx].hub = 1;
     }
 
-    botnet_send_nlinked(idx, dcc[idx].nick, conf.bot->nick, '!', vlocalhub, vbuildts, vrevision, vversion);
+    botnet_send_nlinked(idx, dcc[idx].nick, conf.bot->nick, '!', vlocalhub, vbuildts, vcommit, vversion);
   } else {
     putlog(LOG_BOTS, "*", "Linked to botnet.");
     chatout("*** Linked to botnet.\n");
@@ -308,7 +307,7 @@ bot_version(int idx, char *par)
 
   touch_laston(dcc[idx].user, "linked", now);
   dcc[idx].type = &DCC_BOT;
-  addbot(dcc[idx].nick, dcc[idx].nick, conf.bot->nick, '-', vlocalhub, vbuildts, vrevision, vversion);
+  addbot(dcc[idx].nick, dcc[idx].nick, conf.bot->nick, '-', vlocalhub, vbuildts, vcommit, vversion);
   simple_snprintf(x, sizeof x, "v 1001500");
   bot_shareupdate(idx, x);
   bot_share(idx, x);

+ 8 - 5
src/main.c

@@ -89,8 +89,10 @@
 extern int		optind;
 
 const time_t 	buildts = BUILDTS;		/* build timestamp (UTC) */
-const int	revision = REVISION;
-const char	*egg_version = "1.2.16-devel";
+const char	*commit = COMMIT;
+const char	*branch = BRANCH;
+const char	*egg_version = "1.2.16";
+char	git_version[50] = "";
 
 bool	used_B = 0;		/* did we get started with -B? */
 int 	role;
@@ -425,8 +427,8 @@ static void dtx_arg(int& argc, char *argv[])
 
         egg_strftime(date, sizeof date, "%c %Z", gmtime(&buildts));
 	printf(STR("%s\nBuild Date: %s (%s%lu%s)\n"), version, date, BOLD(-1), buildts, BOLD_END(-1));
+        printf(STR("Commit: %s\n"), commit);
         printf(STR("BuildOS: %s%s%s BuildArch: %s%s%s\n"), BOLD(-1), BUILD_OS, BOLD_END(-1), BOLD(-1), BUILD_ARCH, BOLD_END(-1));
-        printf(STR("Revision: %d\n"), revision);
 	printf(STR("pack: %d conf: %d settings_t: %d prefix: %d pad: %d\n"), SIZE_PACK, SIZE_CONF, sizeof(settings_t), PREFIXLEN, SIZE_PAD);
         if (settings.uname[0]) {
           ++sdebug;
@@ -788,8 +790,9 @@ printf("out: %s\n", out);
   init_conf();			/* establishes conf and sets to defaults */
 
   /* Version info! */
-  simple_snprintf(ver, sizeof ver, STR("[%s] Wraith %s"), settings.packname, egg_version);
-  simple_snprintf(version, sizeof version, STR("[%s] Wraith %s (%lu:%d)"), settings.packname, egg_version, buildts, revision);
+  simple_snprintf(git_version, sizeof(git_version), "%s-%s", egg_version, branch);
+  simple_snprintf(ver, sizeof(ver), STR("[%s] Wraith %s"), settings.packname, git_version);
+  simple_snprintf(version, sizeof(version), STR("%s (%lu:%s)"), ver, buildts, commit);
 
   egg_memcpy(&nowtm, gmtime(&now), sizeof(struct tm));
   lastmin = nowtm.tm_min;

+ 2 - 3
src/main.h

@@ -16,13 +16,12 @@ enum {
 extern int		role, default_flags, default_uflags, do_confedit,
 			updating, do_restart;
 extern bool		use_stderr, backgrd, used_B, term_z, loading, restart_was_update, restarting;
-extern char		tempdir[], *binname, owner[], version[], ver[], quit_msg[], *socksfile;
+extern char		tempdir[], *binname, owner[], version[], ver[], quit_msg[], *socksfile, git_version[50];
 extern time_t		online_since, now, restart_time;
 extern uid_t		myuid;
 extern pid_t            mypid;
 extern const time_t	buildts;
-extern const int	revision;
-extern const char	*egg_version;
+extern const char	*egg_version, *commit, *branch;
 
 void fatal(const char *, int);
 

+ 12 - 8
src/mod/update.mod/update.c

@@ -145,6 +145,7 @@ static void update_ufsend(int idx, char *par)
   }
 }
 
+#ifdef NOTUSED
 static void update_version(int idx, char *par)
 {
   return;
@@ -163,6 +164,7 @@ static void update_version(int idx, char *par)
   }
 #endif /* HUB */
 }
+#endif
 
 /* Note: these MUST be sorted. */
 static botcmd_t C_update[] =
@@ -171,7 +173,7 @@ static botcmd_t C_update[] =
   {"un",	update_ufno, 0},
   {"us",	update_ufsend, 0},
   {"uy",	update_ufyes, 0},
-  {"v",         update_version, 0},
+//  {"v",         update_version, 0},
   {NULL,	NULL, 0}
 };
 
@@ -191,10 +193,11 @@ static void got_nu(char *botnick, char *code, char *par)
   }
 
 /* needupdate? curver */
-   newsplit(&par); //newts
-   int newrevision = atol(newsplit(&par));
+   time_t newbuildts = atol(newsplit(&par)); //newts
+   newsplit(&par); //Not used (old svn revision)
+   const char *newcommit = newsplit(&par);
 
-   if (newrevision > revision) {
+   if (newbuildts > buildts) {
      if (!conf.bot->hub) {
        dont_restructure = 1;
        putlog(LOG_MISC, "*", "Linking to %s for binary update.", botnick);
@@ -202,7 +205,7 @@ static void got_nu(char *botnick, char *code, char *par)
        usleep(1000 * 500);
        botlink("", -3, botnick);
      } else 
-       putlog(LOG_MISC, "*", "I need to be updated with %d", newrevision);
+       putlog(LOG_MISC, "*", "I need to be updated with %li/%s", (long) newbuildts, newcommit);
    }  
 }
 
@@ -370,15 +373,16 @@ static void check_updates()
 
         dcc[i].status &= ~(STAT_GETTINGU | STAT_SENDINGU | STAT_OFFEREDU);
 
-        if (bot && (bot->revision < revision)) {
-          putlog(LOG_DEBUG, "@", "Bot: %s has build %d, offering them %d", dcc[i].nick, bot->revision, revision);
+        if (bot && (bot->buildts < buildts)) {
+          putlog(LOG_DEBUG, "@", "Bot: %s has build %li/%s, offering them %li/%s", dcc[i].nick, (long)bot->buildts, bot->commit, (long) buildts, commit);
           dprintf(i, "sb u?\n");
           dcc[i].status |= STAT_OFFEREDU;
         }
       }
     }
     /* send out notice to update remote bots ... */
-    simple_snprintf(buf, sizeof buf, "nu? . %d", revision);
+    /* 9999 is a hack to force all bots from old svn-revisions to upgrade to new git style */
+    simple_snprintf(buf, sizeof buf, "nu? %li 9999 %s", buildts, commit);
     putallbots(buf);
   }
 }

+ 2 - 2
src/tandem.h

@@ -12,10 +12,10 @@ typedef struct tand_t_struct {
   struct tand_t_struct *uplink;
   struct tand_t_struct *next;
   time_t buildts;
-  int revision;
   int localhub;
   struct userrec* u;
   char *not_chans;
+  char commit[10];
   char bot[HANDLEN + 1];
   char version[121];
   char share;
@@ -59,7 +59,7 @@ void botnet_send_trace(int, char *, char *, char *);
 void botnet_send_unlink(int, char *, char *, char *, char *);
 void botnet_send_link(int, char *, char *, char *);
 void botnet_send_update(int, tand_t *);
-void botnet_send_nlinked(int, char *, char *, char, int, time_t, int, char *);
+void botnet_send_nlinked(int, char *, char *, char, int, time_t, char *, char *);
 void botnet_send_reject(int, char *, char *, char *, char *, char *);
 void botnet_send_log(int, const char *, int, const char *);
 void botnet_send_zapf(int, const char *, const char *, const char *);

+ 2 - 2
src/users.c

@@ -1021,9 +1021,9 @@ void autolink_cycle_hub(char *start)
       return;
     if (dcc[i].type == &DCC_BOT) {
       if (dcc[i].status & (STAT_OFFEREDU | STAT_GETTINGU | STAT_SENDINGU))
-        continue; /* lets let the binary update have it's peace. */
+        continue; /* lets let the binary update have its peace. */
 
-      if ((bot = findbot(dcc[i].nick)) && bot->revision != revision)
+      if ((bot = findbot(dcc[i].nick)) && bot->buildts != buildts)
         continue; /* same thing. */
 
       if (dcc[i].status & (STAT_SHARE | STAT_OFFERED | STAT_SENDING | STAT_GETTING)) {