194 logging.basicConfig()
195 if len(sys.argv) != 2:
197 validate_patch.py <savannah patch id>
198 validate_patch.py file.patch
201 patch_id = sys.argv[1]
202 if os.path.isfile(patch_id):
203 patch_data = open(patch_id,
"rb").read()
206 patch_file_id = patch.files[0][1]
209 td =
TempDir(prefix = patch_id +
"-")
211 print "Sorry, problems checking out Gaudi. Try again."
213 top_dir = os.path.join(str(td),
"Gaudi")
214 open(os.path.join(top_dir, patch_id) ,
"wb").write(patch_data)
217 for l
in Popen([
"svn",
"info", top_dir], stdout = PIPE).communicate()[0].splitlines():
218 if l.startswith(
"Revision:"):
219 revision = int(l.split()[-1])
222 actions = [(
lambda path:
apply_patch(patch_data, path),
"application of the patch"),
223 (check,
"check of the configuration"),
228 for action, title
in actions:
234 print "*** Patch %s failed during %s (using revision r%d) ***" % (patch_id, failure, revision)
237 print "*** Patch %s succeeded (using revision r%d) ***" % (patch_id, revision)
def get_patch_data(file_id)
def apply_patch(patch_data, path)
def get_patch_info(patch)
def check_out_gaudi(path)