Search code examples
rpmrpmbuildrpm-spec

How to use %debug_package while using rpmbuild?


Linux version 2.6.18-131.el5 gcc version 4.1.2 RPM version 4.4.2.3

I use the following command to build packages: $ sudo rpmbuild -ba xxx.spec

I thought that the debuginfo package should be built by default, but only get the xxx.src.rpm and xxx.x86_64.rpm, with no debuginfo package.

Then I add a line in my xxx.spec, "#%debug_package":

enter image description here

Then the debug package is built! But I thought that a line with a '#' in the front is considered as comment! How does this work?

I'm totally confused.


Solution

  • This is one of the most annoying "features" in rpm and it gets people all the time. The # is only commenting out the first line of a multi-line macro. The proper way to comment it out would be

    #%%debug_package
    

    The first % escapes the second; the result after macro becomes what you wanted.