From 4e0c9e93de662386719d41727c555911dfaf7902 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Sun, 11 Jan 2015 18:25:48 -0500 Subject: [PATCH] Activating git-db again; a few adjustments needed in the code because of that --- lib/gdbgitdb.py | 27 +++++++++++++++++++++------ lib/sumfiles.py | 6 ++++-- master.cfg | 24 +++++++++--------------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/lib/gdbgitdb.py b/lib/gdbgitdb.py index 50e8b04..ca21e74 100644 --- a/lib/gdbgitdb.py +++ b/lib/gdbgitdb.py @@ -20,17 +20,32 @@ class SaveGDBResults (ShellCommand): builder = self.getProperty ('buildername') istry = self.getProperty ('isTryBuilder') branch = self.getProperty ('branch') - repodir = os.path.join (get_web_base (), builder) + repodir = get_web_base () + builder_dir = os.path.join (repodir, builder) + full_tag = "%s-%s" % (builder, rev) + if branch is None: branch = 'master' if istry and istry == 'yes': # Do nothing return SUCCESS + repo = git.Repo.init (path = repodir) - if rev not in repo.tags: - if not repo.branches or repo.is_dirty (): - repo.index.add (['gdb.sum', 'gdb.log', '%s/baseline' % branch]) - repo.index.commit ('Log files for %s' % rev) + if not os.path.exists (builder_dir): + os.mkdir (builder_dir) + + if builder not in repo.heads: + myhead = repo.create_head (builder) + else: + myhead = repo.heads[builder] + + myhead.checkout () + if full_tag not in repo.tags: + if repo.is_dirty (): + repo.index.add (['%s/gdb.sum' % builder, + '%s/gdb.log' % builder, + '%s/%s/baseline' % (builder, branch)]) + repo.index.commit ('Log files for %s' % full_tag) repo.index.write () - repo.create_tag (rev) + repo.create_tag (full_tag) return SUCCESS diff --git a/lib/sumfiles.py b/lib/sumfiles.py index 3cc71de..d4a06f5 100644 --- a/lib/sumfiles.py +++ b/lib/sumfiles.py @@ -63,7 +63,8 @@ class DejaResults(object): f.close() def write_sum_file(self, sum_dict, builder, revision): - self._write_sum_file(sum_dict, builder, revision, 'gdb.sum') + self._write_sum_file (sum_dict, builder, None, 'gdb.sum') +# self._write_sum_file(sum_dict, builder, revision, 'gdb.sum') def write_baseline(self, sum_dict, builder, branch): self._write_sum_file(sum_dict, os.path.join(builder, branch), @@ -92,7 +93,8 @@ class DejaResults(object): return result def read_sum_file (self, builder, revision): - return self._read_sum_file (builder, revision, 'gdb.sum') + return self._read_sum_file (builder, None, 'gdb.sum') +# return self._read_sum_file (builder, revision, 'gdb.sum') def read_baseline(self, builder, branch): return self._read_sum_file(os.path.join(builder, branch), diff --git a/master.cfg b/master.cfg index 7c45400..a8fd3c4 100644 --- a/master.cfg +++ b/master.cfg @@ -49,8 +49,9 @@ c = BuildmasterConfig = {} # Base directory for the web server. This is needed in order to # compare the test results. -gdb_web_base = os.path.expanduser(os.path.join(basedir, 'public_html', - 'results')) +gdb_web_base = os.path.expanduser (os.path.join (basedir, + 'public_html', + 'results')) set_web_base (gdb_web_base) # 'protocols' contains information about protocols which master will use for @@ -210,14 +211,6 @@ c['db'] = { ## the documentation on each build step class to understand what it ## does. -class DeleteGDBBuildDir (ShellCommand): - """This build step is responsible for removing the build directory -from previous builds. It uses the 'builddir' property in order to -figure out which directory to remove.""" - description = r"deleting previous GDB build directory" - descriptionDone = r"deleted previous GDB build directory" - command = ['rm', '-rf', WithProperties (r"%s/build", r'builddir')] - class RandomWaitForClone (ShellCommand): """This build step is responsible for waiting a random number of seconds before trying to update the local git repository. This is a @@ -409,7 +402,6 @@ The parameters of the class are: r'builddir'), description = r"removing old build dir", descriptionDone = r"removed old build dir")) -# self.addStep (DeleteGDBBuildDir ()) # Unfortunately we need to have this random wait, otherwise # git fetch won't work self.addStep (RandomWaitForClone ()) @@ -444,10 +436,12 @@ The parameters of the class are: description = r'analyze test results')) self.addStep (FileUpload (slavesrc = WithProperties (r"%s/build/gdb/testsuite/gdb.log", r'builddir'), - masterdest = WithProperties (r"public_html/results/%s/%s/gdb.log", - r'buildername', - r'got_revision'))) -# self.addStep (SaveGDBResults ()) + masterdest = WithProperties (r"publibc_html/results/%s/gdb.log", + r'buildername')) +# masterdest = WithProperties (r"public_html/results/%s/%s/gdb.log", +# r'buildername', +# r'got_revision'))) + self.addStep (SaveGDBResults ()) ##################