ppa-dev-tools:set-command-architecture-option

Last commit made on 2023-03-24
Get this branch:
git clone -b set-command-architecture-option https://git.launchpad.net/ppa-dev-tools
Only Bryce Harrington can upload to this branch. If you are Bryce Harrington please log in for upload directions.

Branch merges

Branch information

Name:
set-command-architecture-option
Repository:
lp:ppa-dev-tools

Recent commits

cf6a842... by Bryce Harrington

Use unpack_to_dict() for splitting --architecture values

This is a bit overkill for handling architecture strings, but since
unpack_to_dict() is intended to be used for parsing all handling of
comma-separated values in the CLI, it will be most consistent if it's
used here as well.

9f21837... by Bryce Harrington

Fix invalid split of architectures for unittests

For regular use, architectures were being split into a list by the
create_config() routine. However, in the unittests we're skipping that
functionality and passing config directly, so the architecture string
isn't split, thus breaking the test cases.

Since it was already intended to move the architecture splitting
behavior out of create_config() to command-specific parsing, do that now
for all commands (create, set, and tests) that support an architecture
option.

ff444e4... by Bryce Harrington

Fix flake/lint issues

0d704b8... by Bryce Harrington

helpers: Refactor setProcessors() for brevity

a112936... by Bryce Harrington

ppa: Use publish variable

The code already extracts 'publish' from the config as a variable, so
use it here too.

5a3c15f... by Bryce Harrington

create/set: Check for undefined architecture arguments

If no architectures were specified, bail out early to avoid hitting an
exception.

There isn't a clear use case for why someone might want a PPA configured
with no architectures (even if Launchpad allows it) so treat it as an
ignorable degenerate case.

For now, this is not treated as a fatal error (i.e. the overall exit
code remains 0), however the tool will not POST to Launchpad in this
case, so the PPA will remain configured with the same architectures it
had before.

390ce1d... by Bryce Harrington

create/set: Add tests for creating/setting with custom architectures

Add test cases for handling setting processor architectures either at
creation time or subsequently via 'ppa set'. This functionality needs a
separate test case than the basic create/set tests since internally the
processors are stored as a LP object, so need a bit more processing
during validation to extract the string names for comparison.

4a55c5f... by Bryce Harrington

ppa_group: Don't auto-forward parameters to the createPPA() API

The Launchpad createPPA() POST method does not actually support that
many parameters beside name and description, so this is of minimal
actual utility. Further, for the additional parameters it does supply,
'distribution' requires a LP Distribution object, and 'private' implies
additional handling that's not yet implemented in ppa-dev-tools. The
only other parameter, 'suppress_subscription_notifications', sounds like
it may be a narrow use case.

Rather than allow these to be passed abstractly as **kwargs, they can be
explicitly defined when the requisite underlying functionality
supporting them is added.

6220373... by Bryce Harrington

create/set: Add support for --publish setting

The --publish/--no-publish parameters controls whether or not the PPA is
configured to allow packages to be downloaded once they've been
successfully built. With --no-publish, packages will still be
built (although not for private PPAs, for some reason).

c543114... by Bryce Harrington

tests: Override the archive in PersonMock to use ArchiveMock

In Launchpad, a Person (or Team) is used to construct an Archive (or
PPA). Since the unittest won't be communicating with Launchpad itself,
we need to replicate all these objects via mocks.

If we construct the ArchiveMock() only when requested in getPPAByName(),
then any changes made to it by the set command won't be persisted
anywhere, thus making it impossible to validate the settings we've
changed.

So, instead, the PersonMock forcibly redefines the archive property for
the Ppa class to return the ArchiveMock, thereby moving it to a deeper
level down where changes to it will be captured and persisted.