Bug#564112: [Reportbug-maint] Bug#564112: use python-apt to look up package short descriptions
> changing utils.available_package_description() to use the try..except > with python3-apt sounds like a good idea. I take that back. We should just drop utils.available_package_description() and its tests. If we'd put the try..except into that function, we'd also need to either (i) put the apt.Cache() call there or (ii) change the function interface to pass it the cache object. However, "i" is inefficient and we lose all the speed benefits of the patch, and "ii" is incompatible.
Bug#564112: [Reportbug-maint] Bug#564112: use python-apt to look up package short descriptions
> what should we do about utils.available_package_description()? it has a few > unittests associated with it, maybe we should re-use it to wrap that > try..except and adapt the tests? changing utils.available_package_description() to use the try..except with python3-apt sounds like a good idea. There may be no need to adapt the tests.
Bug#564112: [Reportbug-maint] Bug#564112: use python-apt to look up package short descriptions
On Sun, May 13, 2018 at 8:20 AM Nis Martensenwrote: > > @@ -560,7 +563,10 @@ def get_source_package(package): > > packages += packlist > > > > for p in packages: > > -desc = available_package_description(p) > > +try: > > +desc = apt_cache[p].versions[0].summary > > +except KeyError: > > +continue > > if desc and (p not in found): > > retlist += [(p, desc)] > > found[p] = desc > > > > should we replace `continue` with `desc = available_package_description(p)` > > ? this way will prefer using apt, but if for some reason it fails, then we > > use the old method (which is still there) > `available_package_description(p)` is invoking apt-cache to get the > description. Not sure if one way can still work when the other is > broken, but we can try anyway :) oh yeah i see, so what is the reason to wrap the apt_cache access with try..except? in case you have an empty cache and accessing it via package name will get an KeyError? oh well, just when i wrote the question i realized u already catching only KeyError lol carry on :) what should we do about utils.available_package_description()? it has a few unittests associated with it, maybe we should re-use it to wrap that try..except and adapt the tests? -- Sandro "morph" Tosi My website: http://sandrotosi.me/ Me at Debian: http://wiki.debian.org/SandroTosi G+: https://plus.google.com/u/0/+SandroTosi
Bug#564112: [Reportbug-maint] Bug#564112: use python-apt to look up package short descriptions
> @@ -560,7 +563,10 @@ def get_source_package(package): > packages += packlist > > for p in packages: > -desc = available_package_description(p) > +try: > +desc = apt_cache[p].versions[0].summary > +except KeyError: > +continue > if desc and (p not in found): > retlist += [(p, desc)] > found[p] = desc > > should we replace `continue` with `desc = available_package_description(p)` > ? this way will prefer using apt, but if for some reason it fails, then we > use the old method (which is still there) `available_package_description(p)` is invoking apt-cache to get the description. Not sure if one way can still work when the other is broken, but we can try anyway :)
Bug#564112: [Reportbug-maint] Bug#564112: use python-apt to look up package short descriptions
Hey Nis! was having a look at this patch and @@ -560,7 +563,10 @@ def get_source_package(package): packages += packlist for p in packages: -desc = available_package_description(p) +try: +desc = apt_cache[p].versions[0].summary +except KeyError: +continue if desc and (p not in found): retlist += [(p, desc)] found[p] = desc should we replace `continue` with `desc = available_package_description(p)` ? this way will prefer using apt, but if for some reason it fails, then we use the old method (which is still there) what do you think? On Mon, Dec 4, 2017 at 8:21 AM Nis Martensenwrote: > control: tags -1 patch > This also fixes #876373 > Other related bugs: #502860, #599290, #882130 > ___ > Reportbug-maint mailing list > reportbug-ma...@lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reportbug-maint -- Sandro "morph" Tosi My website: http://sandrotosi.me/ Me at Debian: http://wiki.debian.org/SandroTosi G+: https://plus.google.com/u/0/+SandroTosi