# HG changeset patch # User timothy.murphy@nokia.com # Date 1267396635 0 # Node ID 99ac65572b14d3fc489e4d7d4af2ca66cb4cd4d0 # Parent 6125450a72c5c8ffa72344a042ff3db80e51f09a fix: use gethostname() to set host attribute as this works on a cluster whereas reading the COMPUTERNAME env var doesn't. diff -r 6125450a72c5 -r 99ac65572b14 sbsv2/raptor/lib/flm/taggedrules.mk --- a/sbsv2/raptor/lib/flm/taggedrules.mk Sun Feb 28 23:17:56 2010 +0200 +++ b/sbsv2/raptor/lib/flm/taggedrules.mk Sun Feb 28 22:37:15 2010 +0000 @@ -100,11 +100,7 @@ else - ifneq ($(filter win,$(HOSTPLATFORM)),) - TALON_HOSTNAME_VAR:=$$COMPUTERNAME - else - TALON_HOSTNAME_VAR:=$$HOSTNAME - endif +TALON_HOSTNAME_VAR:=$$HOSTNAME TALON_RECIPEATTRIBUTES:=\ name='$$RECIPE'\ diff -r 6125450a72c5 -r 99ac65572b14 sbsv2/raptor/util/config.h --- a/sbsv2/raptor/util/config.h Sun Feb 28 23:17:56 2010 +0200 +++ b/sbsv2/raptor/util/config.h Sun Feb 28 22:37:15 2010 +0000 @@ -21,6 +21,7 @@ #define HAS_GETCOMMANDLINE 1 #define HAS_MILLISECONDSLEEP 1 #define HAS_MSVCRT 1 +#define HAS_WINSOCK2 1 #else #define HAS_POLL 1 #define HAS_SETENV 1 diff -r 6125450a72c5 -r 99ac65572b14 sbsv2/raptor/util/gccprogram.mk --- a/sbsv2/raptor/util/gccprogram.mk Sun Feb 28 23:17:56 2010 +0200 +++ b/sbsv2/raptor/util/gccprogram.mk Sun Feb 28 22:37:15 2010 +0000 @@ -62,7 +62,7 @@ $(foreach SOURCEFILE,$(SOURCES),$(c2obj)) $(BINDIR)/$(TARGET)$(PROGRAMEXT): $$(OBJECTS) - gcc $(LDFLAGS) $$^ -o $$@ + gcc $$^ $(LDFLAGS) -o $$@ $$(shell mkdir -p $(OUTPUTPATH)/$(TARGET)) diff -r 6125450a72c5 -r 99ac65572b14 sbsv2/raptor/util/talon/Makefile --- a/sbsv2/raptor/util/talon/Makefile Sun Feb 28 23:17:56 2010 +0200 +++ b/sbsv2/raptor/util/talon/Makefile Sun Feb 28 22:37:15 2010 +0000 @@ -29,6 +29,7 @@ else LDFLAGS:=$(subst \,/,$(SBS_MINGW:\=/)\lib\libiberty.a) endif +LDFLAGS:=$(LDFLAGS) -Wl,-lws2_32 else CHOMP_C:= PROCESS_C:=process.c diff -r 6125450a72c5 -r 99ac65572b14 sbsv2/raptor/util/talon/talon.c --- a/sbsv2/raptor/util/talon/talon.c Sun Feb 28 23:17:56 2010 +0200 +++ b/sbsv2/raptor/util/talon/talon.c Sun Feb 28 22:37:15 2010 +0000 @@ -16,6 +16,11 @@ */ +#ifdef HAS_WINSOCK2 +#include +#include +#define WIN32_LEAN_AND_MEAN +#endif #include @@ -48,6 +53,8 @@ #define VARNAMEMAX 100 #define VARVALMAX 1024 +#define HOSTNAME_MAX 100 + #include "log.h" @@ -56,6 +63,7 @@ unsigned int _CRT_fmode = _O_BINARY; #endif + double getseconds(void) { struct timeval tp; @@ -233,6 +241,20 @@ char *recipe = NULL; int talon_returncode = 0; +#ifdef HAS_WINSOCK2 + WSADATA wsaData; + + int wsaresult; + + wsaresult = WSAStartup(MAKEWORD(2,2), &wsaData); + + /* We ignore the result as we are only doing this to use gethostname + and if that fails then leaving the host atrtibute blank is perfectly + acceptable. + */ + +#endif + #ifdef HAS_GETCOMMANDLINE char *commandline= GetCommandLine(); /* @@ -321,6 +343,18 @@ while (isspace(*recipe)) recipe++; + + /* Make sure that the agent's hostname can be put into the host attribute */ + char hostname[HOSTNAME_MAX]; + + if (0 != gethostname(hostname, HOSTNAME_MAX-1)) + { + hostname[0] = '\0'; + } + + talon_setenv("HOSTNAME", hostname); + + /* turn debugging on? */ char *debugstr=talon_getenv("TALON_DEBUG"); diff -r 6125450a72c5 -r 99ac65572b14 sbsv2/raptor/win32/bin/talon.exe Binary file sbsv2/raptor/win32/bin/talon.exe has changed