bug 428518 - source server, final round. patch by Lukas Blakk <lukasblakk@gmail.com>. r=me, a=beltzner
authorted.mielczarek@gmail.com
Tue, 15 Apr 2008 03:31:41 -0700
changeset 14336 bd2afa077f6ed999915d6af5321df938ac9c00c7
parent 14335 38f1f4832d5cd6cf884a69c07f2ee380b8f101a7
child 14337 0ef673e00fa33439c04f78625e5d55d4fd119c63
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme, beltzner
bugs428518
milestone1.9pre
bug 428518 - source server, final round. patch by Lukas Blakk <lukasblakk@gmail.com>. r=me, a=beltzner
toolkit/crashreporter/tools/symbolstore.py
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -309,19 +309,19 @@ def GetPlatformSpecificDumper(**kwargs):
             'darwin': Dumper_Mac}[sys.platform](**kwargs)
 
 def SourceIndex(fileStream, outputPath, cvs_root):
     """Takes a list of files, writes info to a data block in a .stream file"""
     # Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing
     # Create the srcsrv data block that indexes the pdb file
     result = True
     pdbStreamFile = open(outputPath, "w")
-    pdbStreamFile.write('''SRCSRV: ini ------------------------------------------------\r\nVERSION=1\r\nSRCSRV: variables ------------------------------------------\r\nCVS_EXTRACT_CMD=%fnchdir%(%CVS_WORKINGDIR%)cvs.exe -d %fnvar%(%var2%) checkout -r %var4% %var3%\r\nCVS_EXTRACT_TARGET=%targ%\%var2%\%fnbksl%(%var3%)\%fnfile%(%var1%)\r\nCVS_WORKING_DIR=%targ%\r\nMYSERVER=''')
+    pdbStreamFile.write('''SRCSRV: ini ------------------------------------------------\r\nVERSION=1\r\nSRCSRV: variables ------------------------------------------\r\nCVS_EXTRACT_CMD=%fnchdir%(%targ%)cvs.exe -d %fnvar%(%var2%) checkout -r %var4% -d %var4% -N %var3%\r\nMYSERVER=''')
     pdbStreamFile.write(cvs_root)
-    pdbStreamFile.write('''\r\nSRCSRVTRG=%targ%\%fnbksl%(%var3%)\r\nSRCSRVCMD=%CVS_EXTRACT_CMD%\r\nSRCSRV: source files ---------------------------------------\r\n''')
+    pdbStreamFile.write('''\r\nSRCSRVTRG=%targ%\%var4%\%fnbksl%(%var3%)\r\nSRCSRVCMD=%CVS_EXTRACT_CMD%\r\nSRCSRV: source files ---------------------------------------\r\n''')
     pdbStreamFile.write(fileStream) # can't do string interpolation because the source server also uses this and so there are % in the above
     pdbStreamFile.write("SRCSRV: end ------------------------------------------------\r\n\n")
     pdbStreamFile.close()
     return result
 
 class Dumper:
     """This class can dump symbols from a file with debug info, and
     store the output in a directory structure that is valid for use as
@@ -401,17 +401,19 @@ class Dumper:
                         result = False
         return result
 
     def ProcessFile(self, file):
         """Dump symbols from this file into a symbol file, stored
         in the proper directory structure in  |symbol_path|."""
         result = False
         sourceFileStream = ''
-        cvs_root = ''
+        # tries to get cvsroot from the .mozconfig first - if it's not set
+        # the tinderbox cvs_path will be assigned further down
+        cvs_root = os.environ.get("SRCSRV_ROOT")
         for arch in self.archs:
             try:
                 cmd = os.popen("%s %s %s" % (self.dump_syms, arch, file), "r")
                 module_line = cmd.next()
                 if module_line.startswith("MODULE"):
                     # MODULE os cpu guid debug_file
                     (guid, debug_file) = (module_line.split())[3:5]
                     # strip off .pdb extensions, and append .sym
@@ -438,18 +440,19 @@ class Dumper:
                                 if start == -1:
                                     start = 0
                                 filename = filename[start:]
                             filename = self.FixFilenameCase(filename.rstrip())
                             sourcepath = filename
                             if self.vcsinfo:
                                 (filename, rootname) = GetVCSFilename(filename, self.srcdir)
                                 # sets cvs_root in case the loop through files were to end on an empty rootname
-                                if rootname:
-                                   cvs_root = rootname
+                                if cvs_root is None:
+                                  if rootname:
+                                     cvs_root = rootname
                             # gather up files with cvs for indexing   
                             if filename.startswith("cvs"):
                                 (ver, checkout, source_file, revision) = filename.split(":", 3)
                                 sourceFileStream += sourcepath + "*MYSERVER*" + source_file + '*' + revision + "\r\n"
                             f.write("FILE %s %s\n" % (index, filename))
                         else:
                             # pass through all other lines unchanged
                             f.write(line)