Re: Status of the forge macros?

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

 



On 5/25/23 03:02, Panu Matilainen wrote:
On 5/24/23 18:26, Zbigniew Jędrzejewski-Szmek wrote:
Minor comment:
   %(c=%{commit}; echo ${c:0:7})
is a bit nicer because it doesn't require 'cut', it just uses 'echo',
which is a shell builtin.

Or in rpm >= 4.19 (just landed in rawhide), you can just do

    %{sub %{commit} 1 8}

Both of these suggestions are really nice small improvements. Thanks!

Since this use case is in the Version field, and therefore the expansion is needed in the source RPMs, I will have to wait to use the RPM macro until my machine and the Koji builders are on rpm >=4.19. It’s still good to know about.

The shell-parameter-expansion suggestion takes a zero-based index and length[1], while the Lua routine exposed in the RPM macro takes the first and last one-based indices of the substring[2], so the exact equivalent would be:

    %{sub %{commit} 1 7}

[1] https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

[2] https://www.lua.org/pil/20.html
_______________________________________________
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