Skip to content

manifest: Honor release version overrides in per-architecture bases - #3099

Open
LUX-ETVERITAS wants to merge 1 commit into
rpm-software-management:mainfrom
LUX-ETVERITAS:fix/manifest-releasever
Open

LUX-ETVERITAS wants to merge 1 commit into
rpm-software-management:mainfrom
LUX-ETVERITAS:fix/manifest-releasever

Conversation

@LUX-ETVERITAS

Copy link
Copy Markdown
Contributor

manifest new and manifest resolve create a separate DNF base for each target architecture. The global CLI records --releasever in the main base's variables, so the per-architecture bases could resolve packages and write repository URLs for a different release.

Pass the command-line release version and its major and minor overrides to each manifest base before setup. Apply the component overrides after setting the full version so an explicit --releasever-minor takes precedence over the derived value.

Verification

  • Built the manifest plugin and ran the two new Behave scenarios. Both failed against the original plugin and passed with this change.
  • Tested two local releases with different builds of the same package. With an environment default of 44.1 and a command-line override of 43.1, manifest new, manifest resolve, and manifest resolve --use-host-repos recorded the 43.1 repository and its package build. Omitting the override selected 44.1.

Fixes #2846

Copy the command-line release version into each manifest base before
setup loads repository configuration. Apply explicit major and minor
overrides after releasever has populated its derived components.

Exercise manifest new and manifest resolve against a repository whose
URL depends on all three release version variables.

Fixes rpm-software-management#2846

Assisted-by: Codex
@LUX-ETVERITAS
LUX-ETVERITAS requested a review from a team as a code owner December 4, 2026 05:39
@LUX-ETVERITAS
LUX-ETVERITAS requested review from kontura and removed request for a team December 4, 2026 05:39
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

manifest: Honor release version overrides in per-architecture bases

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes


AI Description

• Copies command-line --releasever, --releasever-major, and --releasever-minor into each
 per-architecture manifest base before setup.
• Applies component overrides after the full release version so explicit values win over derived
 ones.
• Adds Behave scenarios covering manifest new and manifest resolve with a release-dependent
 repository URL.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed private-base variables flow directly into repository URL substitution used by manifest new, resolve, and download.
  • These commands share the same bounded manifest repository-processing integration and produce the single end-to-end outcome of resolving or acquiring packages from manifest repositories.
Sources

dnf5-plugins/manifest_plugin/manifest.cpp[314-322]

    auto vars = base->get_vars();
    const auto & cli_vars = get_context().get_base().get_vars()->get_variables();
    // Setting releasever derives both components, so apply their overrides last.
    for (const auto * name : {"releasever", "releasever_major", "releasever_minor"}) {
        auto it = cli_vars.find(name);
        if (it != cli_vars.end() && it->second.priority == libdnf5::Vars::Priority::COMMANDLINE) {
            vars->set(name, it->second.value, it->second.priority);
        }
    }
Behavioral complexity 🟡 Medium 🧩 Compatibility cases

  • Before, each architecture-specific private base received the runtime architecture but did not explicitly preserve command-line release-version variables.
  • After, the code copies command-line releasever, then reapplies explicit major and minor overrides because setting releasever derives both components.
  • The new correctness condition is precedence-sensitive mixed-variable behavior: whole releasever derivation must not overwrite independently supplied releasever_major or releasever_minor values.
  • The underlying repository substitution remains an existing direct mapping operation.
Sources

dnf5-plugins/manifest_plugin/manifest.cpp[314-322]

    auto vars = base->get_vars();
    const auto & cli_vars = get_context().get_base().get_vars()->get_variables();
    // Setting releasever derives both components, so apply their overrides last.
    for (const auto * name : {"releasever", "releasever_major", "releasever_minor"}) {
        auto it = cli_vars.find(name);
        if (it != cli_vars.end() && it->second.priority == libdnf5::Vars::Priority::COMMANDLINE) {
            vars->set(name, it->second.value, it->second.priority);
        }
    }
Potential damage 🟡 Medium 🩹 Temporary loss

  • If the changed behavior regresses, command-line release-version values can be absent or inconsistent in the private base, causing manifest repository URLs to target the wrong release or fail to load.
  • The affected capability can generally be retried after correcting the invocation or repository state; no persistent-state corruption or external compensation is established.
  • Reverting the code stops further incorrect private-base construction.
  • A failed operation can be rerun, while a manifest generated from an unintended repository may need regeneration; the source does not establish automatic repair.
Sources

dnf5-plugins/manifest_plugin/manifest.cpp[314-322]

    auto vars = base->get_vars();
    const auto & cli_vars = get_context().get_base().get_vars()->get_variables();
    // Setting releasever derives both components, so apply their overrides last.
    for (const auto * name : {"releasever", "releasever_major", "releasever_minor"}) {
        auto it = cli_vars.find(name);
        if (it != cli_vars.end() && it->second.priority == libdnf5::Vars::Priority::COMMANDLINE) {
            vars->set(name, it->second.value, it->second.priority);
        }
    }
Assessed commit 89c52b1
Diagram

graph TD
    CLI["CLI base vars"] --> COPY["Copy release vars"] --> ARCH["Per-arch base"] --> REPO["Repo baseurl"]
Loading
High-Level Assessment

Copying only the three release-version variables that were set on the command line is the right scope. Copying all CLI variables would also pull in unrelated settings that the per-architecture base should set itself. Applying the components after the full version is required, since setting releasever derives major and minor. The approach is sound as written.

Files changed (2) +39 / -1

Bug fix (1) +10 / -1
manifest.cppPropagate command-line release version variables to per-arch bases +10/-1

Propagate command-line release version variables to per-arch bases

• In create_base_for_arch, copies releasever, releasever_major, and releasever_minor from the main base when they were set on the command line. Sets releasever first so it derives components, then applies the explicit major and minor overrides so they take precedence.

dnf5-plugins/manifest_plugin/manifest.cpp

Tests (1) +29 / -0
vars-releasever.featureAdd scenario for release version overrides in manifest commands +29/-0

Add scenario for release version overrides in manifest commands

• Adds a scenario outline running manifest new and manifest resolve --use-host-repos with --releasever=43.1 and --releasever-minor=7. It uses a local repository whose baseurl depends on all three release variables and asserts the generated manifest selects the 43.1 repository and its package build.

integration-tests/dnf-behave-tests/dnf/vars-releasever.feature

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review
Tip of the day
💡 Did you know, you can import rules and skills only from the repositories your team follows

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗


Powered by Qodo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dnf manifest new PACKAGE ignores --releasever

1 participant