Commit 511d70166d73fa07f3b275f6d206c107bb194a19
1 parent
cb769c62
Check generated QPDFJob files in CI
This is to catch pull requests that make changes that would affect automatically generated job files without including those modifications.
Showing
3 changed files
with
33 additions
and
1 deletions
build-scripts/prebuild
| 1 | 1 | #!/bin/bash |
| 2 | +set -e | |
| 2 | 3 | cd $(dirname $0)/.. |
| 4 | +if ! ./generate_auto_job --check; then | |
| 5 | + cat 1>&2 <<EOF | |
| 6 | + | |
| 7 | +****************************** | |
| 8 | + | |
| 9 | +An input or output file of generate_auto_job was modified without | |
| 10 | +rerunning ./generate_auto_job. If you are seeing this in your pull | |
| 11 | +request, you should pass --enable-maintainer-mode to ./configure if | |
| 12 | +possible, or if not, run "./generate_auto_job --generate" and include | |
| 13 | +any changed files in your commit. | |
| 14 | + | |
| 15 | +****************************** | |
| 16 | + | |
| 17 | +EOF | |
| 18 | + exit 2 | |
| 19 | +fi | |
| 3 | 20 | build-scripts/build-doc |
| 4 | 21 | build-scripts/download-external-libs | ... | ... |
generate_auto_job
| ... | ... | @@ -247,6 +247,21 @@ class Main: |
| 247 | 247 | if m: |
| 248 | 248 | old_hashes[m.group(1)] = m.group(2) |
| 249 | 249 | match = old_hashes == hashes |
| 250 | + if not match: | |
| 251 | + # Write to stdout, not stderr. What we write to stderr | |
| 252 | + # is visible in a normal build. Writing to stdout will | |
| 253 | + # hide it in that case but expose it if you directly | |
| 254 | + # run ./generate_auto_job --check as in CI. | |
| 255 | + print(f'*** {whoami} hash mismatches ***') | |
| 256 | + match = False | |
| 257 | + for k, v in hashes.items(): | |
| 258 | + if k not in old_hashes: | |
| 259 | + print(f' {k} is not in job.sums') | |
| 260 | + elif v != old_hashes[k]: | |
| 261 | + print(f' {k} was modified') | |
| 262 | + for k in old_hashes: | |
| 263 | + if k not in hashes: | |
| 264 | + print(f' {k} disappeared') | |
| 250 | 265 | except Exception: |
| 251 | 266 | pass |
| 252 | 267 | return match | ... | ... |
job.sums
| 1 | 1 | # Generated by generate_auto_job |
| 2 | -generate_auto_job 751021df2a7f03c5d9a6a0ae07277004a89b9b20fa951fa4097212c72fc982a9 | |
| 2 | +generate_auto_job 464f660527880d5213ada3f5be5bdab05a425610044dbe0a2a918bc1e268726a | |
| 3 | 3 | include/qpdf/auto_job_c_att.hh 1f5d589ccf6684b09a203da261c31fc90a866e6eefe906b673e2d6d5a08ef753 |
| 4 | 4 | include/qpdf/auto_job_c_copy_att.hh 65bdce5382a60f1815214297cf005072f17556ec4a15317b600f9ecc9cb89ea4 |
| 5 | 5 | include/qpdf/auto_job_c_enc.hh 37ca99a124a34bb613f154c6c8934761bd7e7cc5a2719798ccec7edf05b4aeb9 | ... | ... |