How to create -debuginfo subpackage?

Hello, its me again.

I am trying to create a debuginfo package for LibreCAD_3 https://build.opensuse.org/package/show/home:andythe_great/LibreCAD3
but I got the error saying

LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr may only be packaged in the -debuginfo subpackage 
LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr/local may only be packaged in the -debuginfo subpackage
LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr/local/lib may only be packaged in the -debuginfo subpackage
LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr/local/lib/liblckernel.so-0.0+git20200308.908b0fad-0.x86_64.debug may only be packaged in the -debuginfo subpackage
LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr/local/lib/liblcluascript.so-0.0+git20200308.908b0fad-0.x86_64.debug may only be packaged in the -debuginfo subpackage 
LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr/local/lib/libpersistence.so-0.0+git20200308.908b0fad-0.x86_64.debug may only be packaged in the -debuginfo subpackage 
LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr/local/lib/libtinyspline.so-0.0+git20200308.908b0fad-0.x86_64.debug may only be packaged in the -debuginfo subpackage 
LibreCAD_3.x86_64: E: suse-filelist-forbidden-debuginfo (Badness: 10000) /usr/lib/debug/usr/local/lib/libtinysplinecpp.so-0.0+git20200308.908b0fad-0.x86_64.debug may only be packaged in the -debuginfo subpackage

I read on this documentation:
https://en.opensuse.org/openSUSE:Packaging_guidelines
https://old-en.opensuse.org/Packaging/Debuginfo

But could not find example of spec file to make -debuginfo subpackage.

I tried adding a debuginfo package as such:


%package  debuginfo
Summary:   Debug information for package %{name}
Group:     Development/Libraries/C and C++
#BuildArch: noarch
 
%description debuginfo
Debug information for package %{name}.

But I got this error:

line 75: %package  debuginfo: package LibreCAD_3-debuginfo already exists

So I disabled it.

I tried adding debug info %files list as well but it does not work.

%files debuginfo
/usr/lib/debug
/usr/lib/debug/usr
/usr/lib/debug/usr/local
/usr/lib/debug/usr/local/lib
/usr/lib/debug/usr/local/lib/liblckernel.so-0.0+git20200308.908b0fad-0.x86_64.debug.debug
/usr/lib/debug/usr/local/lib/liblcluascript.so-0.0+git20200308.908b0fad-0.x86_64.debug.debug
/usr/lib/debug/usr/local/lib/libpersistence.so-0.0+git20200308.908b0fad-0.x86_64.debug.debug
/usr/lib/debug/usr/local/lib/libtinyspline.so-0.0+git20200308.908b0fad-0.x86_64.debug.debug
/usr/lib/debug/usr/local/lib/libtinysplinecpp.so-0.0+git20200308.908b0fad-0.x86_64.debug.debug

Thanks.

Hi
You add the %debug_package macro before %prep and then ensure you enable the debug flags in the repository, no additional changes or sub packages need creating in the spec file.

Thanks, I just fond out I don’t need to package .debug file.