[Merge] ~xnox/ubuntu-dev-tools:fix-pull-pkg into ubuntu-dev-tools:master

Dimitri John Ledkov dimitri.ledkov+lp at canonical.com
Tue Jan 19 10:45:42 UTC 2021


On Tue, Jan 19, 2021 at 12:11 AM Mattia Rizzolo <mattia at mapreri.org> wrote:
>
>
>
> Diff comments:
>
> > diff --git a/ubuntutools/pullpkg.py b/ubuntutools/pullpkg.py
> > index 5e2a22b..e2411bc 100644
> > --- a/ubuntutools/pullpkg.py
> > +++ b/ubuntutools/pullpkg.py
> > @@ -344,14 +344,14 @@ class PullPkg(object):
> >
> >          mirrors = []
> >          if options['mirror']:
> > -            mirrors.append(options['mirror'])
> > +            mirrors.extend(options['mirror'])
> >          if pull == PULL_DDEBS:
> >              config = UDTConfig(options['no_conf'])
> >              ddebs_mirror = config.get_value(distro.upper() + '_DDEBS_MIRROR')
> >              if ddebs_mirror:
> >                  mirrors.append(ddebs_mirror)
> >          if mirrors:
> > -            Logger.debug("using mirrors %s", ", ".join(mirrors))
> > +            Logger.debug("using mirrors %s" % ", ".join(mirrors))
>
> why this hunk?
>
> the comma should work perfectly there, doesn't it?  it actually makes the string interpolation be deferred to the logging module, so that it happens only if the message will be handled, else it won't happen at all.
> I agree that it's a trivial matter, but if there are no reasons to change it… :)

So for me --mirror option was bombing out because it was a list of
lists, and hence logger was getting a traceback. After fixing that,
nothing worked still, until a reliased it's a nested list in error,
but never went back to backout debug statement.

And I did not know that logging module has string interpolation like
that! I am pretty sure I have written code that subs things with % and
.format() before passing it to Logger methods in other projects.

I'll hate to go back and study that in python documentation.

I agree I should back this chunk out.


>
> >              params['mirrors'] = mirrors
> >
> >          params['verify_signature'] = not options['no_verify_signature']
>
>
> --
> https://code.launchpad.net/~xnox/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/396459
> You are the owner of ~xnox/ubuntu-dev-tools:fix-pull-pkg.



-- 
Regards,

Dimitri.

https://code.launchpad.net/~xnox/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/396459
Your team Ubuntu Development Team is subscribed to branch ubuntu-dev-tools:master.



More information about the Ubuntu-reviews mailing list