Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigRepo.get_baseurl_option().empty() returns False while len(ConfigRepo.get_baseurl_option().get_value() == 0 #1859

Open
thozza opened this issue Nov 14, 2024 · 0 comments
Labels
Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take

Comments

@thozza
Copy link

thozza commented Nov 14, 2024

ConfigRepo.get_baseurl_option().empty() returns False while len(ConfigRepo.get_baseurl_option().get_value() == 0. This is the case for any installed package. One would expect empty() to return True if the returned value is an empty list / tuple.

python3-libdnf5-5.2.6.2-1.fc41.x86_64
#!/usr/bin/python3

import libdnf5

def list_installed_pkg_repo_baseurl_bug():
    base = libdnf5.base.Base()
    base.load_config()
    base.setup()

    repo_sack = base.get_repo_sack()
    repo_sack.create_repos_from_system_configuration()
    repo_sack.load_repos(libdnf5.repo.Repo.Type_SYSTEM)

    query = libdnf5.rpm.PackageQuery(base)
    query.filter_installed()

    for pkg in query:
        pkg_repo_config = pkg.get_repo().get_config()
        # Logically, this should never be true, but it is
        if not pkg_repo_config.get_baseurl_option().empty() and len(pkg_repo_config.get_baseurl_option().get_value()) == 0:
            print(pkg.get_name())
            print(f"  Pkg repo ID: {pkg.get_from_repo_id()}")
            print(f"  Pkg baseurl value: {pkg_repo_config.get_baseurl_option().get_value()}")
            print(f"  Pkg baseurl value_string: {pkg_repo_config.get_baseurl_option().get_value_string()}")


if __name__ == "__main__":
    list_installed_pkg_repo_baseurl_bug()
@thozza thozza changed the title RepoConfig.get_baseurl_option().empty() returns False while len(RepoConfig.get_baseurl_option().get_value() == 0 ConfigRepo.get_baseurl_option().empty() returns False while len(ConfigRepo.get_baseurl_option().get_value() == 0 Nov 14, 2024
@jan-kolarik jan-kolarik added Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take labels Nov 19, 2024
@github-project-automation github-project-automation bot moved this to Backlog in DNF team Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Projects
Status: Backlog
Development

No branches or pull requests

2 participants