diff --git a/tools/buildbot/bootstrap.pl b/tools/buildbot/bootstrap.pl index df7e995e..71ed1a65 100755 --- a/tools/buildbot/bootstrap.pl +++ b/tools/buildbot/bootstrap.pl @@ -45,6 +45,7 @@ if ($^O eq "linux") else { print CONF "BuilderPath = " . $ENV{'MSVC8'} . "\n"; + print CONF "PDBLog = $root\\OUTPUT\\pdblog.txt\n"; } close(CONF); diff --git a/tools/buildbot/helpers.pm b/tools/buildbot/helpers.pm index c1b5de72..37bf32c5 100644 --- a/tools/buildbot/helpers.pm +++ b/tools/buildbot/helpers.pm @@ -8,14 +8,12 @@ package Build; our $SVN = "/usr/bin/svn"; our $SVN_USER = 'dvander'; our $SVN_ARGS = ''; -our $SVN_VERSION = "/usr/bin/svnversion"; sub Revision { my ($str)=(@_); - my $dir = $SVN_VERSION; - - my $data = Command($dir . ' -c ' . $str); + + my $data = Command('svnversion -c ' . $str); if ($data =~ /(\d+):(\d+)/) { return $2; @@ -26,6 +24,17 @@ sub Revision } } +sub ProductVersion +{ + my ($file) = (@_); + my ($version); + open(FILE, $file) or die "Could not open $file: $!\n"; + $version = ; + close(FILE); + chomp $version; + return $version; +} + sub Delete { my ($str)=(@_); @@ -114,3 +123,4 @@ sub SVN_Add chdir($dir); } +return 1; \ No newline at end of file diff --git a/tools/buildbot/package.pl b/tools/buildbot/package.pl index 99e33b68..9d09f90c 100755 --- a/tools/buildbot/package.pl +++ b/tools/buildbot/package.pl @@ -31,8 +31,7 @@ chdir(Build::PathFormat('../../OUTPUT/base')); my ($version); -$version = `cat ../../product.version`; -chomp $version; +$version = Build::ProductVersion(Build::PathFormat('../../product.version')); $version .= '.' . Build::Revision('../..'); my ($filename); diff --git a/tools/buildbot/symstore.pl b/tools/buildbot/symstore.pl new file mode 100755 index 00000000..db2639b4 --- /dev/null +++ b/tools/buildbot/symstore.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl + +use File::Basename; + +my ($myself, $path) = fileparse($0); +chdir($path); + +require 'helpers.pm'; + +chdir('..'); +chdir('..'); + +our $SSH = 'ssh -i ../../smpvkey'; + +open(PDBLOG, 'OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n"; + +#Sync us up with the main symbol store +rsync('sourcemod@alliedmods.net:~/public_html/symbols/', '..\\..\\symstore'); + +#Get version info +my ($version); +$version = Build::ProductVersion(Build::PathFormat('product.version')); +$version .= '.' . Build::Revision('.'); + +my ($line); +while () +{ + $line = $_; + $line =~ s/\.pdb/\*/; + chomp $line; + Build::Command("symstore add /r /f \"$line\" /s ..\\..\\symstore /t \"SourceMod\" /v \"$version\" /c \"buildbot\""); +} + +close(PDBLOG); + +#Now that we're done, rsync back. +rsync('..\\..\\symstore\\', 'sourcemod@alliedmods.net:~/public_html/symbols'); + +sub rsync +{ + my ($from, $to) = (@_); + + Build::Command('rsync -av --delete -e="' . $SSH . '" ' . $from . ' ' . $to); +} diff --git a/tools/fetchdlls/fetchdlls.sln b/tools/fetchdlls/fetchdlls.sln deleted file mode 100644 index e2f7107b..00000000 --- a/tools/fetchdlls/fetchdlls.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fetchdlls", "fetchdlls.vcproj", "{3C1C562B-1080-445F-A632-EA9EC9793389}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3C1C562B-1080-445F-A632-EA9EC9793389}.Debug|Win32.ActiveCfg = Debug|Win32 - {3C1C562B-1080-445F-A632-EA9EC9793389}.Debug|Win32.Build.0 = Debug|Win32 - {3C1C562B-1080-445F-A632-EA9EC9793389}.Release|Win32.ActiveCfg = Release|Win32 - {3C1C562B-1080-445F-A632-EA9EC9793389}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tools/fetchdlls/fetchdlls.vcproj b/tools/fetchdlls/fetchdlls.vcproj deleted file mode 100644 index d230be74..00000000 --- a/tools/fetchdlls/fetchdlls.vcproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/fetchdlls/main.cpp b/tools/fetchdlls/main.cpp deleted file mode 100644 index 5c52e6bf..00000000 --- a/tools/fetchdlls/main.cpp +++ /dev/null @@ -1,192 +0,0 @@ -#include -#include -#include - -void mdmp_string(void *mdmp, RVA addr, char *buffer, size_t maxlength) -{ - int len; - MINIDUMP_STRING *str; - - str = (MINIDUMP_STRING *)((char *)mdmp + addr); - len = WideCharToMultiByte(CP_UTF8, - 0, - str->Buffer, - str->Length / sizeof(WCHAR), - buffer, - maxlength, - NULL, - NULL); - buffer[len] = '\0'; -} - -int find_revision(const char *version, MINIDUMP_MODULE *module, const char *name) -{ - FILE *fp; - char msg[255]; - size_t i, len; - char path[255]; - char buffer[3000]; - int last_revision; - - len = _snprintf(path, sizeof(path), "%s", name); - for (i = 0; i < len; i++) - { - if (path[i] == '\\') - { - path[i] = '/'; - } - } - - DeleteFile("_svnlog.txt"); - _snprintf(buffer, - sizeof(buffer), - "svn log svn://svn.alliedmods.net/svnroot/Packages/sourcemod/sourcemod-%d.%d/windows/base/addons/sourcemod/%s > _svnlog.txt", - (module->VersionInfo.dwFileVersionMS >> 16), - (module->VersionInfo.dwFileVersionMS & 0xFFFF), - path); - system(buffer); - - if ((fp = fopen("_svnlog.txt", "rt")) == NULL) - { - return -1; - } - - _snprintf(msg, - sizeof(msg), - "sourcemod-%s", - version); - - while (fgets(buffer, sizeof(buffer), fp) != NULL) - { - if (buffer[0] == 'r') - { - last_revision = atoi(&buffer[1]); - } - else if (strstr(buffer, msg) != NULL) - { - fclose(fp); - - _snprintf(buffer, - sizeof(buffer), - "svn export -q -r %d svn://svn.alliedmods.net/svnroot/Packages/sourcemod/sourcemod-%d.%d/windows/base/addons/sourcemod/%s", - last_revision, - (module->VersionInfo.dwFileVersionMS >> 16), - (module->VersionInfo.dwFileVersionMS & 0xFFFF), - path); - system(buffer); - - return last_revision; - } - } - - fclose(fp); - - return -1; -} - -int main(int argc, char **argv) -{ - int rev; - ULONG32 m; - LPVOID mdmp; - HANDLE hFile; - const char *name; - ULONG stream_size; - char name_buf[255]; - HANDLE hFileMapping; - MINIDUMP_MODULE *module; - MINIDUMP_DIRECTORY *dir; - MINIDUMP_MODULE_LIST *modules; - - if (argc < 3) - { - fprintf(stderr, "Usage: \n"); - exit(-1); - } - - if ((hFile = CreateFile(argv[2], - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL)) - == INVALID_HANDLE_VALUE) - { - fprintf(stderr, "Could not open file (error %d)\n", GetLastError()); - exit(-1); - } - - hFileMapping = CreateFileMapping( - hFile, - NULL, - PAGE_READONLY, - 0, - 0, - NULL); - if (hFileMapping == NULL) - { - fprintf(stderr, "Could not open file mapping (error %d)\n", GetLastError()); - CloseHandle(hFile); - exit(-1); - } - - mdmp = MapViewOfFile(hFileMapping, - FILE_MAP_READ, - 0, - 0, - 0); - if (mdmp == NULL) - { - fprintf(stderr, "Could not create map view (error %d)\n", GetLastError()); - CloseHandle(hFileMapping); - CloseHandle(hFile); - exit(-1); - } - - if (!MiniDumpReadDumpStream(mdmp, - ModuleListStream, - &dir, - (void **)&modules, - &stream_size)) - { - fprintf(stderr, "Could not read the module list stream.\n"); - UnmapViewOfFile(mdmp); - CloseHandle(hFileMapping); - CloseHandle(hFile); - } - - for (m = 0; m < modules->NumberOfModules; m++) - { - module = &modules->Modules[m]; - - mdmp_string(mdmp, module->ModuleNameRva, name_buf, sizeof(name_buf)); - - if ((name = strstr(name_buf, "sourcemod\\")) != NULL) - { - name += 10; - fprintf(stdout, - "looking for: %s (%d.%d.%d.%d of build %s)... ", - name, - (module->VersionInfo.dwFileVersionMS >> 16), - (module->VersionInfo.dwFileVersionMS & 0xFFFF), - (module->VersionInfo.dwFileVersionLS >> 16), - (module->VersionInfo.dwFileVersionLS & 0xFFFF), - argv[1] - ); - fflush(stdout); - if ((rev = find_revision(argv[1], module, name)) == -1) - { - fprintf(stdout, "not found :(\n"); - continue; - } - fprintf(stdout, "downloaded! (pkgrev %d)\n", rev); - } - } - - UnmapViewOfFile(mdmp); - CloseHandle(hFileMapping); - CloseHandle(hFile); - - return 0; -}