Store mass rebuild details in massrebuildsinfo.py #7517

Merged
jnsamyak merged 3 commits from massrebuildsinfo into master 2026-06-08 03:12:08 +00:00

View file

@ -35,10 +35,11 @@ DEFAULT_COMMENT = \
"""{component} failed to build from source in {product} {version}
https://koji.fedoraproject.org/koji/taskinfo?taskID={task_id}
{extrainfo}
For details on the mass rebuild see:
{wikipage}
{wikipage}
Please fix {component} at your earliest convenience and set the bug's status to
ASSIGNED when you start fixing it. If the bug remains in NEW state for 8 weeks,
{component} will be orphaned. Before branching of {product} {nextversion},
@ -50,7 +51,7 @@ https://fedoraproject.org/wiki/Fails_to_build_from_source
def report_failure(massrebuild, component, task_id, logs,
summary="{component}: FTBFS in {product} {version}",
comment=DEFAULT_COMMENT):
comment=DEFAULT_COMMENT, extrainfo=""):
"""This function files a new bugzilla bug for component with given
arguments
@ -68,6 +69,7 @@ def report_failure(massrebuild, component, task_id, logs,
format_values["task_id"] = task_id
format_values["component"] = component
format_values["nextversion"] = str(int(massrebuild["version"]) + 1)
format_values["extrainfo"] = extrainfo
summary = summary.format(**format_values)
comment = comment.format(**format_values)
@ -110,12 +112,33 @@ def attach_logs(bug, logs):
name = log.rsplit('/', 1)[-1]
response = urllib2.urlopen(log)
fp = tempfile.TemporaryFile()
fp.write(response.read())
fp.seek(0)
CHUNK = 2 ** 20
while True:
chunk = response.read(CHUNK)
if not chunk:
break
fp.write(chunk)
filesize = fp.tell()
# Bugzilla file limit, still possibly too much
# FILELIMIT = 20000 * 1024
# Just use 1 MiB:
FILELIMIT = 2 ** 10
if filesize > FILELIMIT:
fp.seek(filesize - FILELIMIT)
comment = "file {} too big, will only attach last {} bytes".format(
name, FILELIMIT)
else:
comment = ""
fp.seek(0)
try:
print('Attaching file %s to the ticket' % name)
# arguments are: idlist, attachfile, description, ...
attid = BZCLIENT.attachfile(
bug.id, fp, name, content_type='text/plain')
bug.id, fp, name, content_type='text/plain', file_name=name,
comment=comment
)
except Fault as ex:
print(ex)
raise