Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro syntax and Spec syntax doc. pages should be interlinked #3331

Open
cryptomilk opened this issue Sep 26, 2024 · 1 comment · May be fixed by #3352
Open

Macro syntax and Spec syntax doc. pages should be interlinked #3331

cryptomilk opened this issue Sep 26, 2024 · 1 comment · May be fixed by #3352
Assignees

Comments

@cryptomilk
Copy link

cryptomilk commented Sep 26, 2024

Describe the bug

I'm currently working on a grammar for tree-sitter: tree-sitter-rpmspec

If you look in the RPM spec file reference to get details about macros, I only find sparse information. I'm trying to get macros supported correctly. There are different kind of macros and all of them are either undocumented or just mentioned briefly.

https://rpm-software-management.github.io/rpm/manual/spec.html

Simple Macro Expansion

%<name|builtin>
%!<name|builtin> # doesn't do anything but is allowed
%?<name|builtin> # defined expression
%!?<name|builtin> # negated defined expression

Macro Expansion

%{<name|builtin>}
%{<name>: ...} # What is the ':' for an operator here? Is it only valid for builtins?
%{?<condition>:<consequence>} # Ternary expression? Normally ternary expressions are <condition> ? <consequence> : <alternative>
%{!?<condition>:<consequence>} # Negated ternary expression

Macro Expressions

%[...] # I have no idea what this does, first time I stumbled upon it.

Macro Shell Expansion

%(...) # Macro expansion allowed inside

Also the macro builtins are not listed!

@cryptomilk cryptomilk changed the title Please document macros in the 'Spec file format' manual Please document the macro syntax in the 'Spec file format' manual Sep 26, 2024
@cryptomilk
Copy link
Author

I've stumbled upon https://rpm-software-management.github.io/rpm/manual/macros.html

This should really be linked in the spec file format document.

@dmnks dmnks changed the title Please document the macro syntax in the 'Spec file format' manual Macro syntax and Spec syntax doc. pages should be interlinked Oct 1, 2024
@dmnks dmnks self-assigned this Oct 2, 2024
dmnks added a commit to dmnks/rpm that referenced this issue Oct 2, 2024
We speak about (built-in) macros and their expansion in various parts of
the spec page but never care to actually mention to the reader that
there's a dedicated page on macro syntax.  Add a bunch of links where
appropriate, and since one of those places mentions %dnl, also add %dnl
to the macro page (this used to be there, just got missed in the
reformatting commit 015c829).

Fixes: rpm-software-management#3331
@dmnks dmnks linked a pull request Oct 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants