sponsor-patch: Allow updating the build environment if the build failed.

This commit is contained in:
Benjamin Drung 2010-12-17 22:52:03 +01:00
parent 4178bf7476
commit 0852ffbda9
3 changed files with 39 additions and 22 deletions

3
debian/changelog vendored
View File

@ -8,6 +8,7 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low
[ Benjamin Drung ] [ Benjamin Drung ]
* pull-lp-source: Unquote URI to get "+" instead of "%2B" in the file name * pull-lp-source: Unquote URI to get "+" instead of "%2B" in the file name
(LP: #681114). (LP: #681114).
* sponsor-patch: Allow updating the build environment if the build failed.
[ Colin Watson ] [ Colin Watson ]
* grep-merges: New tool. * grep-merges: New tool.
@ -22,7 +23,7 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low
--buildresult is specified. --buildresult is specified.
* sponsor-patch: Support building with pbuilder-dist. * sponsor-patch: Support building with pbuilder-dist.
-- Benjamin Drung <bdrung@ubuntu.com> Thu, 16 Dec 2010 23:40:14 +0100 -- Benjamin Drung <bdrung@ubuntu.com> Fri, 17 Dec 2010 22:47:30 +0100
ubuntu-dev-tools (0.107) experimental; urgency=low ubuntu-dev-tools (0.107) experimental; urgency=low

View File

@ -59,6 +59,7 @@ setup(name='ubuntu-dev-tools',
packages=['ubuntutools', packages=['ubuntutools',
'ubuntutools/lp', 'ubuntutools/lp',
'ubuntutools/requestsync', 'ubuntutools/requestsync',
'ubuntutools/sponsor_patch',
], ],
data_files=[('share/man/man1', glob.glob("doc/*.1"))] data_files=[('share/man/man1', glob.glob("doc/*.1"))]
) )

View File

@ -90,7 +90,8 @@ def strip_epoch(version):
def ask_for_manual_fixing(): def ask_for_manual_fixing():
question = Question(["yes", "no"], False) 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() user_abort()
def get_patch_or_branch(bug): def get_patch_or_branch(bug):
@ -395,30 +396,44 @@ def main(bug_number, update, build, edit, keyid, upload, workdir, builder,
if build: if build:
dist = re.sub("-.*$", "", changelog.distributions) 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") buildresult = os.path.join(workdir, task.package + "-buildresult")
if not os.path.isdir(buildresult): if not os.path.isdir(buildresult):
os.makedirs(buildresult) os.makedirs(buildresult)
# build package successful_built = False
result = builder.build(new_dsc_file, dist, buildresult) while not successful_built:
if result != 0: if update:
Logger.error("Failed to build %s from source with %s." % \ ret = builder.update(dist)
(os.path.basename(new_dsc_file), if ret != 0:
builder.get_name())) Logger.error("Failed to update %s chroot for %s." % \
# TODO: Add "retry" and "update" option (dist, builder.get_name()))
ask_for_manual_fixing() 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 continue
# Check lintian # Check lintian