meson: Improve buildinfo.h generation #967
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
meson: Improve buildinfo.h generation to avoid repo ownership issue
mesonのgitコミット情報の生成処理を更新します。
ユーザーが所有してないgitリポジトリでコミット情報の取得に失敗したときは既存の
buildinfo.h
を利用してビルドを続行します。このとき既存のヘッダーが無ければビルドが中断されます。
合わせてエラーメッセージやログのコンソール出力を追加します。
また、README.mdに概要と回避策を追加します。
背景
CVE-2022-24765 の対策が導入されたgitを使うとユーザーが所有してないリポジトリは操作が拒否されるようになりました。
JDimのビルドは毎回コミット情報を取得しているためroot権限が必要な場所へインストールするときgitに失敗して情報が消去されることがありました。
sudoをつけて実行するとコミット情報が消失するのはユーザーの直感に反する動作であるためヘッダー再利用やビルド中断を導入します。
meson: Prevent buildinfo.h update if hash not changed
buildinfo.h
を生成するとき内容をハッシュ計算して既存のものと値が同じならファイルを更新しません。これにより再ビルドのステップが短縮されることがあります。ハッシュ計算プログラムが見つからないときは従来のように毎回更新されます。さらにヘッダーファイルの更新状況をコンソールに出力します。関連のissue: #965