[PATCH v2] tests/docker: Add sqlite3 module to openSUSE Leap container

Fabiano Rosas posted 1 patch 8 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240117164227.32143-1-farosas@suse.de
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>
tests/docker/dockerfiles/opensuse-leap.docker | 1 +
tests/lcitool/mappings.yml                    | 4 ++++
tests/lcitool/projects/qemu.yml               | 1 +
3 files changed, 6 insertions(+)
[PATCH v2] tests/docker: Add sqlite3 module to openSUSE Leap container
Posted by Fabiano Rosas 8 months, 1 week ago
Avocado needs sqlite3:

  Failed to load plugin from module "avocado.plugins.journal":
  ImportError("Module 'sqlite3' is not installed.
  Use: sudo zypper install python311 to install it")

From 'zypper info python311':
  "This package supplies rich command line features provided by
  readline, and sqlite3 support for the interpreter core, thus forming
  a so called "extended" runtime."

Include the appropriate package in the lcitool mappings which will
guarantee the dockerfile gets properly updated when lcitool is
run. Also include the updated dockerfile.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/docker/dockerfiles/opensuse-leap.docker | 1 +
 tests/lcitool/mappings.yml                    | 4 ++++
 tests/lcitool/projects/qemu.yml               | 1 +
 3 files changed, 6 insertions(+)

diff --git a/tests/docker/dockerfiles/opensuse-leap.docker b/tests/docker/dockerfiles/opensuse-leap.docker
index dc0e36ce48..cf753383a4 100644
--- a/tests/docker/dockerfiles/opensuse-leap.docker
+++ b/tests/docker/dockerfiles/opensuse-leap.docker
@@ -90,6 +90,7 @@ RUN zypper update -y && \
            pcre-devel-static \
            pipewire-devel \
            pkgconfig \
+           python311 \
            python311-base \
            python311-pip \
            python311-setuptools \
diff --git a/tests/lcitool/mappings.yml b/tests/lcitool/mappings.yml
index 0b908882f1..407c03301b 100644
--- a/tests/lcitool/mappings.yml
+++ b/tests/lcitool/mappings.yml
@@ -59,6 +59,10 @@ mappings:
     CentOSStream8:
     OpenSUSELeap15:
 
+  python3-sqlite3:
+    CentOSStream8: python38
+    OpenSUSELeap15: python311
+
   python3-tomli:
     # test using tomllib
     apk:
diff --git a/tests/lcitool/projects/qemu.yml b/tests/lcitool/projects/qemu.yml
index 82092c9f17..149b15de57 100644
--- a/tests/lcitool/projects/qemu.yml
+++ b/tests/lcitool/projects/qemu.yml
@@ -97,6 +97,7 @@ packages:
  - python3-pip
  - python3-sphinx
  - python3-sphinx-rtd-theme
+ - python3-sqlite3
  - python3-tomli
  - python3-venv
  - rpm2cpio
-- 
2.35.3
Re: [PATCH v2] tests/docker: Add sqlite3 module to openSUSE Leap container
Posted by Michael Tokarev 8 months ago
Sorry for the previous dummy post, - hit the wrong button :)

17.01.2024 19:42, Fabiano Rosas :
> Avocado needs sqlite3:

> --- a/tests/docker/dockerfiles/opensuse-leap.docker
> +++ b/tests/docker/dockerfiles/opensuse-leap.docker
> @@ -90,6 +90,7 @@ RUN zypper update -y && \
>              pcre-devel-static \
>              pipewire-devel \
>              pkgconfig \
> +           python311 \
>              python311-base \
>              python311-pip \

Isn't python311 already pulls in python311-base?

/mjt
Re: Re: [PATCH v2] tests/docker: Add sqlite3 module to openSUSE Leap container
Posted by Andrea Bolognani 8 months ago
On Fri, Jan 19, 2024 at 10:12:37AM +0300, Michael Tokarev wrote:
> 17.01.2024 19:42, Fabiano Rosas :
> > Avocado needs sqlite3:
>
> > --- a/tests/docker/dockerfiles/opensuse-leap.docker
> > +++ b/tests/docker/dockerfiles/opensuse-leap.docker
> > @@ -90,6 +90,7 @@ RUN zypper update -y && \
> >              pcre-devel-static \
> >              pipewire-devel \
> >              pkgconfig \
> > +           python311 \
> >              python311-base \
> >              python311-pip \
>
> Isn't python311 already pulls in python311-base?

Yes, but lcitool doesn't know that :)

The information that is provided to the tool is:

  * the python3 interpreter is in the python311-base package;
  * the venv module is also in the python311-base package;
  * the sqlite3 module is in the python311 package;

(via tests/lcitool/mappings.yml), as well as:

  * QEMU needs the python3 interpreter plus the venv and sqlite3
    packages to build;

(via tests/lcitool/projects/qemu.yml).

Based on that, it concludes that the python311-base and python311
package need to be installed.

Notice how the former shows up only once in the Dockerfile, despite
being mentioned twice in the list of dependencies for the project,
because some basic deduplication is applied.

Of course the extra line doesn't matter at all in practice:

  # zypper install python311
  The following 4 NEW packages are going to be installed:
    libexpat1 libpython3_11-1_0 python311 python311-base

  4 new packages to install.
  Overall download size: 12.8 MiB. Already cached: 0 B.
  After the operation, additional 50.4 MiB will be used.

  # zypper install python311 python311-base
  The following 4 NEW packages are going to be installed:
    libexpat1 libpython3_11-1_0 python311 python311-base

  4 new packages to install.
  Overall download size: 12.8 MiB. Already cached: 0 B.
  After the operation, additional 50.4 MiB will be used.

This is the main reason why we never really bothered trying to avoid
it.

Hope this helps!

-- 
Andrea Bolognani / Red Hat / Virtualization
Re: [PATCH v2] tests/docker: Add sqlite3 module to openSUSE Leap container
Posted by Michael Tokarev 8 months ago

>              python311-setuptools \
> diff --git a/tests/lcitool/mappings.yml b/tests/lcitool/mappings.yml
> index 0b908882f1..407c03301b 100644
> --- a/tests/lcitool/mappings.yml
> +++ b/tests/lcitool/mappings.yml
> @@ -59,6 +59,10 @@ mappings:
>       CentOSStream8:
>       OpenSUSELeap15:
>   
> +  python3-sqlite3:
> +    CentOSStream8: python38
> +    OpenSUSELeap15: python311
> +
>     python3-tomli:
>       # test using tomllib
>       apk:
> diff --git a/tests/lcitool/projects/qemu.yml b/tests/lcitool/projects/qemu.yml
> index 82092c9f17..149b15de57 100644
> --- a/tests/lcitool/projects/qemu.yml
> +++ b/tests/lcitool/projects/qemu.yml
> @@ -97,6 +97,7 @@ packages:
>    - python3-pip
>    - python3-sphinx
>    - python3-sphinx-rtd-theme
> + - python3-sqlite3
>    - python3-tomli
>    - python3-venv
>    - rpm2cpio
Re: [PATCH v2] tests/docker: Add sqlite3 module to openSUSE Leap container
Posted by Alex Bennée 8 months, 1 week ago
Fabiano Rosas <farosas@suse.de> writes:

> Avocado needs sqlite3:
>
>   Failed to load plugin from module "avocado.plugins.journal":
>   ImportError("Module 'sqlite3' is not installed.
>   Use: sudo zypper install python311 to install it")

Queued to testing/next, thanks.

>
> From 'zypper info python311':
>   "This package supplies rich command line features provided by
>   readline, and sqlite3 support for the interpreter core, thus forming
>   a so called "extended" runtime."
>
> Include the appropriate package in the lcitool mappings which will
> guarantee the dockerfile gets properly updated when lcitool is
> run. Also include the updated dockerfile.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>  tests/docker/dockerfiles/opensuse-leap.docker | 1 +
>  tests/lcitool/mappings.yml                    | 4 ++++
>  tests/lcitool/projects/qemu.yml               | 1 +
>  3 files changed, 6 insertions(+)
>
> diff --git a/tests/docker/dockerfiles/opensuse-leap.docker b/tests/docker/dockerfiles/opensuse-leap.docker
> index dc0e36ce48..cf753383a4 100644
> --- a/tests/docker/dockerfiles/opensuse-leap.docker
> +++ b/tests/docker/dockerfiles/opensuse-leap.docker
> @@ -90,6 +90,7 @@ RUN zypper update -y && \
>             pcre-devel-static \
>             pipewire-devel \
>             pkgconfig \
> +           python311 \
>             python311-base \
>             python311-pip \
>             python311-setuptools \
> diff --git a/tests/lcitool/mappings.yml b/tests/lcitool/mappings.yml
> index 0b908882f1..407c03301b 100644
> --- a/tests/lcitool/mappings.yml
> +++ b/tests/lcitool/mappings.yml
> @@ -59,6 +59,10 @@ mappings:
>      CentOSStream8:
>      OpenSUSELeap15:
>  
> +  python3-sqlite3:
> +    CentOSStream8: python38
> +    OpenSUSELeap15: python311
> +
>    python3-tomli:
>      # test using tomllib
>      apk:
> diff --git a/tests/lcitool/projects/qemu.yml b/tests/lcitool/projects/qemu.yml
> index 82092c9f17..149b15de57 100644
> --- a/tests/lcitool/projects/qemu.yml
> +++ b/tests/lcitool/projects/qemu.yml
> @@ -97,6 +97,7 @@ packages:
>   - python3-pip
>   - python3-sphinx
>   - python3-sphinx-rtd-theme
> + - python3-sqlite3
>   - python3-tomli
>   - python3-venv
>   - rpm2cpio

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH v2] tests/docker: Add sqlite3 module to openSUSE Leap container
Posted by Philippe Mathieu-Daudé 8 months, 1 week ago
On 17/1/24 17:42, Fabiano Rosas wrote:
> Avocado needs sqlite3:
> 
>    Failed to load plugin from module "avocado.plugins.journal":
>    ImportError("Module 'sqlite3' is not installed.
>    Use: sudo zypper install python311 to install it")
> 
>  From 'zypper info python311':
>    "This package supplies rich command line features provided by
>    readline, and sqlite3 support for the interpreter core, thus forming
>    a so called "extended" runtime."
> 
> Include the appropriate package in the lcitool mappings which will
> guarantee the dockerfile gets properly updated when lcitool is
> run. Also include the updated dockerfile.
> 

Suggested-by: Andrea Bolognani <abologna@redhat.com>

> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/docker/dockerfiles/opensuse-leap.docker | 1 +
>   tests/lcitool/mappings.yml                    | 4 ++++
>   tests/lcitool/projects/qemu.yml               | 1 +
>   3 files changed, 6 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>