* pkgng: join package list into one command
Change the pkgng module so all packages being
installed (or upgraded) are acted on in one
command (per action). This will make installs
and upgrades a bit faster, because pkg will be
invoked fewer times per module run. More important,
module actions will be more atomic, making it less
likely that some packages are acted on because they
appear earlier in the argument list.
This change also improves the status reporting of
packages acted on, specifying the number of packages
for each action (install or upgrade).
* pkgng: make upgrade check lazily evaluated
Make upgrade_available an inner function so that the
if statement that checks whether installed packages
are up-to-date only runs the upgrade check on packages
that are already installed. This gets lazily evaluated
because of boolean operator short-circuiting:
https://docs.python.org/3.8/library/stdtypes.html#boolean-operations-and-or-not
Previously, the module would always check for upgrades,
even for not-installed packages, when running with
`state=latest`.
* pkgng: add changelog fragment
* pkgng: Apply changelog suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* pkgng: resolve pep8 style issue
Remove inline function. It's purpose would be confusing for
future maintainers, and someone refactoring it to a variable,
with good intentions, would introduce a performance regression.
Including the `query_update()` call in the if expression makes
the intent more legible and still ensures lazy evaluation of the
function call if the first `and` is `False`.
* pkgng: Fix changelog fragment syntax issue
Need to escape quotes so YAML doesn't eat them
Co-authored-by: Felix Fontein <felix@fontein.de>
* pkgng: Improve output message English grammar
Make word "package" plural only if reporting on more than one package
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>