Kenneth Goldman kirjoitti 10.3.2023 klo 15.51:
Here's another "surprise for the new user" that I suggest being added.
What does the % character mean?
Sometimes it's the beginning of a section. Sometimes it's a macro.
I see now that the web page color codes the two differently,
but that's not obvious.
It would be helpful to explain that early
Good idea.
I pushed an update to the pull request I have open from your earlier
suggestions [1].
Please take a look.
[1]: https://pagure.io/fedora-docs/package-maintainer-docs/pull-request/115
and provide links
or other instructions on how to find the list of each.
Someone posted /usr/lib/rpm/macros for the list
of macros and suggested rpm -E macro to
view the expansion.
For spec file sections, the link is already there:
"You can find more information in the RPM Reference Manual’s section
[Spec file format]."
Regarding listing available macros, the situation is unfortunately complex.
You can indeed look into /usr/lib/rpm/macros and find many macros in there.
Unfortunately, they are the macros that are available in your local system.
There are many more available in packages you have not installed,
and also the environment where the package is built has a different set
of packages installed:
Just a minimal base plus anything that is added with BuildRequires.
Similarly for evaluating macros with "rpm -E '%macro'",
it works and is useful, but there are many caveats:
fedpkg inserts some rpm configuration when it runs,
the result depends on the specfile content,
the set of installed packages also affects the result,
and so on.
So while explaining these things somewhere would be useful,
I hesitate to try to do that in the tutorial.
My fear is that attempting to explain these topics correctly would
distract the reader too much.
I think it is better to just leave the reader to take the listed macros
as given for now.
For example, if I try the `rpm -E` method with the very first macro in
the tutorial, I get this:
$ rpm -E '%autosetup`
error: lua script failed: attempt to index a nil value
So if the tutorial explains 'rpm -E' at all,
it should also explain why that happens locally, but the build works.
Also, this is a slippery slope, because presumably then the reader
should also be given a method to check how the macro evaluates during
the build.
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it:
https://pagure.io/fedora-infrastructure/new_issue