|
13 | 13 | ``import_boost.py`` is different from the other steps. Re-vendoring restores |
14 | 14 | the upstream files under ``upstream/boost/`` and intentionally removes the |
15 | 15 | project's vendored patches; ``apply_patches.py`` must be run afterwards. |
16 | | -The workflow runs this optional pair only once, on the Linux leg, when |
17 | | -``tools/import_boost.py`` changed relative to the CI base revision. The AST |
18 | | -steps need only ``clang++`` (no libclang) and the pinned MinGW sysroot. |
| 16 | +The workflow runs this optional pair on every run, on the Linux leg only: the |
| 17 | +result must be the committed tree, so an edit under ``upstream/boost/`` that no |
| 18 | +patch carries, or a patch dropped without its effect, fails. The AST steps need |
| 19 | +only ``clang++`` (no libclang) and the pinned MinGW sysroot. |
19 | 20 |
|
20 | 21 | Usage: |
21 | 22 | python3 tools/ci/verify_generated.py |
22 | | - python3 tools/ci/verify_generated.py --import-boost-if-changed |
| 23 | + python3 tools/ci/verify_generated.py --import-boost |
23 | 24 | """ |
24 | 25 |
|
25 | 26 | import argparse |
|
31 | 32 |
|
32 | 33 | ROOT = Path(__file__).resolve().parents[2] |
33 | 34 | TOOLS = ROOT / "tools" |
34 | | -IMPORT_BOOST = "tools/import_boost.py" |
35 | 35 |
|
36 | 36 |
|
37 | 37 | def git(*args, capture_output=False): |
@@ -115,54 +115,23 @@ def _merge_base(): |
115 | 115 | return None |
116 | 116 |
|
117 | 117 |
|
118 | | -def _changed_since_base(path): |
119 | | - """Return whether *path* changed in the current CI revision range.""" |
120 | | - for base in _base_revisions(): |
121 | | - names = git_text("diff", "--name-only", "{}...HEAD".format(base), "--", path) |
122 | | - if names is not None: |
123 | | - return bool(names.strip()) |
124 | | - |
125 | | - # Local runs and unusual GitHub events do not always provide a base ref. |
126 | | - # HEAD^ is still a useful and deterministic fallback for the normal case. |
127 | | - if _revision_exists("HEAD^{commit}"): |
128 | | - names = git_text("diff", "--name-only", "HEAD^..HEAD", "--", path) |
129 | | - if names is not None: |
130 | | - return bool(names.strip()) |
131 | | - |
132 | | - # An initial commit has no parent; inspect the complete tree instead. |
133 | | - names = git_text("diff-tree", "--root", "--no-commit-id", "--name-only", "-r", "HEAD", "--", path) |
134 | | - return bool(names and names.strip()) |
135 | | - |
136 | | - |
137 | | -def import_boost_changed(): |
138 | | - changed = _changed_since_base(IMPORT_BOOST) |
139 | | - print( |
140 | | - "{} changed in the CI revision range: {}".format( |
141 | | - IMPORT_BOOST, "yes" if changed else "no" |
142 | | - ) |
143 | | - ) |
144 | | - return changed |
145 | | - |
146 | | - |
147 | 118 | def main(): |
148 | 119 | parser = argparse.ArgumentParser(description=__doc__) |
149 | 120 | parser.add_argument( |
150 | | - "--import-boost-if-changed", |
| 121 | + "--import-boost", |
151 | 122 | action="store_true", |
152 | | - help="run import_boost.py once when it changed since the CI base", |
| 123 | + help="re-import the pinned Boost release and replay the patches first", |
153 | 124 | ) |
154 | 125 | args = parser.parse_args() |
155 | 126 |
|
156 | 127 | assert_clean("initial checkout") |
157 | 128 |
|
158 | | - if args.import_boost_if_changed and import_boost_changed(): |
| 129 | + if args.import_boost: |
159 | 130 | # import_boost intentionally removes the vendored patches, so its |
160 | 131 | # intermediate diff is expected. The following apply_patches step is the |
161 | 132 | # idempotent boundary checked by CI and restores the committed state. |
162 | 133 | run_step("import_boost.py", check_diff=False) |
163 | 134 | run_step("apply_patches.py") |
164 | | - elif args.import_boost_if_changed: |
165 | | - print("skip tools/import_boost.py (unchanged)") |
166 | 135 |
|
167 | 136 | # Keep this order aligned with docs/architecture.md: provision the pinned |
168 | 137 | # target headers, confirm the vendored adaptations are in place, then |
|
0 commit comments