[libvirt] [jenkins-ci PATCH 13/17] guests: Install meson via pip

Andrea Bolognani abologna at redhat.com
Thu Oct 3 10:48:12 UTC 2019


On Tue, 2019-10-01 at 16:28 +0200, Fabiano Fidêncio wrote:
> +++ b/guests/lcitool
> +        pip_install = []
> +        pip_mappings = {
> +            "meson" : "meson==0.49.0",
> +        }

This makes me think that perhaps we should have this information
encoded in the mapping, eg.

  meson:
    default: meson
    CentOS7: pip3(meson==0.49.0)

Of course then we'd be in the business of parsing that, which would
not be too bad in Python but probably a fair amount of pain in the
Ansible playbook...

Maybe a reasonable compromise would be to have something like

  pip_mappings:
    meson:
      default: meson==0.49.0

in addition to the existing mappings, and that use that information
as a fallback when a regular mapping is not available. Easier to
parse, even though it's less explicit about what's going on behind
the scenes, especially if you're only looking at the regular mapping.
On the other hand, it would avoid hardcoding the Meson installation
command in the Ansible playbook, which you're doing right now and is
a bit unsavory.

What do you think about the latter approach? It seems like it would
be fairly easy to implement and, while far from perfect, a slight
step up from what you currently have.

[...]
> +        if pip_install:
> +            varmap["pip_install"] = " ".join(sorted(pip_install))
> +            sys.stdout.write(textwrap.dedent("""
> +                RUN pip3 install {pip_install}
> +            """).format(**varmap))

It would be nice if we got the pip packages aligned nicely in the
output, same as the native packages, but that's not a blocker :)

> +++ b/guests/playbooks/update/tasks/packages.yml
> +- name: '{{ project }}: Install meson from pip'
> +  command: pip3 install meson==0.49.0
> +  args:
> +    creates: /usr/local/bin/meson
> +  when:
> +    - temp["meson"] is defined
> +    - temp["meson"] == None

Ansible has a pip module[1] which we should probably use for this;
on the other hand, from a quick look at the documentation I'm a bit
unclear on the implications when it comes to the version of pip that
would be invoked on each platform, so we can leave it be for now and
switch in a follow-up patch.


Incidentally, now that we are installing Python 3 on CentOS 7, we
should be able to set

  ansible_python_interpreter: /usr/bin/python3

in its host_vars. I haven't made sure that would actually work, but
it certainly would be nice to run everything on Python 3.


[1] https://docs.ansible.com/ansible/latest/modules/pip_module.html
-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list