[Merge] lp:~sil2100/ubuntu-archive-tools/sru-stop-using-v-d into lp:ubuntu-archive-tools

Łukasz Zemczak lukasz.zemczak at canonical.com
Tue Jun 20 14:21:46 UTC 2017


Followed up with an inline comment. No changes are lost, all is good, explanation can be found inline.

Diff comments:

> 
> === modified file 'sru-review'
> --- sru-review	2017-04-27 20:32:35 +0000
> +++ sru-review	2017-06-19 07:51:29 +0000
> @@ -299,23 +299,27 @@
>                '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-done'):
> +        for t in ('verification-failed', 'verification-failed-%s' % release,
> +                  'verification-done', 'verification-done-%s' % release):
>              if t in btags:
> -                # this dance is needed due to
> -                # https://bugs.launchpad.net/launchpadlib/+bug/254901
>                  tags = btags
>                  tags.remove(t)
>                  bug.tags = tags
> +
> +        if 'verification-needed' not in btags:
> +            btags.append('verification-needed')
> +            bug.tags = btags
> +

It is not lost, try running the code in a python interpreter (or lp-shell). We are not creating a copy of the list there but working on references, so actually btags is the same thing as bug.tags - just a shorthand for it. For us to do a copy we'd have to do btags = list(bug.tags). Please check the following lp-shell snippet:

>>> bug = lp.bugs[1]
>>> btags = bug.tags
>>> btags is bug.tags
True

So no changes are lost as we're doing all operations on the same list. I left the btags notation since that was what was used before so why not just stick to that. To work-around the LP bug we only need to make sure the bug.tags object is 'touched'.

> +        needed_tag = 'verification-needed-%s' % release
> +        if needed_tag not in btags:
> +            btags.append(needed_tag)
> +            bug.tags = btags
> +
>          bug.lp_save()
>  
> -        if 'verification-needed' not in btags:
> -            # this dance is needed due to
> -            # https://bugs.launchpad.net/launchpadlib/+bug/254901
> -            tags = btags
> -            tags.append('verification-needed')
> -            bug.tags = tags
> -            bug.lp_save()
>  
>      text = ('Hello %s, or anyone else affected,\n\n' %
>              re.split(r'[,\s]', bug.owner.display_name)[0])


-- 
https://code.launchpad.net/~sil2100/ubuntu-archive-tools/sru-stop-using-v-d/+merge/325326
Your team Ubuntu Package Archive Administrators is requested to review the proposed merge of lp:~sil2100/ubuntu-archive-tools/sru-stop-using-v-d into lp:ubuntu-archive-tools.



More information about the ubuntu-archive mailing list