apt-config: stop returning cfg object in translate_old_apt_features
The translate_old_apt_features function mutates its parameter, but also
used to return the translated object. This goes against the rules of
idiomatic Python. Returning a new configuration object without mutating
the original one would require leaning on copy.deepcopy, which is
expensive and not always needed.
Let's stop returning the resulting configuration so the interface is
clear.
1257a38f translate old curtin apt features to new format
introduced the ability to translate old top level keys related to apt
features (e.g., debconf_selections, apt-proxy, apt-mirrors) to the new
format where they are stored as children of 'apt'.
Sadly, by doing so, it introduced a regression, making curthooks call
apt_config.handle_apt unconditionally.
The curthooks.do_apt_config function only calls apt_config.handle_apt if
the configuration does not contain the 'apt' key or if the 'apt' key has
the value None (i.e., null in YAML). When implementing the translation
from old to new configuration format, we accidentally forced the 'apt'
key to exist and coerced it to dictionary.
This effectively defeats the condition in curthooks.do_apt_config.
Fixed by making sure we only create the apt key if needed when doing the
translation.
sysfs size of extended partitions is known to provide a strange
number, and we're using a mix of sysfs and sfdisk, so primarily get
info from sfdisk and compare what we can to sysfs.