diff --git a/patches/compile_lilypond_test.py b/patches/compile_lilypond_test.py index 25069c8..d4c83d9 100755 --- a/patches/compile_lilypond_test.py +++ b/patches/compile_lilypond_test.py @@ -86,7 +86,6 @@ class AutoCompile(): else: print "Message for you in" print self.logfile.filename - def get_head(self): os.chdir(self.git_repository_dir) @@ -100,13 +99,19 @@ class AutoCompile(): self.commit) self.config.save() - ### actual building - def make_directories(self): + ### repository handling + def cleanup_directories(self): if os.path.exists(self.src_build_dir): shutil.rmtree(self.src_build_dir) + + def update_git(self): + os.chdir(self.git_repository_dir) + run("git fetch") + + def make_directories(self, branch_name): os.chdir(self.git_repository_dir) - cmd = "git checkout-index -a --prefix=%s/ " % (self.src_build_dir) - os.system(cmd) + run("git branch -f test-%s origin/master" % branch_name) + run("git clone -s -b test-%s -o local %s %s" % (branch_name, self.git_repository_dir, self.src_build_dir)) os.makedirs(self.build_dir) def runner(self, dirname, command, issue_id=None, name=None): @@ -127,8 +132,10 @@ class AutoCompile(): else: self.logfile.add_success(command) - def prep(self, issue_id=None): - self.make_directories() + def prep_for_rietveld(self, issue_id=None): + self.cleanup_directories() + self.update_git() + self.make_directories('rietveld') def configure(self, issue_id=None): self.runner(self.src_build_dir, "./autogen.sh --noconfigure", @@ -143,10 +150,11 @@ class AutoCompile(): cmd = "git apply %s %s" % (reverse, filename) returncode = os.system(cmd) if returncode != 0: - self.logfile.failed_step("patch", filename) - raise Exception("Failed patch: %s" % filename) - self.logfile.add_success("applied patch %s" % filename) + self.logfile.failed_step("patch %s" % reverse, filename) + raise Exception("Failed patch %s %s" % (reverse, filename)) + self.logfile.add_success("applied patch %s %s" % (reverse, filename)) + ### actual building def build(self, quick_make = False, issue_id=None): self.runner(self.build_dir, "nice make clean " + self.config.get("compiling", "extra_make_options"), @@ -275,7 +283,7 @@ def main(patches = None): else: autoCompile = AutoCompile() #autoCompile.debug() - autoCompile.prep() + autoCompile.prep_for_rietveld() autoCompile.configure() autoCompile.build(quick_make=True) autoCompile.regtest_baseline() @@ -285,19 +293,24 @@ def main(patches = None): title = patch[2] print "Trying %i with %s" % (issue_id, patch_filename) try: - autoCompile.configure() autoCompile.patch(patch_filename) + autoCompile.configure() autoCompile.build(quick_make=True, issue_id=issue_id) autoCompile.regtest_check(issue_id) autoCompile.copy_regtests(issue_id) autoCompile.make_regtest_show_script(issue_id, title) + except Exception as err: + print "Problem with issue %i" % issue_id + print err + try: # reverse stuff - autoCompile.patch(patch_filename, reverse=True) autoCompile.regtest_clean(issue_id) autoCompile.clean(issue_id) + autoCompile.patch(patch_filename, reverse=True) except Exception as err: - print "Problem with issue %i" % issue_id - print err + print "Problem cleaning up after issue %i" % issue_id + print "Patchy cannot reliably continue." + raise err if __name__ == "__main__":