Skip to content

treebuilder.py: get_branding inconsistency #1430

@cjschroeder

Description

@cjschroeder

In treebuilder.py, get_branding() tries to determine which package provides "system-release".

query = dnf5.rpm.PackageQuery(self.dbo)
query.filter_provides(["system-release"], EQ)
pkgs = sorted([p for p in list(query)
                       if not p.get_name().startswith("generic")])

This past week, I started to see issues with lorax and creating a custom bootiso. I've been using lorax, since fc28 or fc32, for this exact thing without issue.

Depending on how the specified repositories are loaded, the results in "pkgs" will vary and affect the value of

release = pkgs[0].get_name()

and then cause issue due to a conflict with installing mydist-logos and fedora-logos.

I created a simple script to demonstrate the indeterminate results.

#!/usr/bin/python3

import libdnf5
from libdnf5.common import QueryCmp_EQ as EQ

base = libdnf5.base.Base()
base.load_config_from_file()
base.setup()
sack = base.get_repo_sack()
sack.create_repos_from_system_configuration()
sack.update_and_load_enabled_repos(False)

rq = libdnf5.repo.RepoQuery(base)
rq.filter_enabled(True)
print("Using repos: ", ", ".join(r.get_id() for r in rq))

q = libdnf5.rpm.PackageQuery(base)
q.filter_provides(["system-release"], EQ)
s = sorted([p for p in list(q) if not p.get_name().startswith("generic")])
print("Using: ", s[0])
print("   ", repr(s[0]))

Run multiple instances of the above script and you'll see differing output.

$ ./t1.py
Using repos:  mydist, fedora, updates, mydist-dev
Using:  mydist-release-40-1.fc40.noarch
    <libdnf5.rpm.Package object, mydist-release-40-1.fc40.noarch, id: 1234>

$ ./t1.py
Using repos:  mydist-dev, mydist, fedora, updates
Using:  mydist-release-40-2.fc40.noarch
    <libdnf5.rpm.Package object, mydist-release-40-2.fc40.noarch, id: 1240>

$ ./t1.py
Using repos:  fedora, mydist-dev, mydist, updates
Using:  fedora-release-40-38.noarch
    <libdnf5.rpm.Package object, fedora-release-40-38.noarch, id: 7995>

$ ./t1.py
Using repos:  updates, mydist-dev, fedora, mydist
Using:  fedora-release-40-39.noarch
    <libdnf5.rpm.Package object, fedora-release-40-39.noarch, id: 3090

I have found that by reordering the "--source" arguments to lorax has thus far resolved the issue.

Original:

$ lorax \
   <snip>
   --source="https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Everything/x86_64/os/" \
   --source="https://dl.fedoraproject.org/pub/fedora/linux/updates/40/Everything/x86_64/" \
   --source="http://10.88.0.11/dnfrepo" \
   <snip>

Resolved:

$ lorax \
   <snip>
   --source="https://dl.fedoraproject.org/pub/fedora/linux/releases/40/Everything/x86_64/os/" \
   --source="http://10.88.0.11/dnfrepo" \   <--- THIS
   --source="https://dl.fedoraproject.org/pub/fedora/linux/updates/40/Everything/x86_64/" \
   <snip>

Components:

Fedora 40

$ rpm -qa|grep -E 'lorax|python3-3.12|dnf5'
lorax-templates-generic-40.7-1.fc40.x86_64
lorax-40.7-1.fc40.x86_64
lorax-lmc-virt-40.7-1.fc40.x86_64
lorax-lmc-novirt-40.7-1.fc40.x86_64
libdnf5-5.1.17-2.fc40.x86_64
libdnf5-cli-5.1.17-2.fc40.x86_64
dnf5-5.1.17-2.fc40.x86_64
dnf5-plugins-5.1.17-2.fc40.x86_64
python3-libdnf5-5.1.17-2.fc40.x86_64
python3-3.12.7-1.fc40.x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions