Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Use semver.VersionInfo type, reorg install action, fix circular dep cases, faster installed db lookups #158

Merged
merged 8 commits into from
Nov 5, 2018

Conversation

alikins
Copy link
Contributor

@alikins alikins commented Nov 2, 2018

SUMMARY

Various fixes to improve how installing collections and roles with dependencies works.

Most of this is related to variations of 'do the right thing when asked to install something that is already installed'. Either directly, or as a requirement.

  • Make RepositorySpec class used a semver.VersionInfo object directly instead of just a string.
  • drive action.install breadth first instead of depth first (ie, build up info for the stuff to be installed, install it, accumulate results of all of them, then check for new deps for all new installs, repeat)
  • Add 'db' methods to installed_repository_db for accessing a repo "directly" by specifying a full RepositorySpec instead of a set of constraints to match it. This reduced the number of dirs/files we have to check to answer questions like 'is namespace.name installed?'. Also reduced the number of
    Repository() objects that need to be loaded from disk.
  • Fix up display output.
  • Some str() for objects that need them (RepositorySpec, Requirement). The current ones are kind of ugly but it is a start.
ISSUE TYPE
  • Bugfix Pull Request
MAZER VERSION
name = mazer
version = 0.2.1
config_file = /home/adrian/.ansible/mazer.yml
uname = Linux, newswoop, 4.18.12-100.fc27.x86_64, #1 SMP Thu Oct 4 16:22:17 UTC 2018, x86_64
executable_location = /home/adrian/venvs/galaxy-cli-py3-2/bin/mazer
python_version = 3.6.6 (default, Jul 19 2018, 16:29:00) [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]
python_executable = /home/adrian/venvs/galaxy-cli-py3-2/bin/python

ADDITIONAL INFORMATION

And warn about it later, but don't stop because of it.
In InstallInfo and RepositorySpec models.

* Add convert_string_to_semver util method used
  by models that need a semver.VersionInfo
  converter. Return version if already a
  VersionInfo, else attempt to parse a string
  and convert it

* Support matching for 'no version' as 'any version'
  so searches for installed repos using
  underspecified RepositorySpecs (ie, no version info
  ala 'mazer install alikins.some_repo') can match
  against installed repos of any version.

* Temporarily run str() on semvers when matching against
  galaxy requests. The logic for matching and preserving
  versions of the form '1.0.0' or 'v1.0.0' requires version
  strings for now, since there s no way to have a valid
  semver like 'v1.0.0'.

* Let InstallInfo model be yaml persisted.
  Sort of... add a method to get a yaml-able dict of it.
  This fixes errors writing the install_info data to disk
  (.galaxy_install_info) so that it is persisted corectly.

* Some debug logging cleanup
Start of moving from resolving deps for each repository as
they are installed one by one to installing a list of
things then finding the cumulative requirements and resolving.

Cleanups (rm prettyprinter, etc)
When loading requirements.yml as part of loading
a Repository, pass the RepositorySpec of the Repository
being loaded into requirements.load() so that the
Requirements it creates know which repo asked for
the require.

Update install action to show this info when available.
ie:

  Installing requirement alikins.collection_reqs_2deep_2 (required by alikins.collection_reqs_2deep_1)

ansible_galaxy.repository.load() now attempts to load .galaxy_install_info
first, then collection_info (galaxy.yml) though that latter isnt
really used at the moment.
If passed a full repository_spec, select() will look for that
specific entry directly (ie, if the namespace/name path exists)
instead of iterate over all/most repos and filtering out non-matches.

update irdb.by_requirement() and by_repository_spec() to use
the new select(repository_spec=repo_spec) args.

Reduce the amount of directies we need to read and the number
of repositories we need to load from disk for things like
'is blah installed already?'
Instead of raising exception on the first thing that is already
installed up front, just warn about it in install_repositories
(but before finding/fetching the repo from remote).

install_repositories will just ignore it if is already installed
so that:

        mazer installl ns.something_installed_already ns.new_thing

Will warn that 'ns.something_installed_already' is in fact already
installed. But also continue and install ns.new_thing.
@alikins alikins changed the title [WIP] use semver.VersionInfo type, reorg install action, fix circular dep cases, faster installed db lookups Use semver.VersionInfo type, reorg install action, fix circular dep cases, faster installed db lookups Nov 5, 2018
@alikins alikins merged commit 5ea70d3 into ansible:devel Nov 5, 2018
@alikins
Copy link
Contributor Author

alikins commented Nov 6, 2018

Fixes #155

@alikins
Copy link
Contributor Author

alikins commented Nov 6, 2018

Fixes #138

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant