build-cran-binaries/.pre-commit-config.yaml
pat-s 3c0459006a
fix(patches): replace the RcppParallel system-TBB patch with a link-order fix
RcppParallel 6.x rewrote its build: src/Makevars.in no longer has the
`USE_TBB=Linux` block the registry patch edited, so the patch could never
apply and every build logged "Patch for RcppParallel did not apply cleanly".

The workaround it implemented is also obsolete. 6.x bundles oneTBB 2022 and
builds it with cmake, which works on musl and with g++ 8-15, so there is no
longer a reason to link a system TBB -- and linking one publishes a binary
that needs a TBB the consumer does not have.

What is still broken upstream is the link order. configure.R names the TBB
directory with `-Wl,-L`, and gcc expands its own search dirs into `-L` options
ahead of anything forwarded verbatim with `-Wl,`, so on a build host with a
distro TBB installed `-ltbb` resolves to that library and RcppParallel.so
records its SONAME instead of the bundled `libtbb.so`. The new patch passes a
plain `-L` instead.

Verified on alpine 3.24, redhat 8 and ubuntu noble: RcppParallel gets NEEDED
libtbb.so with RPATH $ORIGIN/../lib and loads with every system libtbb moved
away, and rstan 2.32.7 compiles and loads against it with no makevars override
-- RcppParallel::CxxFlags() already emits -DTBB_INTERFACE_NEW -- so the rstan
entry is dropped too.

Summary:

- replace RcppParallel/system-tbb.patch with bundled-tbb-link-order.patch
- scope the RcppParallel entry to >=6.0.0 and widen its platforms to "*"
- drop the rstan entry, made redundant by the bundled oneTBB
- exclude local/patches/*.patch from the whitespace-mutating hooks, which
  rewrote context lines in every diff
2026-07-31 06:28:39 +00:00

60 lines
2 KiB
YAML

# cSpell:ignore autofix autoupdate
# Excluded: verbatim GPL license and auxiliary shell scripts with intentional
# in-string formatting (reformatting would corrupt their output).
exclude: |
(?x)^(
LICENSE\.md|
benchmark/|
docker/reprex/
)
# The `^local/patches/.*\.patch$` excludes below keep unified diffs byte-exact:
# a context line for a blank line is a single space, and stripping it (or
# appending a newline) makes `git apply` reject the patch, which surfaces as
# "patch did not apply cleanly" at build time rather than as a lint failure
# here. The exclusions are per-hook, not global, so `validate patch registry`
# still runs when a patch changes.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
exclude: ^local/patches/.*\.patch$
- id: trailing-whitespace
exclude: ^local/patches/.*\.patch$
args:
- --markdown-linebreak-ext=md
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.23.2
hooks:
- id: markdownlint-cli2
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.9.6
hooks:
- id: prettier
- repo: https://github.com/posit-dev/air-pre-commit
rev: 0.11.0
hooks:
- id: air-format
- repo: https://github.com/editorconfig-checker/editorconfig-checker
rev: v3.8.0
hooks:
- id: editorconfig-checker
exclude: ^local/patches/.*\.patch$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.38.0
hooks:
- id: yamllint
args: [--strict, -c=.yamllint.yaml]
- repo: local
hooks:
- id: yaml-file-extension
name: Check if YAML files has *.yaml extension.
entry: YAML filenames must have .yaml extension.
language: fail
files: .yml$
- id: validate-patches
name: validate patch registry
entry: Rscript local/validate-patches.R
language: system
files: ^local/(patches/|validate-patches\.R$)
pass_filenames: false