195 logging.basicConfig()
196 if len(sys.argv) != 2:
198 validate_patch.py <savannah patch id>
199 validate_patch.py file.patch
202 patch_id = sys.argv[1]
203 if os.path.isfile(patch_id):
204 patch_data = open(patch_id,
"rb").read()
207 patch_file_id = patch.files[0][1]
210 td =
TempDir(prefix = patch_id +
"-")
212 print "Sorry, problems checking out Gaudi. Try again."
214 top_dir = os.path.join(str(td),
"Gaudi")
215 open(os.path.join(top_dir, patch_id) ,
"wb").write(patch_data)
218 for l
in Popen([
"svn",
"info", top_dir], stdout = PIPE).communicate()[0].splitlines():
219 if l.startswith(
"Revision:"):
220 revision = int(l.split()[-1])
223 actions = [(
lambda path:
apply_patch(patch_data, path),
"application of the patch"),
224 (check,
"check of the configuration"),
229 for action, title
in actions:
235 print "*** Patch %s failed during %s (using revision r%d) ***" % (patch_id, failure, revision)
238 print "*** Patch %s succeeded (using revision r%d) ***" % (patch_id, revision)