On 6/18/19 2:05 PM, Panu Matilainen wrote:
On 6/18/19 10:15 AM, Florian Weimer wrote:
* Panu Matilainen:

Are # lines stripped always, even in scriptlets?


No, because whatever is in scriptlets body belongs to the scriptlet interpreter which certainly is not rpm. Oh, I know...

To that cause, I just submitted https://github.com/rpm-software-management/rpm/pull/753. Doesn't help with comments after %endif though.

Just FWIW, %dnl support is now in rawhide.

What it means in practise is that for the first time there's now a way to escape macro expansion for the rest of the line (so eg multiline macros such as %configure can be commented out with it), it's possible to add comments to macros themselves and comments can appear anywhere in the spec.

The classical example of this is comments intended for the scriptlet below ending up in the previous scriptlet body.
---
%post -p /sbin/ldconfig

%dnl postun is needed to handle foo
%postun
%dnl always do bar first
%{_bindir}/do_bar
%{_bindir}/do_foo
---

...results in:

$ rpm -qp --scripts scriptintr-1.0-1.fc30.noarch.rpm
postinstall program: /sbin/ldconfig
postuninstall scriptlet (using /bin/sh):
/usr/bin/do_bar
/usr/bin/do_foo

...wheras #-comments would end up in the package and in case of "postun is needed to handle foo", in the body of the wrong scriptlet that will cause ldconfig to complain.

        - Panu -
_______________________________________________
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

Reply via email to