RPM build error: empty %files file debugfiles.list

In RPM, the order of sections and macros matters. Especially for the %define-s and %global-s ("global definitions").

Moving (or adding it if you don't already have it) the %global debug_package %{nil} above the %prep and %setup sections should do the job.


In case you do not want to tamper with the spec file, you can run the command as:

rpmbuild -ba -D 'debug_package %{nil}' package_name.spec

My problem was solved by moving the %global directive to just beneath the %description directive. I don't know why placement matters.