[Rpm-maint] [rpm-software-management/rpm] spec file preprocessing on rpm level (#1472)

Michal Novotný notifications at github.com
Thu Jan 27 22:37:50 UTC 2022


> > I mean this is a good question. One reason for having a preprocessing stage is existence of source rpms. Basically both lua scriplets and shell expansions are evaluated once srpm is built and then later when rpm is built from that srpm. The thing is that contexts (i.e. what information is available to the build process) is different each time. [..]
> 
> > Therefore if such external context is to be used, it should be done so that evaluation is done only once (when building the srpm) and later the same precomputed results are used without any additional evaluation.  [..]
> 
> It doesn't look like `%{}` are evaluated/expanded at srpm-build time.

Try to make spec file with e.g.:

`Name: %{lua: print('hello')}`

and call `rpmbuild --define '_sourcedir .' -bs some.spec`. You should see

`Wrote: /home/clime/rpmbuild/SRPMS/hello-0.2-2.fc34.src.rpm`

which means they are evaluated/expanded.

> 
> However, if we added some srpm time expansion, that would fit your requirement, no?
> 
> ```
> %{lua(source):
> print('%changelog')
> exec whatever etc..
> }
> ```
> 
> Common code for generating changelog from git could be added the the lua rpm extension, so packagers could call: %{lua(source): rpm.git_changelog()}

If `source` meant "evaluate at the srpm build-stage only and keep the expanded value in the spec file verbatim", it would probably fit the requirement, yes.

> 
> I just found out there is an %autochangelog now: https://fedoraproject.org/wiki/Changes/rpmautospec, did you know?!

Yes, that solution solution relies on build system modifying the spec file based on some regexp parsing of the spec file (i.e. whether it contains %autochangelog) - it's not very clean.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1472#issuecomment-1023705899
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/1472/1023705899 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220127/32599785/attachment-0001.html>


More information about the Rpm-maint mailing list