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.