Bug 1789346

Summary: RFE: Add support for $releasever_major, $releasever_minor, and limited shell expansion for zypp yum repo file compatibility
Product: [Fedora] Fedora Reporter: Neal Gompa <ngompa13>
Component: dnf5Assignee: rpm-software-management
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: carl, daniel.mach, davide, jkolarik, jmracek, jrohel, maxwell, mblaha, mhatina, mhjacks, nsella, packaging-team-maint, pkratoch, riehecky, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1665453    

Description Neal Gompa 2020-01-09 12:11:30 UTC
Description of problem:
Zypper defines in its man page that two additional variables are auto-defined based on $releasever's definition: $releasever_major and $releasever_minor.

Per zypper(8):

> In addition $releasever_major will be set to the leading portion up to
> (but not including) the 1st dot; $releasever_minor to the trailing portion
> after the 1st dot. If there’s no dot in $releasever, $releasever_major is
> the same as $releasever and $releasever_minor is empty.

This can be verified by reading the man page of zypper on any Fedora system.

In addition, it seems that SUSE has implemented very limited shell expansion capabilities for supporting SUSE Linux Enterprise upgrades due to how their OBS names the repos[1].

For example, this is a common thing to see in repo files for SLE when trying to use repos from the openSUSE Build Service (or other OBS instances making SLE packages): "SLE_${releasever_major}${releasever_minor:+_SP$releasever_minor}".

These features may also be useful for dealing with the screwiness of RHEL repositories for EPEL. Currently the epel-release package cannot use $releasever because RHEL defines it as major.minor (e.g. 8.1). This is problematic because it makes distro-upgrades more painful than they should be.

[1]: https://doc.opensuse.org/projects/libzypp/HEAD/structzypp_1_1repo_1_1RepoVarExpand.html

Version-Release number of selected component (if applicable):
4.2.17-1.fc32

Comment 1 Carl George 🤠 2022-10-18 00:01:56 UTC
Is it expected for this will be implemented in dnf5?  I'm working on a proposal for EPEL 10, and I believe I'd be able to make use of $releasever_major and $releasever_minor if they were present.

Comment 2 Maxwell G 2023-05-17 20:59:25 UTC
I'm moving this to the dnf5 component.

Comment 3 Neal Gompa 2023-05-17 21:01:37 UTC
I'd really like to see this implemented in DNF 5 for both SUSE Linux distributions (which use this functionality in Zypper, and I'd like to convince them to adopt DNF 5) and EPEL 10 (who would like to use it so life isn't hard for EPEL 10 repo configuration between CentOS Stream and RHEL/clones/etc).

Can we please prioritize this capability being implemented?

The implementation in libzypp is here:

* header: https://github.com/openSUSE/libzypp/blob/d03a02d986f43266af81c73cced1b310e8615971/zypp/repo/RepoVariables.h
* source: https://github.com/openSUSE/libzypp/blob/d03a02d986f43266af81c73cced1b310e8615971/zypp/repo/RepoVariables.cc