1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-22 06:50:18 +03:00

mkosi: Fix mkosi.clangd (#36387)

- 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.
This commit is contained in:
Luca Boccassi 2025-02-14 20:02:45 +00:00 committed by GitHub
commit 21d36ef770
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 8 deletions

View File

@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: systemd/mkosi@4519cfd9f5f4a32c96e4d4e0f2df7005b677057f
- uses: systemd/mkosi@13eb5b68bd5fb234dd0da3b242d80954faf91b95
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
# immediately, we remove the files in the background. However, we first move them to a different location

View File

@ -120,7 +120,7 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: systemd/mkosi@4519cfd9f5f4a32c96e4d4e0f2df7005b677057f
- uses: systemd/mkosi@13eb5b68bd5fb234dd0da3b242d80954faf91b95
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
# immediately, we remove the files in the background. However, we first move them to a different location

View File

@ -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"\
"$@"

View File

@ -43,6 +43,7 @@ class Summary:
release: str
architecture: str
builddir: Path
buildsubdir: Path
environment: dict[str, str]
@classmethod
@ -65,6 +66,7 @@ class Summary:
release=j['Images'][-1]['Release'],
architecture=j['Images'][-1]['Architecture'],
builddir=Path(j['Images'][-1]['BuildDirectory']),
buildsubdir=Path(j['Images'][-1]['BuildSubdirectory']),
environment=j['Images'][-1]['Environment'],
)
@ -298,7 +300,7 @@ def process_coverage(args: argparse.Namespace, summary: Summary, name: str, jour
'--include=*/',
'--include=*.gcno',
'--exclude=*',
f'{os.fspath(args.meson_build_dir / summary.builddir)}/',
f'{os.fspath(summary.builddir / summary.buildsubdir)}/',
os.fspath(Path(tmp) / 'work/build'),
],
check=True,