[Merge] lp:~sil2100/ubuntu-archive-tools/common-sru-process-bug into lp:ubuntu-archive-tools

Brian Murray brian at ubuntu.com
Wed Dec 6 18:59:55 UTC 2017


Review: Approve

This looks good to me thanks for working on it - I think a docstring in sru_workflow.py would be good though.  Additionally, a change of mine was recently merged to ubuntu-archive-tools which changed the content of the comment added to bug reports requesting feed back (lines 121-132) so please be sure not to loose that.

Thanks!

Diff comments:

> 
> === added file 'sru_workflow.py'
> --- sru_workflow.py	1970-01-01 00:00:00 +0000
> +++ sru_workflow.py	2017-11-20 16:36:43 +0000
> @@ -0,0 +1,133 @@
> +#!/usr/bin/python3
> +
> +# Copyright (C) 2017  Canonical Ltd.
> +# Author: Brian Murray <brian.murray at canonical.com>
> +# Author: Lukasz 'sil2100' Zemczak <lukasz.zemczak at canonical.com>
> +
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 3 of the License.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +
> +import re
> +
> +
> +def process_bug(launchpad, sourcepkg, version, release, num):

I think adding a doc string here would be helpful.

> +    bug_target_re = re.compile(
> +        r'/ubuntu/(?:(?P<suite>[^/]+)/)?\+source/(?P<source>[^/]+)$')
> +    bug = launchpad.bugs[num]
> +    sourcepkg_match = False
> +    distroseries_match = False
> +    for task in bug.bug_tasks:
> +        # Ugly; we have to do URL-parsing to figure this out.
> +        # /ubuntu/+source/foo can be fed to launchpad.load() to get a
> +        # distribution_source_package, but /ubuntu/hardy/+source/foo can't.
> +        match = bug_target_re.search(task.target.self_link)
> +        if (not match or
> +            (sourcepkg and
> +             match.group('source') != sourcepkg)):
> +            print("Ignoring task %s in bug %s" % (task.web_link, num))
> +            continue
> +        sourcepkg_match = True
> +        if (match.group('suite') == release and
> +            task.status not in ("Invalid", "Won't Fix",
> +                                "Fix Released")):
> +            task.status = "Fix Committed"
> +            task.lp_save()
> +            print("Success: task %s in bug %s" % (task.web_link, num))
> +            distroseries_match = True
> +
> +    if sourcepkg_match and not distroseries_match:
> +        # add a release task
> +        lp_url = launchpad._root_uri
> +        series_task_url = '%subuntu/%s/+source/%s' % \
> +                          (lp_url, release, sourcepkg)
> +        sourcepkg_target = launchpad.load(series_task_url)
> +        new_task = bug.addTask(target=sourcepkg_target)
> +        new_task.status = "Fix Committed"
> +        new_task.lp_save()
> +        print("LP: #%s added task for %s %s" % (num, sourcepkg, release))
> +    if not sourcepkg_match:
> +        # warn that the bug has no source package tasks
> +        print("LP: #%s has no %s tasks!" % (num, sourcepkg))
> +
> +    # XXX: it might be useful if the package signer/sponsor was
> +    #   subscribed to the bug report
> +    bug.subscribe(person=launchpad.people['ubuntu-sru'])
> +    bug.subscribe(person=launchpad.people['sru-verification'])
> +
> +    # there may be something else to sponsor so just warn
> +    subscribers = [sub.person for sub in bug.subscriptions]
> +    if launchpad.people['ubuntu-sponsors'] in subscribers:
> +        print('ubuntu-sponsors is still subscribed to LP: #%s. '
> +              'Is there anything left to sponsor?' % num)
> +
> +    if not sourcepkg or 'linux' not in sourcepkg:
> +        # this dance is needed due to
> +        # https://bugs.launchpad.net/launchpadlib/+bug/254901
> +        btags = bug.tags
> +        for t in ('verification-failed', 'verification-failed-%s' % release,
> +                  'verification-done', 'verification-done-%s' % release):
> +            if t in btags:
> +                tags = btags
> +                tags.remove(t)
> +                bug.tags = tags
> +
> +        if 'verification-needed' not in btags:
> +            btags.append('verification-needed')
> +            bug.tags = btags
> +
> +        needed_tag = 'verification-needed-%s' % release
> +        if needed_tag not in btags:
> +            btags.append(needed_tag)
> +            bug.tags = btags
> +
> +        bug.lp_save()
> +
> +    text = ('Hello %s, or anyone else affected,\n\n' %
> +            re.split(r'[,\s]', bug.owner.display_name)[0])
> +
> +    if sourcepkg:
> +        text += 'Accepted %s into ' % sourcepkg
> +    else:
> +        text += 'Accepted into '
> +    if sourcepkg and release:
> +        text += ('%s-proposed. The package will build now and be available at '
> +                 'https://launchpad.net/ubuntu/+source/%s/%s in a few hours, '
> +                 'and then in the -proposed repository.\n\n' % (
> +                     release, sourcepkg, version))
> +    else:
> +        text += ('%s-proposed. The package will build now and be available in '
> +                 'a few hours in the -proposed repository.\n\n' % (
> +                     release))
> +
> +    text += ('Please help us by testing this new package.  ')
> +
> +    if sourcepkg == 'casper':
> +        text += ('To properly test it you will need to obtain and boot '
> +                 'a daily build of a Live CD for %s.' % (release))
> +    else:
> +        text += ('See https://wiki.ubuntu.com/Testing/EnableProposed for '
> +                 'documentation on how to enable and use -proposed.')
> +
> +    text += ('Your feedback will aid us getting this update out to other '
> +             'Ubuntu users.\n\nIf this package fixes the bug for you, '
> +             'please add a comment to this bug, mentioning the version of the '
> +             'package you tested and change the tag from '
> +             'verification-needed-%s to verification-done-%s. '
> +             'If it does not fix the bug for you, please add a comment '
> +             'stating that, and change the tag to verification-failed-%s. In '
> +             'either case, details of your testing will help us make a better '
> +             'decision.\n\nFurther information regarding the verification '
> +             'process can be found at '
> +             'https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  '
> +             'Thank you in advance!' % (release, release, release))
> +    bug.newMessage(content=text, subject='Please test proposed package')


-- 
https://code.launchpad.net/~sil2100/ubuntu-archive-tools/common-sru-process-bug/+merge/333980
Your team Ubuntu Package Archive Administrators is requested to review the proposed merge of lp:~sil2100/ubuntu-archive-tools/common-sru-process-bug into lp:ubuntu-archive-tools.



More information about the ubuntu-archive mailing list