Hide Forgot
Description of problem: in spec files, lines starting with '#' should be treated as comments and have no influence on the build process. However, this is not always the case. Version-Release number of selected component (if applicable): RPM-Version 4.8.0 RPM-Version 4.7.2 (probably others as well) How reproducible: Steps to Reproduce: 1. create a spec file test.spec: # test.spec %{!?version: %define version 1.0} %{!?name: %define name test} %{!?release: %define release 1.0} # %define is_client nothing # this line is commented out %{!?is_client: %define is_client 1} Summary: Test of the rpm build system Name: %{name} Version: %{version} Release: %{release} License: GPL Provides: %{name} = %{version} %description Test of the rpm build system %prep echo "the value of is_client is --%{is_client}--" 2. run rpmbuild -ba test.spec Actual results: rpmbuild -ba /usr/src/rpmbuild/SPECS/test.spec Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.enFbre + umask 022 + cd /usr/src/rpmbuild/BUILD + echo the value of is_client is --nothing # this line is commented out-- the value of is_client is --nothing # this line is commented out-- + exit 0 Prüfe auf nicht gepackte Datei(en): /usr/lib/rpm/check-files /usr/src/rpmbuild/BUILDROOT/test-1.0-1.0.i386 Erstellt: /usr/src/rpmbuild/SRPMS/test-1.0-1.0.src.rpm Expected results: Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.lFcTLx + umask 022 + cd /usr/src/rpmbuild/BUILD + echo the value of is_client is --1-- the value of is_client is --1-- + exit 0 Prüfe auf nicht gepackte Datei(en): /usr/lib/rpm/check-files /usr/src/rpmbuild/BUILDROOT/test-1.0-1.0.i386 Erstellt: /usr/src/rpmbuild/SRPMS/test-1.0-1.0.src.rpm Additional info: the value should be 1 in this case (which one could use for instance in a %if statement). It should not be influenced by something on a line starting with '#'
This is expected behavior, see http://www.rpm.org/max-rpm-snapshot/ch-rpm-specref.html
Hi Panu, Ok, but intuitively I wouldn't understand %define itself as a macro. If the macros which are already defined are expanded inside a comment, it wouldn't matter because the line is commented out anyway. The documentation explicitly speaks about multiline macros, that would add new lines which then "run out of the commented area", that's plausible. But %define rather seems to be a command than a macro, because it is not replaced by anything, but defines a macro. I would recommend to add an extra note to the documentation, that everything (including %define) is interpreted even on lines starting with a '#'-sign. The example with the %configure-macro nicely illustrates the problem with multiline macros, but the issue with %define is not that obvious. I must admit, that I have found the list of builtin macros (http://www.rpm.org/wiki/PackagerDocs/Macros#BuiltinMacros) now, which includes %define. But since this is different from the C-preprocessor for example, I would at least add the link to this list on the page of the documentation you have posted. best regards, Martin