Re: Future and future home of the %{version_no_tilde} macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 06, 2024 at 12:51:59AM +0100, Fabio Valentini wrote:
> On Fri, Dec 6, 2024 at 12:07 AM Kan-Ru Chen <kanru@xxxxxxxxxx> wrote:
> >
> > On Fri, Dec 6, 2024, at 5:57 AM, Fabio Valentini wrote:
> > > Hello fellow packagers,
> > >
> > > The %{version_no_tilde} macro is a "convenient" way of converting RPM
> > > version strings into "SemVer-ish" (or even Python-ish) version
> > > strings. It currently lives with the Rust macros.
> > >
> > > However, the macro is a bit weird, hard to use, and sometimes has
> > > "surprising" results. No Rust spec files that have been generated with
> > > recent versions of rust2rpm use it - and I plan to do a round of "spec
> > > refreshes with recent rust2rpm" to remove many of the remaining uses.
> > >
> > > I see that it is in use in some non-Rust packages by now. But sooner
> > > rather than later, no Rust packages will use this macro
> >
> > What do Rust packages use now?
> 
> Rust packages use just %{version} if it matches the crate version, or
> a separately defined %{crate_version} macro that is just defined to be
> the unmodified crate version.
> This way there's no requirement for the conversions from SemVer -> RPM
> -> SemVer to round-trip correctly (where the first part is implemented
> properly in cargo2rpm, and the second part is implemented incompletely
> in the %{version_no_tilde} macro in Lua).
> 
> > > So I think it would make sense to move it into a different package and
> > > / or to "fix" it for some weird behaviour.
> >
> > It makes sense. Given semver is so widely adopted. Are there issues opened
> > for the weird behaviour?
> 
> Not "issues" per se, no. The limitations come from the fact that the
> macro is ... a macro. And it's written in Lua.
> You need to pass arguments in a really weird way, because the macro
> accepts zero, one, or two *positional* arguments.
> For example, there is no way to say "use the default for the first
> argument and pass this string as the second argument".
> 
> Additionally, the implementation is rather naive as well - it only
> replaces occurrences of "~" with a configurable separator (default:
> "-") so it is not even strictly suited to be a full RPM -> SemVer
> reverse-converter.
> This is the reason why recent rust2rpm versions just define a separate
> %crate_version macro that contains the SemVer version string, instead
> of converting the version string twice.
> 
An improvement will likely be to use keyword arguments for the macro --
but IIRC that does not work in RHEL 9's RPM?

Best,

-- 
 _o) Michel Lind
_( ) identities: https://keyoxide.org/5dce2e7e9c3b1cffd335c1d78b229d2f7ccc04f2

Attachment: signature.asc
Description: PGP signature

-- 
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux