B1;2802;0cOn Thu, Sep 29, 2011 at 07:33:33PM +0100, Iain Nicol wrote:
> Hi Michael,
Hi Iain,
> > Thanks for testing [the unattended-upgrade change]! Indeed, when it
> > re-evals the state it needs to update the pkgs_to_upgrade list as
> > well. This is fixed in bzr now as well!
>
> Thanks, but if you'll let me drag this bug out a little longer :-)...
>
> There's a problem with the latest change: pkgs_to_upgrade was previously
> a list of packages, not a list of pkgnames; if it contains a pkgname, an
> exception is thrown when the string pkgs is built from it. There's a
> trivial patch at the end of this email to fix this.
Thanks a bunch! Shows me once more that I should only write code that
has a proper test-case :) I commited it to bzr and it will be part of
the next upload, changelog:
[ Iain Nicol ]
* unattended-upgrade:
- ensure pkgs_to_upgrade stays sorted and fix crash
Let me know if that is accurate enough.
> The other thing this patch does is fix a tiny regression: previously,
> pkgs_to_upgrade was automatically sorted alphabetically, because the
> cache iterator happens to iterates alphabetically. But because of the
> new logic we now need something explicit. (And the explicit sort key
> seems necessary.)
A alternative would be to write:
- pkgs = "\n".join([pkg.name for pkg in pkgs_to_upgrade])
+ pkgs = "\n".join(sorted([pkg.name for pkg in pkgs_to_upgrade]))
But your patch is fine of course as well. apt.Package does not have a
__cmp__ function so the key is indeed needed, I added a __cmp__
function to my python-apt branch now (with a test ;) so in the future
a list of package will sort by name.
Thanks again!
Michael
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]