# Use: https://www.redhat.com/en/blog/alternatives-command # Weak Dependencies: https://docs.fedoraproject.org/en-US/packaging-guidelines/WeakDependencies/ %bcond_without no_more_compat_pkg %global maj_ver 22 %global min_ver 0 %global patch_ver 0 %global maj_compat_ver %{lua: print(tonumber(rpm.expand('%maj_ver'))-1)} Name: llvn%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} Release: 25 Summary: A demo for versioning llvn License: FIXME # Alternative 1: Have compat version be optionally installable %if %{with no_more_compat_pkg} Obsoletes: llvn%{maj_compat_ver} < %{version} %endif # Alternative 2: Make compat version a requirement # NOTE: The provides is a good idea to have anyway but it is needed for this in particular. # Provides: %%{name}(major) = %%{maj_ver} # %%if %%{with no_more_compat_pkg} # Obsoletes: llvn%%{maj_compat_ver} < %%{version} # %%else # Requires: llvn%%{maj_compat_ver}(major) = %%{maj_compat_ver} # %%endif Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives %description TBD. %prep # we have no source, so nothing here %build cat > hello-world-%{maj_ver}.sh <