Skip to content

Commit

Permalink
Merge branch 'bug954'
Browse files Browse the repository at this point in the history
* bug954:
  Put the patch in an on-disk file
  • Loading branch information
Dustin J. Mitchell committed Aug 9, 2010
2 parents 53dc527 + 17b3fb9 commit eacdce7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions slave/buildslave/commands/base.py
Expand Up @@ -508,13 +508,15 @@ def doPatch(self, res):
'--remove-empty-files',
'--force',
'--forward',
'-i', '.buildbot-diff',
]
dir = os.path.join(self.builder.basedir, self.workdir)
# Mark the directory so we don't try to update it later, or at least try
# to revert first.
marker = open(os.path.join(dir, ".buildbot-patched"), "w")
marker.write("patched\n")
marker.close()
open(os.path.join(dir, ".buildbot-patched"), "w").write("patched\n")

# write the diff to a file, for reading later
open(os.path.join(dir, ".buildbot-diff"), "w").write(diff)

# Update 'dir' with the 'root' option. Make sure it is a subdirectory
# of dir.
Expand All @@ -526,9 +528,19 @@ def doPatch(self, res):
# now apply the patch
c = runprocess.RunProcess(self.builder, command, dir,
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, initialStdin=diff, usePTY=False)
maxTime=self.maxTime, usePTY=False)
self.command = c
d = c.start()

# clean up the temp file
def cleanup(x):
try:
os.unlink(os.path.join(dir, ".buildbot-diff"))
except:
pass
return x
d.addBoth(cleanup)

d.addCallback(self._abandonOnFailure)
return d

0 comments on commit eacdce7

Please sign in to comment.