diff --git a/debian/changelog b/debian/changelog index 2023abf..75c0dc6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low [ Benjamin Drung ] * pull-lp-source: Unquote URI to get "+" instead of "%2B" in the file name (LP: #681114). + * sponsor-patch: Allow updating the build environment if the build failed. [ Colin Watson ] * grep-merges: New tool. @@ -22,7 +23,7 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low --buildresult is specified. * sponsor-patch: Support building with pbuilder-dist. - -- Benjamin Drung Thu, 16 Dec 2010 23:40:14 +0100 + -- Benjamin Drung Fri, 17 Dec 2010 22:47:30 +0100 ubuntu-dev-tools (0.107) experimental; urgency=low diff --git a/setup.py b/setup.py index e11e7c0..6bc464b 100755 --- a/setup.py +++ b/setup.py @@ -59,6 +59,7 @@ setup(name='ubuntu-dev-tools', packages=['ubuntutools', 'ubuntutools/lp', 'ubuntutools/requestsync', + 'ubuntutools/sponsor_patch', ], data_files=[('share/man/man1', glob.glob("doc/*.1"))] ) diff --git a/ubuntutools/sponsor_patch/main.py b/ubuntutools/sponsor_patch/main.py index c59c527..8e90c5a 100644 --- a/ubuntutools/sponsor_patch/main.py +++ b/ubuntutools/sponsor_patch/main.py @@ -90,7 +90,8 @@ def strip_epoch(version): def ask_for_manual_fixing(): question = Question(["yes", "no"], False) - if question.ask("Do you want to resolve this issue manually", True) == "no": + answer = question.ask("Do you want to resolve this issue manually", "yes") + if answer == "no": user_abort() def get_patch_or_branch(bug): @@ -395,30 +396,44 @@ def main(bug_number, update, build, edit, keyid, upload, workdir, builder, if build: dist = re.sub("-.*$", "", changelog.distributions) - - if update: - ret = builder.update(dist) - if ret != 0: - Logger.error("Failed to update %s chroot for %s." % \ - (dist, builder.get_name())) - ask_for_manual_fixing() - continue - # We want to update the build environment only once, but not - # after every manual fix. - update = False - buildresult = os.path.join(workdir, task.package + "-buildresult") if not os.path.isdir(buildresult): os.makedirs(buildresult) - # build package - result = builder.build(new_dsc_file, dist, buildresult) - if result != 0: - Logger.error("Failed to build %s from source with %s." % \ - (os.path.basename(new_dsc_file), - builder.get_name())) - # TODO: Add "retry" and "update" option - ask_for_manual_fixing() + successful_built = False + while not successful_built: + if update: + ret = builder.update(dist) + if ret != 0: + Logger.error("Failed to update %s chroot for %s." % \ + (dist, builder.get_name())) + ask_for_manual_fixing() + break + # We want to update the build environment only once, but not + # after every manual fix. + update = False + + # build package + result = builder.build(new_dsc_file, dist, buildresult) + if result != 0: + Logger.error("Failed to build %s from source with %s." % \ + (os.path.basename(new_dsc_file), + builder.get_name())) + question = Question(["yes", "update", "retry", "no"]) + answer = question.ask("Do you want to resolve this issue " + "manually", "yes") + if answer == "yes": + break + elif answer == "update": + update = True + continue + elif answer == "retry": + continue + else: + user_abort() + successful_built = True + if not successful_built: + # We want to do a manual fix if the build failed. continue # Check lintian