[SRU][Q:unstable][PATCH 1/1] UBUNTU: [Packaging] Add compilation commands database to build info.
Mehmet Basaran
mehmet.basaran at canonical.com
Sat Aug 16 16:29:57 UTC 2025
> - This is just a single file, does that have to be a tar archive? Or
> could it be just a gzip?
I could make it gzip no problem. I felt it shoulb be compressed at least
because the size is around ~50-60 MBs uncompressed which is far bigger
than anything we have put in linux-buildinfo.
> - Would deleting the file not be better in a clean: section? Then it
> would be possible to grab it after compilation if one does so locally...
Makes sense.
I will submit a v2 with these changes.
-------------- next part --------------
Stefan Bader <stefan.bader at canonical.com> writes:
> On 14.08.25 10:00, Mehmet Basaran wrote:
>> BugLink: https://bugs.launchpad.net/bugs/2119438
>>
>> Other source code tagging utilities (such as gtags) index the whole
>> code base. However, in practice quite a bit of code base is disabled
>> (either through macro definitions or makefiles where some sources
>> are kept out of compilation).
>>
>> When inspecting a crash on certain architecture, it would help a lot
>> to search thought only the active source code. Language servers does
>> this but requires compilation commands to parse the code exactly as
>> it was compiled. Linux has a script to generate compile_commands.json
>> but it is not used by our builds.
>>
>> Users can build the sources themselves and generate this file. However,
>> this requires compilation first and it takes quite a bit of time. Since
>> we already compile the code, it takes at most a couple seconds more
>> to generate this file.
>>
>> Signed-off-by: Mehmet Basaran <mehmet.basaran at canonical.com>
>> ---
>> debian/rules.d/2-binary-arch.mk | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
>> index 74927753e04d..64e6f1bd88d1 100644
>> --- a/debian/rules.d/2-binary-arch.mk
>> +++ b/debian/rules.d/2-binary-arch.mk
>> @@ -463,6 +463,12 @@ endif
>> # Strip .so files (e.g., rust/libmacros.so) to reduce size even more
>> find $(hdrdir) -name libmacros.so -exec strip -s {} \;
>>
>> + # Export compilation commands for language servers
>> + scripts/clang-tools/gen_compile_commands.py
>> + tar -a -jcf compile_commands.tgz compile_commands.json
>> + install -m644 compile_commands.tgz $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/compile_commands.tgz
>> + rm compile_commands.tgz compile_commands.json
>
> Just two little things I am wondering about:
>
> - This is just a single file, does that have to be a tar archive? Or
> could it be just a gzip?
>
> - Would deleting the file not be better in a clean: section? Then it
> would be possible to grab it after compilation if one does so locally...
>
>> +
>> ifeq ($(do_lib_rust),true)
>> # Generate Rust lib files
>> install -d -m755 $(rustdir)
>> @@ -759,4 +765,3 @@ endif
>> .PHONY: binary-arch
>> binary-arch: $(binary-arch-deps-true)
>> @echo Debug: $@
>> -
>> --
>> 2.43.0
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 873 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20250816/8544a677/attachment.sig>
More information about the kernel-team
mailing list