]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Fix mkosi.clangd 36387/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 14 Feb 2025 14:22:05 +0000 (15:22 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 14 Feb 2025 16:13:10 +0000 (17:13 +0100)
- Add missing '--' delimiter
- Use the new BuildSubdirectory JSON field to figure out the build
  subdirectory.
- Remove the /usr/include path mapping for now. This means we can't
  jump into system headers anymore if they don't exist on the host,
  we can find a way to add this back later if it turns out to be
  crucial.

mkosi.clangd

index 23251baf632af6fe3d36100a5034d1bb6558367f..19ec84c2c9d93bdefbdadb3c5cb9ea87000f0c81 100755 (executable)
@@ -9,20 +9,19 @@ else
 fi
 
 MKOSI_CONFIG="$("${SPAWN[@]}" mkosi --json summary | jq -r .Images[-1])"
-DISTRIBUTION="$(jq -r .Distribution <<< "$MKOSI_CONFIG")"
-RELEASE="$(jq -r .Release <<< "$MKOSI_CONFIG")"
-ARCH="$(jq -r .Architecture <<< "$MKOSI_CONFIG")"
+BUILDDIR="$(jq -r .BuildDirectory <<< "$MKOSI_CONFIG")"
+BUILDSUBDIR="$(jq -r .BuildSubdirectory <<< "$MKOSI_CONFIG")"
 
 exec "${SPAWN[@]}" mkosi \
     --incremental=strict \
     --build-sources-ephemeral=no \
     --format=none \
     build \
+    -- \
     clangd \
     --compile-commands-dir=/work/build \
     --path-mappings="\
 $(pwd)=/work/src,\
-$(pwd)/build/mkosi.builddir/$DISTRIBUTION~$RELEASE~$ARCH/=/work/build,\
-$(pwd)/build/mkosi.cache/$DISTRIBUTION~$RELEASE~$ARCH~build.cache/usr/include/=/usr/include" \
+$BUILDDIR/$BUILDSUBDIR=/work/build"\
     "$@"