wait: Handle lazr BadRequest during wait operation
Launchpad can return BadRequest errors in some indeterminate situations,
possibly such as if Launchpad is under heavy loads, but also potentially
due to usage/configuration issues.
Include logic to retry the Launchpad operations in case the problem is
server-side, but also limit the number of sequential retries to 3, to
avoid getting stuck in a loop if the problem is something else. The
counter is reset to zero each time we successfully complete a wait
cycle, so that if Launchpad is *slightly* glitchy this will be
forgiving.
The PPA web interface includes an overview page (suited to end users)
and a more technically detailed +packages page. This latter page tends
to be what Ubuntu packagers need, so it is not uncommon for people to
share links to PPAs as this +packages link. So, support handling of
this (and any other +whatever pages under the PPA namespace that might
exist).
Quell traceback on user interrupt during configuration
The create_config() command may include a call to Launchpad to determine
the current LP username in some circumstances. If there are issues this
can cause some unexpected delay, leading to the user cancelling the
process (via <control>+c) which triggers the usual python traceback for
the KeyboardInterrupt exception.
The various PPA commands already include exception handling for this
case, but the config loading occurs prior to the command execution
itself. So, the fix is to include similar exception handling for the
create_config() command.
Hat tip to Andreas for pointing out 'owner' is Launchpad's preferred
jargon for the person or team that a PPA belongs to.
Support the --team-name argument and the 'team_name' configuration
parameter for legacy reasons, even though the former didn't exist and
the latter was bugged.
Modify ppa_address_split() to not use a default team if the team name
was undefined, and instead let it be returned as None. Then handled
undefined team names in create_config() by making use of any team
specified on the command line or config file, before falling back to the
lp username as the final default. And error out if that still doesn't
work.
With this, allow synonym options --owner and --team for convenience.
wait: Improve exit behavior on build failures of subset of PPA
By default `ppa wait` monitors all build jobs, but this adds a couple
parameters to narrow this to just jobs for a specific source package via
the 'name' parameter, and/or jobs created within a timeframe specified
by the 'wait_max_age_hours' configuration parameter.
This also adds another configuration parameter
'exit_on_only_build_failure' which when true will make the ppa wait
command terminate if the only jobs that it is monitoring are failed
builds (this is helpful for CI/CD integration).
results: Add show_results() for managing display of results
With most of the formatting logic for a single result now moved to the
new to_bullet_tree() member for the Results class, a new helper function
show_results() is added to manage the high level results display logic
for a list of results.
This new function is intended to follow the design style of
show_running() and show_waiting() from the Jobs module.
Notably, the one user-visible change in this refactoring is that, like
show_running() and show_waiting(), it will display "(none)" when there
are no results.