Skip to content

[bug] system package manager install_substitutes method does not work in check mode  #3162

Open
@weatherhead99

Description

@weatherhead99

Environment details

  • Operating System+version: openSUSE Leap 15.4 (linux)
  • Compiler+version: gcc-11
  • Conan version: 2.0.3
  • Python version: 3.9.16

when using a recipe installing system requirements which uses the "install_substitutes" method of system package manager (specifically Zypper, have not tested others), when the conan config tools.system.package_manager:mode=check, the command fails even if one of the substitutes is already installed

note in the log below the package names appear a little bit mangled somehow (i.e. including the square brackets)

Steps to reproduce

create basic conan file recipe:

from conan import ConanFile
from conan.tools.system.package_manager import Zypper

class BasicConanfile(ConanFile):
    name = "pkg"
    version = "1.0"

    def system_requirements(self):
        tool = Zypper(self)
        tool.install_substitutes([["nonexistant_library", "systemd-devel"]], update=True, check=True)

try to install this dependency with package manager in check mode :

conan install . -c tools.system.package_manager:mode=check

Logs


======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
[conf]
tools.system.package_manager:mode=check
[buildenv]
CC=/usr/bin/gcc-11
CXX=/usr/bin/g++-11

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
[conf]

[buildenv]
CC=/usr/bin/gcc-11
CXX=/usr/bin/g++-11


======== Computing dependency graph ========
Graph root
    conanfile.py (pkg/1.0): /home/danw/Software/conan_test_sysreq/conanfile.py

======== Computing necessary packages ========
conanfile.py (pkg/1.0): RUN: rpm -q ['nonexistant_library', 'systemd-devel']
package [nonexistant_library, is not installed
package systemd-devel] is not installed

conanfile.py (pkg/1.0): WARN: Command 'rpm -q ['nonexistant_library', 'systemd-devel']' failed
ERROR: conanfile.py (pkg/1.0): Error in system_requirements() method, line 10
        tool.install_substitutes([["nonexistant_library", "systemd-devel"]], update=True, check=True)
        ConanException: None of the installs for the package substitutes succeeded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions